Skip to content

Commit e9a6a59

Browse files
committed
Update project configuration
* move dependency management to uv * move (most) config info to pyproject.toml * bump minimum supported Python version * bump development status metadata * update github workflows * remove requirements files
1 parent 4bc3f95 commit e9a6a59

22 files changed

+3194
-526
lines changed

.github/workflows/dev.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,7 @@ jobs:
2929

3030
- name: install developer dependencies
3131
run: |
32+
# NOTE: production use of this command
33+
# would be python -m pip ...
3234
pip install --upgrade pip
33-
pip install -r requirements.txt
35+
pip install -e . --group test --group lint --group docs

.github/workflows/docs.yaml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,25 @@ jobs:
2222
with:
2323
python-version: "3.12"
2424

25-
- name: Install dependencies
26-
run: |
27-
pip install --upgrade pip
28-
pip install -r requirements_minimal_CI.txt
29-
pip install -r requirements_docs_CI.txt
30-
python -m pip install build packaging
25+
- name: Install the latest version of uv
26+
uses: astral-sh/setup-uv@v7
27+
with:
28+
activate-environment: true
29+
version: "latest"
30+
python-version: ${{ matrix.python }}
3131

32-
- name: Build package
32+
- name: Install python dependencies
3333
run: |
34-
# Generate the version string which appears in the docs.
35-
python -m build --sdist
34+
# uv sync install the project into the venv
35+
# NOTE: we do not specify -p here, so
36+
# we rely on python-version above
37+
uv sync --frozen --group docs
38+
39+
# uv sync will handle this
40+
# - name: Build package
41+
# run: |
42+
# # Generate the version string which appears in the docs.
43+
# python -m build --sdist
3644

3745
- name: Build Docs
3846
run: |

.github/workflows/lint.yaml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,17 @@ jobs:
1515
with:
1616
python-version: "3.12"
1717

18-
- name: Install dependencies
18+
- name: Install the latest version of uv
19+
uses: astral-sh/setup-uv@v7
20+
with:
21+
activate-environment: true
22+
version: "latest"
23+
python-version: ${{ matrix.python }}
24+
25+
- name: Install python dependencies
1926
run: |
20-
pip install -r requirements_minimal_CI.txt
21-
pip install -r requirements_lint_CI.txt
22-
# Mypy also checks types in the tests/ folder
23-
pip install -r requirements_tests_CI.txt
24-
pip install build
25-
python -m build .
27+
# uv sync install the project into the venv
28+
uv sync --frozen --group lint
2629
2730
- name: black
2831
run: black --check .

.github/workflows/tests.yaml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,23 @@ jobs:
4141
with:
4242
python-version: ${{ matrix.python-version }}
4343

44-
- name: install dependencies
45-
run: |
46-
pip install -r requirements_minimal_CI.txt
47-
pip install -r requirements_tests_CI.txt
44+
- name: Install the latest version of uv
45+
uses: astral-sh/setup-uv@v7
46+
with:
47+
activate-environment: true
48+
version: "latest"
49+
python-version: ${{ matrix.python }}
4850

49-
# Check that demes installs as expected.
50-
# Also check the "demes" CLI entry point.
51-
- name: install demes
51+
- name: Install python dependencies
5252
run: |
53-
pip install .
54-
demes -h
53+
# uv sync install the project into the venv
54+
# and the -p installs the correct Python
55+
# version if it is not the version in $PATH
56+
uv sync -p ${{ matrix.python-version }} --frozen --group test
5557
5658
- name: run pytest
5759
run: |
58-
python -m pytest -n auto \
60+
uv run -m pytest -n auto \
5961
--cov=demes --cov-report=term-missing --cov-report=xml -v tests
6062
6163
- name: upload coverage report to codecov

.github/workflows/wheel.yaml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
tags:
66
- '*'
7+
pull_request:
8+
branches: [ main ]
79
release:
810
types: [published]
911

@@ -16,16 +18,18 @@ jobs:
1618
with:
1719
python-version: "3.12"
1820

19-
- name: install dependencies
20-
run: |
21-
pip install -r requirements_minimal_CI.txt
22-
pip install build
21+
- name: Install the latest version of uv
22+
uses: astral-sh/setup-uv@v7
23+
with:
24+
activate-environment: true
25+
version: "latest"
26+
python-version: ${{ matrix.python }}
2327

