@@ -2,20 +2,22 @@ version: 2.1
22
33
44orbs :
5- python : circleci/python@1.4 .0
5+ python : circleci/python@3.1 .0
66 codecov :
codecov/[email protected] 77
88
99executors :
1010 # Basically extending what the python orb's executor does:
1111 # - s/tag/version/
12- # - default to 3.7
12+ # - more conservative interpreter version (usually)
1313 # - set common environment vars
1414 default :
1515 parameters :
16+ # This serves both as a 'local' variable and as as method for overriding
17+ # in certain test cells (eg, main test suite matrix)
1618 version :
1719 type : string
18- default : " 3.7 "
20+ default : " 3.9 "
1921 docker :
2022 - image : cimg/python:<< parameters.version >>
2123 # TODO: explicitly select 'resource_class: small' if credits ever become
@@ -26,7 +28,11 @@ executors:
2628 # least, as of 2025ish?) and will cause the "real" site-packages to omit
2729 # those packages, leading to subtle problems with subshells (like when
2830 # using sudo).
31+ # TODO: this can /probably/ go away once use of uv is stable?
2932 PYTHONNOUSERSITE : " 1"
33+ # Not-in-CWD UV venv location (else all the tools have to be told to
34+ # ignore it, sigh)
35+ UV_PROJECT_ENVIRONMENT : " /home/circleci/venv"
3036 # So we get pretty output for some subcommands.
3137 TERM : screen-256color
3238
@@ -36,20 +42,45 @@ commands:
3642 setup :
3743 steps :
3844 - checkout
45+ # Debuggery - which uv is this container on?
46+ - run : " which uv && uv --version"
47+ # General Debuggery
48+ - run : |
49+ whoami ; echo
50+ pwd ; echo
51+ env|sort
52+ # Explicitly generate uv venv w/ pip inside. (alas, uv sync doesn't
53+ # accept this arg [yet?])
54+ - run : |
55+ pwd
56+ uv venv --seed
3957 # This is worth using over a vanilla invocations task for 2 reasons:
4058 # - kinda hard to use invocations if it's not installed yet...
4159 # - the python orb is fully integrated with Circle's caching stuff
60+ # NOTE: It should auto-detect UV from existence of `uv.lock`
4261 - python/install-packages :
43- # For now, we expect most Pythons 3.7-3.9+ to be happy with the
44- # same pile of dependencies, so this lets us reuse the cache
45- # across matrix cells.
62+ args : " --verbose "
63+ # For now, we expect most Pythons to be happy with the same pile of
64+ # dependencies, so this lets us reuse the cache across matrix cells.
4665 include-python-in-cache-key : false
47- pre-install-steps :
48- # This must occur here and not as a regular step; otherwise
49- # cache loading stomps all over it and you get broken pip.
50- - run : pip install pip==24.0
51- pkg-manager : pip
52- pip-dependency-file : dev-requirements.txt
66+ # Inform the caching layer where our venv is.
67+ # TODO: can we ref $UV_PROJECT_ENVIRONMENT in here? unlikely??
68+ # TODO: does circle have any sorta global-to-workflow variables we
69+ # could use instead?
70+ venv-path : ' ["/home/circleci/venv"]'
71+ # TODO: if 3.2.0+ is fixed re: ability to use local exec, then we can
72+ # use cache-folder-prefix here, depending on what the real default
73+ # value is (it's either empty string - meaning pwd - or /tmp/cache)
74+ # Safety check vs lockfile
75+ - run : " uv tree"
76+ # Set up for human interactive-like shell env re: venv path, etc,
77+ # Use multiline string for easier quoting; ensure venv comes /first/ in
78+ # case we override global commands like pip
79+ - run : |
80+ echo 'export PATH="$UV_PROJECT_ENVIRONMENT"/bin:"$PATH"' >> "$BASH_ENV"
81+ # Finally, safety check helping prove new PATH works: do we see the
82+ # seeded pip?
83+ - run : which -a pip
5384
5485 # "Wait around on errors" helper for circleci-cli local use
5586 debug :
@@ -59,7 +90,7 @@ commands:
5990 # Sleep for a very long time on failure, if opt-in env var set.
6091 # Necessary to keep circleci cli from nuking its containers :weary:
6192 # TODO: some non super nested way to get actual python version in use
62- command : " test -z \" $DEBUG\" || (\n\n ###### RUN vvvv LOCALLY LMAO\n # docker exec -it $(docker container ls --filter ancestor=cimg/python:3.7 --format \" {{.ID}}\" ) bash\n ######\n\n sleep 18000)"
93+ command : " test -z \" $DEBUG\" || (\n\n ###### RUN vvvv LOCALLY LMAO\n # docker exec -it $(docker container ls --filter ancestor=cimg/python:3.9 --format \" {{.ID}}\" ) bash\n ######\n\n sleep 18000)"
6394 when : on_fail
6495 no_output_timeout : 5h
6596
@@ -80,11 +111,6 @@ jobs:
80111 # Python interpreter version
81112 version :
82113 type : string
83- # Optional 'pip install' argstr for post-setup package tweaking,
84- # eg 'some-dependency==some-older-version test-dep==better-for-circle'
85- pip-overrides :
86- type : string
87- default : " " # evaluates falsey
88114 # For easier running eg integration tests w/ matrix-friendly setup
89115 task :
90116 type : string
@@ -94,11 +120,6 @@ jobs:
94120 version : " << parameters.version >>"
95121 steps :
96122 - setup
97- - when :
98- condition : " << parameters.pip-overrides >>"
99- steps :
100- # NOTE: eschewing python orb install-packages here, overkill/buggy
101- - run : " pip install << parameters.pip-overrides >>"
102123 - run : " inv << parameters.task >>"
103124 - debug
104125
0 commit comments