Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,25 @@ jobs:
with:
python-version: "3.12"

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

- name: Build package
- name: Install python dependencies
run: |
# Generate the version string which appears in the docs.
python -m build --sdist
# uv sync install the project into the venv
# NOTE: we do not specify -p here, so
# we rely on python-version above
uv sync --frozen --group docs

# uv sync will handle this
# - name: Build package
# run: |
# # Generate the version string which appears in the docs.
# python -m build --sdist

- name: Build Docs
run: |
Expand Down
17 changes: 10 additions & 7 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@ jobs:
with:
python-version: "3.12"

- name: Install dependencies
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v7
with:
activate-environment: true
version: "latest"
python-version: ${{ matrix.python }}

- name: Install python dependencies
run: |
pip install -r requirements_minimal_CI.txt
pip install -r requirements_lint_CI.txt
# Mypy also checks types in the tests/ folder
pip install -r requirements_tests_CI.txt
pip install build
python -m build .
# uv sync install the project into the venv
uv sync --frozen --group lint

- name: black
run: black --check .
Expand Down
20 changes: 11 additions & 9 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,19 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

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

# Check that demes installs as expected.
# Also check the "demes" CLI entry point.
- name: install demes
- name: Install python dependencies
run: |
pip install .
demes -h
# uv sync install the project into the venv
# and the -p installs the correct Python
# version if it is not the version in $PATH
uv sync -p ${{ matrix.python-version }} --frozen --group test

- name: run pytest
run: |
Expand Down
22 changes: 13 additions & 9 deletions .github/workflows/wheel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
tags:
- '*'
pull_request:
branches: [ main ]
release:
types: [published]

Expand All @@ -16,16 +18,18 @@ jobs:
with:
python-version: "3.12"

- name: install dependencies
run: |
pip install -r requirements_minimal_CI.txt
pip install build
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v7
with:
activate-environment: true
version: "latest"
python-version: ${{ matrix.python }}

- name: build wheel
run: python -m build
run: uv build

- name: upload wheel
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v5
with:
name: wheel-and-sdist
path: dist/
Expand All @@ -40,11 +44,11 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.7, 3.8, 3.9, "3.10"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]

steps:
- name: download wheel
uses: actions/download-artifact@v4
uses: actions/download-artifact@v6.0.0
with:
name: wheel-and-sdist
path: dist/
Expand All @@ -71,7 +75,7 @@ jobs:
needs: ['wheel_test']
steps:
- name: download wheel
uses: actions/download-artifact@v4
uses: actions/download-artifact@v6.0.0
with:
name: wheel-and-sdist
path: dist/
Expand Down
88 changes: 88 additions & 0 deletions _setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
[metadata]
name = demes
author = PopSim Consortium
license = ISC
# description = tools for describing demographic models"
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/popsim-consortium/demes-python
classifiers =
Development Status :: 4 - Beta
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reckon we're out of beta now.

License :: OSI Approved :: ISC License (ISCL)
Operating System :: OS Independent
Intended Audience :: Science/Research
Programming Language :: Python :: 3
Topic :: Scientific/Engineering
Topic :: Scientific/Engineering :: Bio-Informatics
project_urls =
Documentation = https://popsim-consortium.github.io/demes-docs/
Source Code = https://github.com/popsim-consortium/demes-python/
Bug Tracker = https://github.com/popsim-consortium/demes-python/issues

[options]
packages = demes
zip_safe = False # https://mypy.readthedocs.io/en/latest/installed_packages.html
include_package_data = True
python_requires = >=3.7
install_requires =
attrs >= 20.3.0 # for attr.asdict(value_serializer=...)
ruamel.yaml >= 0.15.78 # attempts to install earlier versions failed
setup_requires =
setuptools
setuptools_scm

[options.entry_points]
console_scripts =
demes = demes.__main__:cli

[flake8]
extend-exclude = docs/_build
# black-compatible settings
max-line-length = 88
extend-ignore = E203, W503
# There's no way to ignore specific warnings in the files themselves.
# "flake8: noqa: F401" on its own line will just ignore all warnings.
per-file-ignores =
tests/test_import_visibility.py:F403,F405

