Skip to content

Commit 9f18a4b

Browse files
authored
Merge pull request #21 from DanCardin/dc/uv
chore: Convert from poetry to uv.
2 parents 66f8110 + 61af600 commit 9f18a4b

File tree

11 files changed

+946
-717
lines changed

11 files changed

+946
-717
lines changed

.github/workflows/release.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Github Release/Publish PyPi
1+
jame: Github Release/Publish PyPi
22

33
on:
44
push:
@@ -21,17 +21,15 @@ jobs:
2121
runs-on: ubuntu-latest
2222
environment:
2323
name: pypi
24-
url: https://pypi.org/p/cappa
24+
url: https://pypi.org/p/dataclass-settings
2525
permissions:
2626
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
2727
steps:
28-
- name: Install poetry
29-
uses: abatilo/actions-poetry@v2.0.0
30-
with:
31-
poetry-version: 1.2.2
28+
- name: Set up uv
29+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
3230
- name: Checkout
33-
uses: actions/checkout@v1
31+
uses: actions/checkout@v4
3432
- name: Build dist
35-
run: poetry build
33+
run: uvx --from build pyproject-build --installer uv
3634
- name: Publish package distributions to PyPI
3735
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/test.yml

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,61 +21,64 @@ jobs:
2121
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
2222
pydantic-version: ["1.0", "2.0"]
2323

24+
env:
25+
UV_CACHE_DIR: /tmp/.uv-cache
2426
steps:
25-
- uses: actions/checkout@v3
27+
- uses: actions/checkout@v4
2628
- name: Set up Python
2729
uses: actions/setup-python@v4
2830
with:
2931
python-version: ${{ matrix.python-version }}
3032
architecture: x64
3133
allow-prereleases: true
3234

33-
- name: Install poetry
34-
uses: abatilo/actions-poetry@v2.0.0
35+
- name: Set up uv
36+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
37+
- name: Restore uv cache
38+
uses: actions/cache@v4
3539
with:
36-
poetry-version: 2.0.0
37-
38-
- name: Set up cache
39-
uses: actions/cache@v3
40-
with:
41-
path: ~/.cache/pypoetry/virtualenvs
42-
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
40+
path: /tmp/.uv-cache
41+
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
4342
restore-keys: |
44-
${{ runner.os }}-poetry-
43+
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
44+
uv-${{ runner.os }}
4545
4646
- name: Install dependencies
4747
run: |
4848
make install
49-
pip install 'pydantic~=${{ matrix.pydantic-version }}'
49+
uv pip install 'pydantic~=${{ matrix.pydantic-version }}'
5050
5151
- name: Run Linters
52-
run: poetry run make lint
52+
run: make lint
5353

5454
- name: Run tests
55-
run: poetry run make test
55+
run: make test
5656

5757
- name: Store test result artifacts
5858
uses: actions/upload-artifact@v4
5959
with:
6060
path: coverage-${{ matrix.python-version }}-${{ matrix.pydantic-version }}.xml
6161

62-
- name: Coveralls
63-
env:
64-
COVERALLS_FLAG_NAME: run-${{ inputs.working-directory }}
65-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66-
COVERALLS_PARALLEL: true
67-
run: |
68-
pip install tomli coveralls
69-
coveralls --service=github
62+
- uses: codecov/codecov-action@v4
63+
with:
64+
token: ${{ secrets.CODECOV_TOKEN }}
65+
name: python=${{ matrix.python-version }}-pydantic=${{matrix.pydantic-version}}
66+
files: coverage.xml
67+
68+
typos:
69+
name: Check for typos
70+
runs-on: ubuntu-latest
71+
steps:
72+
- name: Checkout Actions Repository
73+
uses: actions/checkout@v4
74+
- name: Spell Check Repo
75+
uses: crate-ci/typos@v1.30.0
7076

7177
finish:
7278
needs:
7379
- test
80+
- typos
7481
runs-on: ubuntu-latest
7582
steps:
76-
- name: Coveralls Finished
77-
env:
78-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79-
run: |
80-
pip install tomli coveralls
81-
coveralls --service=github --finish
83+
- name: Join
84+
run: echo Done

