Skip to content

Commit df95da8

Browse files
Adopt uv for managing project
1 parent 8d2f7a8 commit df95da8

File tree

9 files changed

+237
-29
lines changed

9 files changed

+237
-29
lines changed

.github/workflows/deploy.yaml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,16 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v4
12+
- name: Install uv
13+
uses: astral-sh/setup-uv@v5
1214
- name: Set up Python
1315
uses: actions/setup-python@v5
1416
with:
15-
python-version-file: "pyproject.toml"
16-
- name: Install dependencies
17-
run: |
18-
pip install pip -U
19-
pip install build
17+
python-version-file: ".python-version"
2018
- name: Build package
21-
run: python -m build
19+
run: uv build
20+
- uses: actions/checkout@v4
2221
- name: Publish package
23-
uses: pypa/gh-action-pypi-publish@release/v1
24-
with:
25-
user: __token__
26-
password: ${{ secrets.PYPI_API_TOKEN }}
22+
run: uv publish
23+
env:
24+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/test.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,22 @@ jobs:
1818
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
1919
steps:
2020
- uses: actions/checkout@v4
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@v5
2123
- name: Set up Python
2224
uses: actions/setup-python@v5
2325
with:
2426
python-version: ${{ matrix.python-version }}
25-
- name: Install dependencies
26-
run: |
27-
pip install pip -U
28-
pip install .
29-
- name: Install test dependencies
30-
run: pip install --group test
27+
- name: Install project
28+
run: uv sync --locked
29+
- name: Check lockfile
30+
run: uv lock --check
3131
- name: Check code style
3232
run: |
3333
ruff check --output-format=github
3434
ruff format --check
3535
- name: Execute tests
36-
run: coverage run --source portion -m pytest
36+
run: uv run coverage run --source portion -m pytest
3737
- name: Upload coverage to Coveralls
3838
uses: coverallsapp/github-action@v2
3939
env:

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
.*
33
*.pyc
44
*.egg-info*
5-
!.github
5+
!.github
6+
!.python-version

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.13

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@
44

55
### Added
66
- A `__version__` attribute relying on `importlib.metadata`.
7+
- A `uv.lock` lock-file.
78

89
### Changed
910
- Drop official support for Python 3.8.
1011
- Switch from `black` to `ruff` for code style.
1112
- Fully migrate to a `pyproject.toml`-based project.
1213
- Ensure code style consistency (see selected rules in `pyproject.toml`).
13-
- Extra dependencies are part of a dependency group (PEP 735).
14+
- Extra dependencies are part of the `dev` dependency group (PEP 735).
15+
- Switch from `setuptools` to `hatchling` for building `portion`.
16+
1417

1518

1619
## 2.6.0 (2024-10-17)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ The `portion` library provides data structure and operations for intervals in Py
4545
You can use `pip` to install it, as usual: `pip install portion`. This will install the latest available version from [PyPI](https://pypi.org/project/portion).
4646
Pre-releases are available from the *master* branch on [GitHub](https://github.com/AlexandreDecan/portion) and can be installed with `pip install git+https://github.com/AlexandreDecan/portion`.
4747

48-
You can install `portion` and its development environment using `pip install --group test` at the root of this repository. This automatically installs [pytest](https://docs.pytest.org/en/latest/) (for the test suites) and [ruff](https://docs.astral.sh/ruff/) (for code style).
48+
You can install `portion` and its development environment using `pip install --group dev` at the root of this repository. This automatically installs [pytest](https://docs.pytest.org/en/latest/) (for the test suites) and [ruff](https://docs.astral.sh/ruff/) (for code style).
4949

5050

5151
## Documentation & usage

pyproject.toml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[build-system]
2-
requires = ["setuptools >= 61.0"]
3-
build-backend = "setuptools.build_meta"
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
44

55
[project]
66
name = "portion"
@@ -31,7 +31,7 @@ classifiers = [
3131
]
3232

3333
[dependency-groups]
34-
test = ["pytest ~= 7.0", "coverage ~= 6.0", "ruff >= 0.6.9"]
34+
dev = ["pytest ~= 7.0", "coverage ~= 6.0", "ruff >= 0.6.9"]
3535

3636
[tool.ruff]
3737
extend-exclude = ["tests/"]
@@ -51,6 +51,3 @@ select = [
5151
"Q", # flake8-quotes
5252
]
5353
ignore = ["B028"]
54-
55-
[tool.setuptools]
56-
packages = ["portion"]

setup.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

uv.lock

Lines changed: 211 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)