Skip to content

Commit 58a60a0

Browse files
committed
Modernization
- Python 3.9+, for various reasons. I tried to support 3.8, promise; it just wasn't to be. - latest non-broken stable version of Circle's Python orb - uv pkg-manager - remove all references to pip, including ci-specific escape hatch (expecting to add back as a convention-based pyproject.toml dependency-group somehow, if necessary, I forget which project/s used that feature)
1 parent 2a6a2e7 commit 58a60a0

File tree

1 file changed

+30
-23
lines changed

1 file changed

+30
-23
lines changed

main.yml

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ version: 2.1
22

33

44
orbs:
5-
python: circleci/python@1.4.0
5+
python: circleci/python@3.1.0
66
codecov: codecov/[email protected]
77

88

99
executors:
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:
1616
version:
1717
type: string
18-
default: "3.7"
18+
default: "3.9"
1919
docker:
2020
- image: cimg/python:<< parameters.version >>
2121
# TODO: explicitly select 'resource_class: small' if credits ever become
@@ -36,20 +36,37 @@ commands:
3636
setup:
3737
steps:
3838
- checkout
39+
# Debuggery - which uv is this container on?
40+
- run: "which uv && uv --version"
41+
# General Debuggery
42+
- run: |
43+
whoami ; echo
44+
pwd ; echo
45+
env|sort
46+
# Explicitly generate uv venv w/ pip inside. (alas, uv sync doesn't
47+
# accept this arg [yet?])
48+
- run: |
49+
pwd
50+
uv venv --seed
3951
# This is worth using over a vanilla invocations task for 2 reasons:
4052
# - kinda hard to use invocations if it's not installed yet...
4153
# - the python orb is fully integrated with Circle's caching stuff
54+
# NOTE: It should auto-detect UV from existence of `uv.lock`
4255
- 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.
56+
args: "--verbose"
57+
# For now, we expect most Pythons to be happy with the same pile of
58+
# dependencies, so this lets us reuse the cache across matrix cells.
4659
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
60+
# Safety check vs lockfile
61+
- run: "uv tree"
62+
# Set up for human interactive-like shell env re: venv path, etc,
63+
# Expect uv's default venv location; use multiline string for easier
64+
# quoting; ensure venv comes /first/ in case we override globals
65+
- run: |
66+
echo 'export PATH=.venv/bin:"$PATH"' >> "$BASH_ENV"
67+
# Finally, safety check helping prove new PATH works: do we see the
68+
# seeded pip?
69+
- run: which -a pip
5370

5471
# "Wait around on errors" helper for circleci-cli local use
5572
debug:
@@ -59,7 +76,7 @@ commands:
5976
# Sleep for a very long time on failure, if opt-in env var set.
6077
# Necessary to keep circleci cli from nuking its containers :weary:
6178
# 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\nsleep 18000)"
79+
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\nsleep 18000)"
6380
when: on_fail
6481
no_output_timeout: 5h
6582

@@ -80,11 +97,6 @@ jobs:
8097
# Python interpreter version
8198
version:
8299
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
88100
# For easier running eg integration tests w/ matrix-friendly setup
89101
task:
90102
type: string
@@ -94,11 +106,6 @@ jobs:
94106
version: "<< parameters.version >>"
95107
steps:
96108
- 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 >>"
102109
- run: "inv << parameters.task >>"
103110
- debug
104111

0 commit comments

Comments
 (0)