Makefile

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
1-
.PHONY: install test lint format build publish
2-
3-
PACKAGE_VERSION = $(shell python -c 'import importlib.metadata; print(importlib.metadata.version("responsaas"))')
1+
.PHONY: install test lint format
42

53
install:
6-
poetry install
4+
uv sync
75

86
test:
9-
coverage run -m pytest src tests
10-
coverage combine
11-
coverage report
12-
coverage xml
7+
uv run coverage run -m pytest src tests
8+
uv run coverage combine
9+
uv run coverage report
10+
uv run coverage xml
1311

1412
lint:
15-
ruff check src tests || exit 1
16-
mypy src tests || exit 1
17-
ruff format --check --diff src tests || exit 1
13+
uv run ruff check src tests || exit 1
14+
uv run mypy src tests || exit 1
15+
uv run ruff format --check --diff src tests || exit 1
1816

1917
format:
20-
ruff check --fix src tests
21-
ruff format src tests
22-
23-
readme-image:
24-
FORCE_COLOR=true python readme.py --help | ansitoimg --title '' docs/source/_static/example.svg
25-
18+
uv run ruff check --fix src tests
19+
uv run ruff format src tests

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ example: Example = load_settings(Example, nested_delimiter='_')
6464
### Clarity
6565

6666
- `pydantic-settings` makes it really, really difficult to intuit what the
67-
concrete environment varibale that's going to be loaded for a given field is
67+
concrete environment variable that's going to be loaded for a given field is
6868
**actually** going to be. Based on my own experience, and from perusing their
6969
issue tracker, it seems like this is not an uncommon experience.
7070

@@ -127,7 +127,7 @@ example: Example = load_settings(Example, nested_delimiter='_')
127127

128128
Practically, `pydantic` has the most robust system for parsing/validating a
129129
json-like structure into the models, so it's probably to be the most flexible
130-
anyways. But for many simple cases, particuarly those without nesting, or that
130+
anyways. But for many simple cases, particularly those without nesting, or that
131131
only deal in simple types (like int, float, str, etc); then dataclasses/attrs
132132
can certainly provide a similar experience.
133133

docs/pyproject.toml

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
1-
[tool.poetry]
1+
[project]
22
name = "docs"
33
version = "0.1.0"
44
description = ""
5-
authors = ["Dan Cardin <ddcardin@gmail.com>"]
5+
authors = [{ name = "Dan Cardin", email = "ddcardin@gmail.com" }]
66

7-
[tool.poetry.dependencies]
8-
python = "^3.10"
7+
requires-python = ">=3.10"
98

10-
astroid = "^3"
9+
dependencies = [
10+
"astroid >= 3",
11+
"furo >= 2024.04.27",
12+
"linkify-it-py",
13+
"myst-parser[linkify] >= 4.0.1",
14+
"sphinx >= 7.4.0",
15+
"sphinx-autoapi >= 3.6.0",
16+
"sphinx-autobuild >= 2021.3.14",
17+
"sphinx-autodoc-typehints >= 1.18.1",
18+
"sphinx-copybutton",
19+
"sphinx-pyproject >= 0.3.0",
20+
]
1121

12-
furo = "^2024.04.27"
13-
linkify-it-py = "*"
14-
myst-parser = {version = "^4.0.1", extras = ["linkify"]}
15-
sphinx = "^7.4.0"
16-
sphinx-autoapi = "^3.6.0"
17-
sphinx-autobuild = "^2021.3.14"
18-
sphinx-autodoc-typehints = "^1.18.1"
19-
sphinx-copybutton = "*"
20-
sphinx-pyproject = ">=0.3.0"
21-
22-
[tool.poetry.dev-dependencies]
23-
sphinx-autobuild = "*"
22+
[tool.uv]
23+
dev-dependencies = [
24+
"sphinx-autobuild",
25+
]
2426

2527
[build-system]
26-
requires = ["poetry-core>=1.0.0"]
27-
build-backend = "poetry.core.masonry.api"
28+
requires = ["hatchling"]
29+
build-backend = "hatchling.build"

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from sphinx_pyproject import SphinxConfig
22

3-
config = SphinxConfig("../../pyproject.toml", style="poetry")
3+
config = SphinxConfig("../../pyproject.toml")
44

55
project = "Dataclass Settings"
66
copyright = "2023, Dan Cardin"

0 commit comments

Comments
 (0)