Skip to content

Commit e255303

Browse files
committed
wip
1 parent 89db027 commit e255303

File tree

12 files changed

+3799
-4872
lines changed

12 files changed

+3799
-4872
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ on:
55
tags:
66
- 'v*'
77

8-
env:
9-
POETRY_VERSION: 2.2.1
10-
118
jobs:
129
release:
1310
runs-on: ubuntu-latest
@@ -16,19 +13,14 @@ jobs:
1613
steps:
1714
- uses: actions/checkout@v6
1815

19-
- name: Set up Python 3.11
20-
uses: actions/setup-python@v6
16+
- name: Set up Python 3.14 with uv
17+
uses: astral-sh/setup-uv@v7
2118
with:
22-
python-version: 3.11
23-
24-
- name: Install system deps
25-
shell: bash
26-
run: |
27-
pip install poetry==$POETRY_VERSION poetry-plugin-export
19+
python-version: '3.14'
2820

2921
- name: Build package
3022
run: |
31-
poetry build --ansi
23+
uv build --ansi
3224
3325
- name: Publish package on PyPI
3426
uses: pypa/gh-action-pypi-publish@v1.13.0

.github/workflows/tests.yml

Lines changed: 13 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,20 @@ on:
1414
pull_request:
1515
branches:
1616

17-
env:
18-
POETRY_VERSION: 2.2.1
19-
POLARS_SKIP_CPU_CHECK: true
20-
2117
jobs:
2218
linting:
2319
name: Linting
2420
runs-on: ubuntu-latest
2521
steps:
2622
- uses: actions/checkout@v6
2723

28-
- name: Set up Python 3.11
29-
uses: actions/setup-python@v6
24+
- name: Set up Python 3.11 with uv
25+
uses: astral-sh/setup-uv@v7
3026
with:
31-
python-version: 3.11
27+
python-version: '3.11'
3228

3329
- name: Linting
34-
run: |
35-
pip install poetry==$POETRY_VERSION poetry-plugin-export
36-
poetry install --only=main,devops
37-
poetry run inv lint
30+
run: uv run inv lint
3831

3932
tests:
4033
needs: linting
@@ -44,30 +37,24 @@ jobs:
4437
strategy:
4538
fail-fast: true
4639
matrix:
47-
os: [ Ubuntu, MacOS, Windows ]
40+
os: [ 'Ubuntu', 'MacOS', 'Windows' ]
4841
python-version: [ '3.11', '3.12', '3.13', '3.14' ]
4942
experimental: [ false ]
5043
steps:
5144
- uses: actions/checkout@v6
5245

53-
- name: Set up Python ${{ matrix.python-version }}
54-
uses: actions/setup-python@v6
46+
- name: Set up Python ${{ matrix.python-version }} with uv
47+
uses: astral-sh/setup-uv@v7
5548
with:
5649
python-version: ${{ matrix.python-version }}
5750

58-
- name: Install system deps
59-
shell: bash
60-
run: |
61-
pip install nox
62-
pip install poetry==$POETRY_VERSION poetry-plugin-export
63-
6451
- name: Run mypy with nox
6552
shell: bash
66-
run: nox --force-color -s mypy-${{ matrix.python-version }}
53+
run: uv run nox --force-color -s mypy-${{ matrix.python-version }}
6754

6855
- name: Run tests with nox
6956
shell: bash
70-
run: nox --force-color -s tests-${{ matrix.python-version }}
57+
run: uv run nox --force-color -s tests-${{ matrix.python-version }}
7158

7259
- name: Run safety check
7360
if: matrix.python-version == '3.11' && matrix.os == 'Ubuntu'
@@ -88,16 +75,10 @@ jobs:
8875
steps:
8976
- uses: actions/checkout@v6
9077

91-
- name: Set up Python 3.11
92-
uses: actions/setup-python@v6
78+
- name: Set up Python 3.14 with uv
79+
uses: astral-sh/setup-uv@v7
9380
with:
94-
python-version: 3.11
95-
96-
- name: Install system deps
97-
shell: bash
98-
run: |
99-
pip install nox
100-
pip install poetry==$POETRY_VERSION poetry-plugin-export
81+
python-version: '3.14'
10182

10283
- name: Download coverage data
10384
uses: actions/download-artifact@v8
@@ -107,8 +88,7 @@ jobs:
10788

10889
- name: Create coverage report
10990
shell: bash
110-
run: |
111-
nox --force-color --session=coverage -- --fmt xml
91+
run: uv run nox --force-color --session=coverage -- --fmt xml
11292

11393
- name: Upload coverage report
11494
uses: codecov/codecov-action@v5.5.2

