@@ -2,20 +2,22 @@ version: 2.1
2
2
3
3
4
4
orbs :
5
- python : circleci/python@1.4 .0
5
+ python : circleci/python@3.1 .0
6
6
codecov : codecov/codecov@3.2.4
7
7
8
8
9
9
executors :
10
10
# Basically extending what the python orb's executor does:
11
11
# - s/tag/version/
12
- # - default to 3.7
12
+ # - more conservative interpreter version (usually)
13
13
# - set common environment vars
14
14
default :
15
15
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)
16
18
version :
17
19
type : string
18
- default : " 3.7 "
20
+ default : " 3.9 "
19
21
docker :
20
22
- image : cimg/python:<< parameters.version >>
21
23
# TODO: explicitly select 'resource_class: small' if credits ever become
@@ -26,7 +28,11 @@ executors:
26
28
# least, as of 2025ish?) and will cause the "real" site-packages to omit
27
29
# those packages, leading to subtle problems with subshells (like when
28
30
# using sudo).
31
+ # TODO: this can /probably/ go away once use of uv is stable?
29
32
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"
30
36
# So we get pretty output for some subcommands.
31
37
TERM : screen-256color
32
38
@@ -36,20 +42,45 @@ commands:
36
42
setup :
37
43
steps :
38
44
- 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
39
57
# This is worth using over a vanilla invocations task for 2 reasons:
40
58
# - kinda hard to use invocations if it's not installed yet...
41
59
# - the python orb is fully integrated with Circle's caching stuff
60
+ # NOTE: It should auto-detect UV from existence of `uv.lock`
42
61
- 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.
46
65
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
53
84
54
85
# "Wait around on errors" helper for circleci-cli local use
55
86
debug :
@@ -59,7 +90,7 @@ commands:
59
90
# Sleep for a very long time on failure, if opt-in env var set.
60
91
# Necessary to keep circleci cli from nuking its containers :weary:
61
92
# 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)"
63
94
when : on_fail
64
95
no_output_timeout : 5h
65
96
@@ -80,11 +111,6 @@ jobs:
80
111
# Python interpreter version
81
112
version :
82
113
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
88
114
# For easier running eg integration tests w/ matrix-friendly setup
89
115
task :
90
116
type : string
@@ -94,11 +120,6 @@ jobs:
94
120
version : " << parameters.version >>"
95
121
steps :
96
122
- 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 >>"
102
123
- run : " inv << parameters.task >>"
103
124
- debug
104
125
0 commit comments