[mypy]
files = demes, tests
warn_unused_ignores = True
show_error_codes = True
# We support python 3.7, so should really be using 3.7 here,
# but we're forced to set this higher because of positional-only
# type annotations in numpy (which are only supported in >=3.8).
python_version = 3.8

[mypy-numpy.*]
ignore_missing_imports = True

[mypy-ruamel.*]
ignore_missing_imports = True

[tool.black]
target_version = py37

[tool:pytest]
addopts = -n auto
testpaths = tests

[pylint.messages_control]
disable =
chained-comparison,
fixme,
invalid-name,
missing-docstring,
missing-module-docstring,
superfluous-parens,
protected-access,
too-few-public-methods,
too-many-arguments,
too-many-branches,
too-many-instance-attributes,
too-many-lines,
too-many-locals,
too-many-nested-blocks,
too-many-statements,
unspecified-encoding,
unused-argument,
File renamed without changes.
4 changes: 1 addition & 3 deletions demes/demes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1349,9 +1349,7 @@ class Graph:
)
metadata: collections.abc.Mapping = attr.ib(
factory=dict,
validator=attr.validators.instance_of(
collections.abc.Mapping # type: ignore[type-abstract]
),
validator=attr.validators.instance_of(collections.abc.Mapping),
)
demes: List[Deme] = attr.ib(factory=list, init=False)
migrations: List[AsymmetricMigration] = attr.ib(factory=list, init=False)
Expand Down
84 changes: 84 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,87 @@
[build-system]
# We need setup.cfg support, which setuptools introduced in 30.3.0.
requires = ["setuptools>=30.3.0", "wheel", "setuptools_scm"]

[project]
name = "demes"
authors = [
{name = "PopSim Consortium", email = "krthornt@uci.edu"}
]
description = "tools for describing demographic models"
readme = {file = "README.md", content-type = "text/markdown"}
license = {text = "ISC"}
classifiers = [
"Development Status :: 4 - Beta",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer in beta.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our version number is still < 1??

"License :: OSI Approved :: ISC License (ISCL)",
"Operating System :: OS Independent",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Bio-Informatics"
]

requires-python = ">=3.10"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't match the _setup.cfg file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct -- the _setup file is to rename it so that it doesn't confuse uv / conflict with pyproject.

More generally, our pinning to 3.7 was wrong due to other pinned dependencies that this PR revealed. (Briefly, our pinnings related to docs required >= 3.10).


dynamic = ["version"]

dependencies = [
"attrs>=20.3.0",
"ruamel.yaml>=0.15.78"
]

[project.urls]
Repository = "https://github.com/popsim-consortium/demes-python"
Documentation = "https://popsim-consortium.github.io/demes-docs/"
Issues = "https://github.com/popsim-consortium/demes-python/issues"

[project.scripts]
demes = "demes.__main__:cli"

[dependency-groups]
test = [
"numpy",
"pytest==8.3.3",
"pytest-cov",
"pytest-xdist"
]

lint = [
"black==24.10.0",
"flake8==7.1.1",
"mypy==1.13.0",
{include-group = "test"},
]

docs = [
"demesdraw",
"jupyter-book==0.15.1",
"piccolo_theme",
"sphinx_issues",
"sphinxcontrib-programoutput",
# Below here are hacks to make the docs
# build until we can deal w/updating
# jupyter-book
"ipython==8.29.0"
]

[tool.setuptools_scm]
write_to = "demes/_version.py"

# [tool.flake8]
# extend-exclude = docs/_build
# # black-compatible settings
# max-line-length = 88
# extend-ignore = E203, W503
# # There's no way to ignore specific warnings in the files themselves.
# # "flake8: noqa: F401" on its own line will just ignore all warnings.
# per-file-ignores =
# tests/test_import_visibility.py:F403,F405

# [tool.mypy]
# files = ["demes", "tests"]
# warn_unused_ignores = true
# show_error_codes = true
# # We support python 3.7, so should really be using 3.7 here,
# # but we're forced to set this higher because of positional-only
# # type annotations in numpy (which are only supported in >=3.8).
# python_version = 3.8
Loading
Loading