.readthedocs.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,16 @@ build:
1010
post_create_environment:
1111
# Installing doesn't work; the wrong target is used even with 'virtualenvs.create false'. There is a GitHub issue
1212
# which may be a better solution in the future: https://github.com/python-poetry/poetry/issues/1937
13-
- curl -sSL https://install.python-poetry.org | POETRY_VERSION=2.2.1 python -
14-
- $HOME/.local/bin/poetry self add poetry-plugin-export
15-
- $HOME/.local/bin/poetry export --only=docs,manual-extras --without-hashes --output=requirements-from-poetry.txt
16-
- cat requirements-from-poetry.txt
13+
- curl -LsSf https://astral.sh/uv/install.sh | UV_VERSION=0.9.26 sh
14+
- $HOME/.local/bin/uv export --only=docs,manual-extras --no-hashes --output=requirements-from-poetry.txt
15+
- cat requirements.txt
1716

1817
# pre_build:
1918
# - python -m sphinx -b linkcheck docs/ _build/linkcheck # Fails for valid GitHub links?
2019

2120
python:
2221
install:
23-
- requirements: requirements-from-poetry.txt
22+
- requirements: requirements.txt
2423
- method: pip
2524
path: .
2625
extra_requirements:

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ which demonstrates the (desired) usage.
1414
## Getting started
1515
Follow these steps to begin local development.
1616

17-
1. **Installing [Poetry](https://python-poetry.org/docs/)**
17+
1. **Installing [uv](https://docs.astral.sh/uv/getting-started/installation/)**
1818

19-
See [poetry.lock](https://github.com/rsundqvist/rics/blob/master/poetry.lock) for the version used.
19+
See [uv.lock](https://github.com/rsundqvist/rics/blob/master/uv.lock) for the version used.
2020
```bash
21-
curl -sSL https://install.python-poetry.org/ | python -
21+
curl -LsSf https://astral.sh/uv/install.sh | sh
2222
```
2323

2424
2. **Installing the project**
@@ -28,7 +28,7 @@ Follow these steps to begin local development.
2828
```bash
2929
git clone --recurse-submodules git@github.com:rsundqvist/rics.git
3030
cd rics
31-
poetry install --all-extras
31+
uv install --all-extras
3232
```
3333

3434
Generating documentation has a few dependencies which may need to be installed

docs/documentation/cookbook/uv.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# uv
2+
3+
## MyPy `--install-types` without `pip`
4+
The `--install-types` flag requires `pip`. To add manually without version constraints:
5+
6+
```bash
7+
cat .mypy_cache/missing_stubs # show what will be added
8+
uv add -r .mypy_cache/missing_stubs --group=types --raw-sources
9+
```
10+
11+
Where `--raw-sources` avoids locking specific versions. This is a hack. No official solution exists yet;
12+
see https://github.com/python/mypy/issues/10600.

mypy.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
[mypy]
2-
install_types = true
3-
non_interactive = true
42
show_error_codes = true
53
warn_unused_configs = true
64
warn_unused_ignores = true

noxfile.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,13 @@
77
import nox
88
from nox.sessions import Session
99

10+
nox.options.default_venv_backend = "uv"
1011
nox.options.sessions = ["tests", "mypy"]
1112
python_versions = ["3.11", "3.12", "3.13", "3.14"]
1213

1314

1415
def install_with_constraints(session: Session, *args: str, **kwargs: Any) -> None:
15-
"""Install packages constrained by Poetry's lock file.
16-
17-
This function is a wrapper for nox.sessions.Session.install. It
18-
invokes pip to install packages inside of the session's virtualenv.
19-
Additionally, pip is passed a constraints file generated from
20-
Poetry's lock file, to ensure that the packages are pinned to the
21-
versions specified in poetry.lock. This allows you to manage the
22-
packages as Poetry development dependencies.
16+
"""Install packages constrained by `uv.lock`.
2317
2418
Args:
2519
session: The Session object.
@@ -29,18 +23,18 @@ def install_with_constraints(session: Session, *args: str, **kwargs: Any) -> Non
2923
"""
3024
with tempfile.NamedTemporaryFile(delete=False) as requirements:
3125
session.run(
32-
"poetry",
26+
"uv",
3327
"export",
34-
"--without-hashes",
35-
f"--output={requirements.name}",
28+
"--no-hashes",
29+
f"--output-file={requirements.name}",
3630
external=True,
3731
)
3832
session.install("-r", requirements.name, *args, **kwargs)
3933

4034

4135
def install_with_project_extras(session: Session) -> None:
42-
"""Install the project using poetry."""
43-
session.run_always("poetry", "install", "--no-interaction", "--all-extras", external=True)
36+
"""Install the project using uv."""
37+
session.run_always("uv", "sync", "--active", "--all-extras", external=True)
4438
session.install(".")
4539

4640

0 commit comments

Comments
 (0)