2428
- name: build wheel
25-
run: python -m build
29+
run: uv build
2630

2731
- name: upload wheel
28-
uses: actions/upload-artifact@v3
32+
uses: actions/upload-artifact@v5
2933
with:
3034
name: wheel-and-sdist
3135
path: dist/
@@ -40,11 +44,11 @@ jobs:
4044
fail-fast: false
4145
matrix:
4246
os: [ubuntu-latest, windows-latest, macos-latest]
43-
python-version: [3.7, 3.8, 3.9, "3.10"]
47+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
4448

4549
steps:
4650
- name: download wheel
47-
uses: actions/download-artifact@v4
51+
uses: actions/download-artifact@v6.0.0
4852
with:
4953
name: wheel-and-sdist
5054
path: dist/
@@ -71,7 +75,7 @@ jobs:
7175
needs: ['wheel_test']
7276
steps:
7377
- name: download wheel
74-
uses: actions/download-artifact@v4
78+
uses: actions/download-artifact@v6.0.0
7579
with:
7680
name: wheel-and-sdist
7781
path: dist/

demes/demes.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,9 +1349,7 @@ class Graph:
13491349
)
13501350
metadata: collections.abc.Mapping = attr.ib(
13511351
factory=dict,
1352-
validator=attr.validators.instance_of(
1353-
collections.abc.Mapping # type: ignore[type-abstract]
1354-
),
1352+
validator=attr.validators.instance_of(collections.abc.Mapping),
13551353
)
13561354
demes: List[Deme] = attr.ib(factory=list, init=False)
13571355
migrations: List[AsymmetricMigration] = attr.ib(factory=list, init=False)

pyproject.toml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,76 @@
11
[build-system]
22
# We need setup.cfg support, which setuptools introduced in 30.3.0.
33
requires = ["setuptools>=30.3.0", "wheel", "setuptools_scm"]
4+
5+
[project]
6+
name = "demes"
7+
authors = [
8+
{name = "PopSim Consortium", email = "krthornt@uci.edu"}
9+
]
10+
description = "tools for describing demographic models"
11+
readme = {file = "README.md", content-type = "text/markdown"}
12+
license = {text = "ISC"}
13+
classifiers = [
14+
"Development Status :: 5 - Stable",
15+
"License :: OSI Approved :: ISC License (ISCL)",
16+
"Operating System :: OS Independent",
17+
"Intended Audience :: Science/Research",
18+
"Programming Language :: Python :: 3",
19+
"Topic :: Scientific/Engineering",
20+
"Topic :: Scientific/Engineering :: Bio-Informatics"
21+
]
22+
23+
requires-python = ">=3.10"
24+
25+
dynamic = ["version"]
26+
27+
dependencies = [
28+
"attrs>=20.3.0",
29+
"ruamel.yaml>=0.15.78"
30+
]
31+
32+
[project.urls]
33+
Repository = "https://github.com/popsim-consortium/demes-python"
34+
Documentation = "https://popsim-consortium.github.io/demes-docs/"
35+
Issues = "https://github.com/popsim-consortium/demes-python/issues"
36+
37+
[project.scripts]
38+
demes = "demes.__main__:cli"
39+
40+
[dependency-groups]
41+
test = [
42+
"numpy",
43+
"pytest==8.3.3",
44+
"pytest-cov",
45+
"pytest-xdist"
46+
]
47+
48+
lint = [
49+
"black==24.10.0",
50+
"flake8==7.1.1",
51+
"mypy==1.13.0",
52+
{include-group = "test"},
53+
]
54+
55+
docs = [
56+
"demesdraw",
57+
"jupyter-book==0.15.1",
58+
"piccolo_theme",
59+
"sphinx_issues",
60+
"sphinxcontrib-programoutput",
61+
# Below here are hacks to make the docs
62+
# build until we can deal w/updating
63+
# jupyter-book
64+
"ipython==8.29.0"
65+
]
66+
67+
[tool.setuptools_scm]
68+
write_to = "demes/_version.py"
69+
70+
# NOTE to future developers
71+
# mypy can be configured here, and perhaps
72+
# "should" be.
73+
# For now, we've left its config in setup.cfg
74+
#
75+
# flake8 cannot be configured here unless we
76+
# introduce a dependency on flake8-pyproject.

requirements.txt

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

requirements/docs.txt

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

0 commit comments

Comments
 (0)