File tree 8 files changed +402
-536
lines changed
8 files changed +402
-536
lines changed Original file line number Diff line number Diff line change
1
+ FROM mcr.microsoft.com/devcontainers/python:1-3.12-bullseye
2
+
3
+ COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /usr/local/bin/
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " AoC-Python" ,
3
- "image" : " mcr.microsoft.com/devcontainers/python:1-3.12-bullseye" ,
3
+ "build" : {
4
+ "dockerfile" : " Dockerfile"
5
+ },
4
6
"features" : {
5
- "ghcr.io/devcontainers-contrib/features/mypy:2" : {},
6
- "ghcr.io/devcontainers-contrib/features/poetry:2" : {},
7
7
"ghcr.io/devcontainers-contrib/features/shfmt:1.0.0" : {},
8
8
"ghcr.io/lukewiwa/features/shellcheck:0" : {}
9
9
},
10
+ "containerEnv" : {
11
+ "UV_CACHE_DIR" : " ${containerWorkspaceFolder}/.uv/cache" ,
12
+ "UV_TOOL_DIR" : " ${containerWorkspaceFolder}/.uv/tools"
13
+ },
10
14
"postCreateCommand" : " bash ./.devcontainer/post-install.sh" ,
11
15
"portsAttributes" : {
12
16
"8080" : {
20
24
" charliermarsh.ruff" ,
21
25
" editorconfig.editorconfig" ,
22
26
" github.vscode-github-actions" ,
27
+ " ms-azuretools.vscode-docker" ,
23
28
" ms-python.mypy-type-checker"
24
29
]
25
30
}
Original file line number Diff line number Diff line change 2
2
3
3
set -ex
4
4
5
- WORKSPACE_DIR=$( pwd)
5
+ # Install python tools to be available outside venv
6
+ uv tool install poethepoet
6
7
7
- # Change some Poetry settings to make it more friendly in a container
8
- poetry config cache-dir ${WORKSPACE_DIR} /.poetry_cache
9
- poetry config virtualenvs.in-project true
10
-
11
- # Now install all dependencies, including dev dependencies
12
- poetry install --with=dev
8
+ # Synchronize venv and dependencies
9
+ uv sync
13
10
14
11
echo " Done!"
Original file line number Diff line number Diff line change 16
16
jobs :
17
17
build :
18
18
runs-on : ubuntu-latest
19
+ env :
20
+ UV_CACHE_DIR : /tmp/.uv-cache
19
21
steps :
20
22
- uses : actions/checkout@v4
21
- - name : Install poetry
22
- run : pipx install poetry
23
+ - name : Set up uv
24
+ # Install latest uv version using the installer
25
+ run : curl -LsSf https://astral.sh/uv/install.sh | sh
23
26
- uses : actions/setup-python@v5
27
+ id : setup_python
24
28
with :
25
29
python-version : ' 3.12'
26
- cache : ' poetry'
27
- - run : poetry install
28
- - run : poetry run poe validate
30
+ - name : Restore uv cache
31
+ uses : actions/cache@v4
32
+ with :
33
+ path : /tmp/.uv-cache
34
+ key : uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
35
+ restore-keys : |
36
+ uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
37
+ uv-${{ runner.os }}
38
+ - name : Install dependencies
39
+ run : uv sync
40
+ - name : Run verifications
41
+ run : uvx --from poethepoet poe validate
42
+ - name : Minimize uv cache
43
+ run : uv cache prune --ci
Original file line number Diff line number Diff line change @@ -144,6 +144,9 @@ venv.bak/
144
144
.dmypy.json
145
145
dmypy.json
146
146
147
+ # uv
148
+ .uv /
149
+
147
150
# Pyre type checker
148
151
.pyre /
149
152
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
- [tool . poetry ]
1
+ [project ]
2
2
name = " adventofcode"
3
3
version = " 0.1.0"
4
4
description = " "
5
- authors = [
" Niko Böckerman <[email protected] >" ]
6
5
readme = " README.md"
7
-
8
- [project ]
9
- name = " adventofcode"
10
6
requires-python = " >=3.12"
7
+ dependencies = [
8
+ " typer>=0.12.4" ,
9
+ " joblib>=1.4.2" ,
10
+ ]
11
+
12
+ [project .scripts ]
13
+ adventofcode = " adventofcode.main:app"
11
14
12
15
[tool .poe .tasks ]
13
16
mypy = " mypy ."
@@ -25,31 +28,24 @@ runall = "adventofcode"
25
28
validate = [" lint" , " test" , " runall" ]
26
29
27
30
28
- [tool .poetry .dependencies ]
29
- python = " ^3.12"
30
- typer = " ^0.12.4"
31
- joblib = " ^1.4.2"
32
-
33
- [tool .poetry .group .dev .dependencies ]
34
- mypy = " ^1.11.1"
35
- pytest = " ^8.3.2"
36
- ruff = " ^0.6.1"
37
- poethepoet = " ^0.27.0"
38
- snakeviz = " ^2.2.0"
39
- tuna = " ^0.5.11"
40
- pyinstrument = " ^4.7.2"
41
- pyright = " ^1.1.376"
42
- joblib-stubs = " ^1.4.2.3.20240619"
43
-
44
- [tool .poetry .scripts ]
45
- adventofcode = " adventofcode.main:app"
31
+ [tool .uv ]
32
+ dev-dependencies = [
33
+ " ruff>=0.6.2" ,
34
+ " pyright>=1.1.377" ,
35
+ " joblib-stubs>=1.4.2.3.20240619" ,
36
+ " mypy>=1.11.1" ,
37
+ " pytest>=8.3.2" ,
38
+ " snakeviz>=2.2.0" ,
39
+ " tuna>=0.5.11" ,
40
+ " pyinstrument>=4.7.2" ,
41
+ ]
46
42
47
43
[tool .pyright ]
48
- pythonVersion = " 3.12"
44
+ # pythonVersion = "3.12"
49
45
typeCheckingMode = " strict"
50
46
51
47
[tool .mypy ]
52
- python_version = " 3.12"
48
+ # python_version = "3.12"
53
49
strict_optional = true
54
50
enable_incomplete_feature = [" NewGenericSyntax" ]
55
51
@@ -115,5 +111,5 @@ ignore = [
115
111
116
112
117
113
[build-system ]
118
- requires = [" poetry-core " ]
119
- build-backend = " poetry.core.masonry.api "
114
+ requires = [" hatchling " ]
115
+ build-backend = " hatchling.build "
You can’t perform that action at this time.
0 commit comments