diff --git a/.github/mergify.yml b/.github/mergify.yml index 8470779..99656ae 100644 --- a/.github/mergify.yml +++ b/.github/mergify.yml @@ -4,15 +4,12 @@ queue_rules: - base=main - check-success=build-deploy-docs - check-success=lint - - check-success=dev-deps (macos-11, 3.11) - - check-success=dev-deps (ubuntu-20.04, 3.11) - - check-success=dev-deps (windows-2022, 3.11) - - check-success=tests (macos-11, 3.7) - - check-success=tests (macos-11, 3.11) - - check-success=tests (ubuntu-20.04, 3.7) - - check-success=tests (ubuntu-20.04, 3.11) - - check-success=tests (windows-2022, 3.7) - - check-success=tests (windows-2022, 3.11) + - check-success=dev-deps (macos-14, 3.12) + - check-success=dev-deps (ubuntu-24.04, 3.12) + - check-success=dev-deps (windows-2022, 3.12) + - check-success=tests (macos-14, 3.12) + - check-success=tests (ubuntu-24.04, 3.12) + - check-success=tests (windows-2022, 3.12) pull_request_rules: - name: automatic merge for Dependabot pull requests @@ -22,15 +19,12 @@ pull_request_rules: - label=dependencies - check-success=build-deploy-docs - check-success=lint - - check-success=dev-deps (macos-11, 3.11) - - check-success=dev-deps (ubuntu-20.04, 3.11) - - check-success=dev-deps (windows-2022, 3.11) - - check-success=tests (macos-11, 3.7) - - check-success=tests (macos-11, 3.11) - - check-success=tests (ubuntu-20.04, 3.7) - - check-success=tests (ubuntu-20.04, 3.11) - - check-success=tests (windows-2022, 3.7) - - check-success=tests (windows-2022, 3.11) + - check-success=dev-deps (macos-14, 3.12) + - check-success=dev-deps (ubuntu-24.04, 3.12) + - check-success=dev-deps (windows-2022, 3.12) + - check-success=tests (macos-14, 3.12) + - check-success=tests (ubuntu-24.04, 3.12) + - check-success=tests (windows-2022, 3.12) actions: queue: name: default diff --git a/.github/workflows/dev.yaml b/.github/workflows/dev.yaml index 6aac4e0..52fd939 100644 --- a/.github/workflows/dev.yaml +++ b/.github/workflows/dev.yaml @@ -15,8 +15,8 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04, windows-2022, macos-14] - python-version: ["3.11"] + os: [ubuntu-24.04, windows-2022, macos-14] + python-version: ["3.12"] steps: - name: checkout diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 53a820e..c964fe3 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -9,7 +9,7 @@ on: jobs: build-deploy-docs: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v3 @@ -20,13 +20,13 @@ jobs: fetch-depth: 0 - uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.12" - name: Install dependencies run: | pip install --upgrade pip - pip install -r requirements/minimal.txt - pip install -r requirements/docs.txt + pip install -r requirements_minimal_CI.txt + pip install -r requirements_docs_CI.txt python -m pip install build packaging - name: Build package diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index eab511f..9f55ea6 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -13,15 +13,16 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.12" - name: Install dependencies run: | - pip install -r requirements/minimal.txt - pip install -r requirements/lint.txt + 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.txt - python setup.py build + pip install -r requirements_tests_CI.txt + pip install build + python -m build . - name: black run: black --check . diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index f87c6ab..56d7386 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -24,8 +24,8 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04, windows-2022, macos-14] - python-version: ["3.9", "3.11"] + os: [ubuntu-24.04, windows-2022, macos-14] + python-version: ["3.12"] env: OS: ${{ matrix.os }} PYTHON: ${{ matrix.python-version }} @@ -43,8 +43,8 @@ jobs: - name: install dependencies run: | - pip install -r requirements/minimal.txt - pip install -r requirements/tests.txt + pip install -r requirements_minimal_CI.txt + pip install -r requirements_tests_CI.txt # Check that demes installs as expected. # Also check the "demes" CLI entry point. diff --git a/.github/workflows/wheel.yaml b/.github/workflows/wheel.yaml index b872012..0513ff9 100644 --- a/.github/workflows/wheel.yaml +++ b/.github/workflows/wheel.yaml @@ -9,16 +9,16 @@ on: jobs: wheel_build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.12" - name: install dependencies run: | - pip install -r requirements/minimal.txt + pip install -r requirements_minimal_CI.txt pip install build - name: build wheel diff --git a/demes/load_dump.py b/demes/load_dump.py index 31ec356..6134f44 100644 --- a/demes/load_dump.py +++ b/demes/load_dump.py @@ -1,6 +1,7 @@ """ Functions to load and dump graphs in YAML and JSON formats. """ + from __future__ import annotations import contextlib import json diff --git a/requirements/docs.txt b/requirements/docs.txt index 52787e3..9027618 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -1,5 +1,5 @@ -demesdraw==0.4.0 +demesdraw jupyter-book==0.15.1 -piccolo_theme==0.19.0 -sphinx_issues==3.0.1 -sphinxcontrib-programoutput==0.17 +piccolo_theme +sphinx_issues +sphinxcontrib-programoutput diff --git a/requirements/lint.txt b/requirements/lint.txt index 015020f..355ed83 100644 --- a/requirements/lint.txt +++ b/requirements/lint.txt @@ -1,3 +1,3 @@ -black==23.11.0 -flake8==6.1.0 -mypy==1.9.0 +black +flake8 +mypy diff --git a/requirements/minimal.txt b/requirements/minimal.txt index aa4ed0e..cecab8b 100644 --- a/requirements/minimal.txt +++ b/requirements/minimal.txt @@ -1,2 +1,2 @@ -attrs==23.2.0 -ruamel.yaml==0.18.6 +attrs +ruamel.yaml diff --git a/requirements/tests.txt b/requirements/tests.txt index 08eeea0..895ac30 100644 --- a/requirements/tests.txt +++ b/requirements/tests.txt @@ -1,5 +1,4 @@ -numpy; python_version=='3.7' -numpy==1.26.3; python_version>='3.8' -pytest==7.4.3 -pytest-cov==4.1.0 -pytest-xdist==3.5.0 +numpy +pytest +pytest-cov +pytest-xdist diff --git a/requirements_docs_CI.txt b/requirements_docs_CI.txt new file mode 100644 index 0000000..109d1f5 --- /dev/null +++ b/requirements_docs_CI.txt @@ -0,0 +1,318 @@ +# This file was autogenerated by uv via the following command: +# uv pip compile -p 3.12 requirements/docs.txt +accessible-pygments==0.0.5 + # via pydata-sphinx-theme +alabaster==0.7.16 + # via sphinx +asttokens==2.4.1 + # via stack-data +attrs==24.2.0 + # via + # demes + # jsonschema + # jupyter-cache + # referencing +babel==2.16.0 + # via + # pydata-sphinx-theme + # sphinx +beautifulsoup4==4.12.3 + # via pydata-sphinx-theme +certifi==2024.8.30 + # via requests +charset-normalizer==3.4.0 + # via requests +click==8.1.7 + # via + # jupyter-book + # jupyter-cache + # sphinx-external-toc +comm==0.2.2 + # via ipykernel +contourpy==1.3.1 + # via matplotlib +cycler==0.12.1 + # via matplotlib +debugpy==1.8.9 + # via ipykernel +decorator==5.1.1 + # via ipython +demes==0.2.3 + # via demesdraw +demesdraw==0.4.0 + # via -r requirements/docs.txt +docutils==0.18.1 + # via + # jupyter-book + # myst-parser + # pybtex-docutils + # pydata-sphinx-theme + # sphinx + # sphinx-togglebutton + # sphinxcontrib-bibtex +executing==2.1.0 + # via stack-data +fastjsonschema==2.20.0 + # via nbformat +fonttools==4.55.0 + # via matplotlib +greenlet==3.1.1 + # via sqlalchemy +idna==3.10 + # via requests +imagesize==1.4.1 + # via sphinx +importlib-metadata==8.5.0 + # via + # jupyter-cache + # myst-nb +ipykernel==6.29.5 + # via myst-nb +ipython==8.29.0 + # via + # ipykernel + # myst-nb +jedi==0.19.2 + # via ipython +jinja2==3.1.4 + # via + # jupyter-book + # myst-parser + # sphinx +jsonschema==4.23.0 + # via + # jupyter-book + # nbformat +jsonschema-specifications==2024.10.1 + # via jsonschema +jupyter-book==0.15.1 + # via -r requirements/docs.txt +jupyter-cache==0.6.1 + # via myst-nb +jupyter-client==8.6.3 + # via + # ipykernel + # nbclient +jupyter-core==5.7.2 + # via + # ipykernel + # jupyter-client + # nbclient + # nbformat +kiwisolver==1.4.7 + # via matplotlib +latexcodec==3.0.0 + # via pybtex +linkify-it-py==2.0.3 + # via jupyter-book +markdown-it-py==2.2.0 + # via + # mdit-py-plugins + # myst-parser +markupsafe==3.0.2 + # via jinja2 +matplotlib==3.9.2 + # via demesdraw +matplotlib-inline==0.1.7 + # via + # ipykernel + # ipython +mdit-py-plugins==0.3.5 + # via myst-parser +mdurl==0.1.2 + # via markdown-it-py +myst-nb==0.17.2 + # via jupyter-book +myst-parser==0.18.1 + # via myst-nb +nbclient==0.7.4 + # via + # jupyter-cache + # myst-nb +nbformat==5.10.4 + # via + # jupyter-cache + # myst-nb + # nbclient +nest-asyncio==1.6.0 + # via ipykernel +numpy==2.1.3 + # via + # contourpy + # demesdraw + # matplotlib + # scipy +packaging==24.2 + # via + # ipykernel + # matplotlib + # pydata-sphinx-theme + # sphinx +parso==0.8.4 + # via jedi +pexpect==4.9.0 + # via ipython +piccolo-theme==0.24.0 + # via -r requirements/docs.txt +pillow==11.0.0 + # via matplotlib +platformdirs==4.3.6 + # via jupyter-core +prompt-toolkit==3.0.48 + # via ipython +psutil==6.1.0 + # via ipykernel +ptyprocess==0.7.0 + # via pexpect +pure-eval==0.2.3 + # via stack-data +pybtex==0.24.0 + # via + # pybtex-docutils + # sphinxcontrib-bibtex +pybtex-docutils==1.0.3 + # via sphinxcontrib-bibtex +pydata-sphinx-theme==0.15.4 + # via sphinx-book-theme +pygments==2.18.0 + # via + # accessible-pygments + # ipython + # pydata-sphinx-theme + # sphinx +pyparsing==3.2.0 + # via matplotlib +python-dateutil==2.9.0.post0 + # via + # jupyter-client + # matplotlib +pyyaml==6.0.2 + # via + # jupyter-book + # jupyter-cache + # myst-nb + # myst-parser + # pybtex + # sphinx-external-toc +pyzmq==26.2.0 + # via + # ipykernel + # jupyter-client +referencing==0.35.1 + # via + # jsonschema + # jsonschema-specifications +requests==2.32.3 + # via sphinx +rpds-py==0.21.0 + # via + # jsonschema + # referencing +ruamel-yaml==0.18.6 + # via demes +ruamel-yaml-clib==0.2.12 + # via ruamel-yaml +scipy==1.14.1 + # via demesdraw +setuptools==75.6.0 + # via sphinx-togglebutton +six==1.16.0 + # via + # asttokens + # pybtex + # python-dateutil +snowballstemmer==2.2.0 + # via sphinx +soupsieve==2.6 + # via beautifulsoup4 +sphinx==5.0.2 + # via + # jupyter-book + # myst-nb + # myst-parser + # piccolo-theme + # pydata-sphinx-theme + # sphinx-book-theme + # sphinx-comments + # sphinx-copybutton + # sphinx-design + # sphinx-external-toc + # sphinx-issues + # sphinx-jupyterbook-latex + # sphinx-multitoc-numbering + # sphinx-thebe + # sphinx-togglebutton + # sphinxcontrib-bibtex + # sphinxcontrib-programoutput +sphinx-book-theme==1.0.1 + # via jupyter-book +sphinx-comments==0.0.3 + # via jupyter-book +sphinx-copybutton==0.5.2 + # via jupyter-book +sphinx-design==0.3.0 + # via jupyter-book +sphinx-external-toc==0.3.1 + # via jupyter-book +sphinx-issues==5.0.0 + # via -r requirements/docs.txt +sphinx-jupyterbook-latex==0.5.2 + # via jupyter-book +sphinx-multitoc-numbering==0.1.3 + # via jupyter-book +sphinx-thebe==0.2.1 + # via jupyter-book +sphinx-togglebutton==0.3.2 + # via jupyter-book +sphinxcontrib-applehelp==2.0.0 + # via sphinx +sphinxcontrib-bibtex==2.5.0 + # via jupyter-book +sphinxcontrib-devhelp==2.0.0 + # via sphinx +sphinxcontrib-htmlhelp==2.1.0 + # via sphinx +sphinxcontrib-jsmath==1.0.1 + # via sphinx +sphinxcontrib-programoutput==0.17 + # via -r requirements/docs.txt +sphinxcontrib-qthelp==2.0.0 + # via sphinx +sphinxcontrib-serializinghtml==2.0.0 + # via sphinx +sqlalchemy==2.0.36 + # via jupyter-cache +stack-data==0.6.3 + # via ipython +tabulate==0.9.0 + # via jupyter-cache +tornado==6.4.2 + # via + # ipykernel + # jupyter-client +traitlets==5.14.3 + # via + # comm + # ipykernel + # ipython + # jupyter-client + # jupyter-core + # matplotlib-inline + # nbclient + # nbformat +typing-extensions==4.12.2 + # via + # myst-nb + # myst-parser + # pydata-sphinx-theme + # sqlalchemy +uc-micro-py==1.0.3 + # via linkify-it-py +urllib3==2.2.3 + # via requests +wcwidth==0.2.13 + # via prompt-toolkit +wheel==0.45.1 + # via sphinx-togglebutton +zipp==3.21.0 + # via importlib-metadata diff --git a/requirements_lint_CI.txt b/requirements_lint_CI.txt new file mode 100644 index 0000000..2bc65c4 --- /dev/null +++ b/requirements_lint_CI.txt @@ -0,0 +1,28 @@ +# This file was autogenerated by uv via the following command: +# uv pip compile -p 3.12 requirements/lint.txt +black==24.10.0 + # via -r requirements/lint.txt +click==8.1.7 + # via black +flake8==7.1.1 + # via -r requirements/lint.txt +mccabe==0.7.0 + # via flake8 +mypy==1.13.0 + # via -r requirements/lint.txt +mypy-extensions==1.0.0 + # via + # black + # mypy +packaging==24.2 + # via black +pathspec==0.12.1 + # via black +platformdirs==4.3.6 + # via black +pycodestyle==2.12.1 + # via flake8 +pyflakes==3.2.0 + # via flake8 +typing-extensions==4.12.2 + # via mypy diff --git a/requirements_minimal_CI.txt b/requirements_minimal_CI.txt new file mode 100644 index 0000000..5df4b90 --- /dev/null +++ b/requirements_minimal_CI.txt @@ -0,0 +1,8 @@ +# This file was autogenerated by uv via the following command: +# uv pip compile -p 3.12 requirements/minimal.txt +attrs==24.2.0 + # via -r requirements/minimal.txt +ruamel-yaml==0.18.6 + # via -r requirements/minimal.txt +ruamel-yaml-clib==0.2.12 + # via ruamel-yaml diff --git a/requirements_tests_CI.txt b/requirements_tests_CI.txt new file mode 100644 index 0000000..829f683 --- /dev/null +++ b/requirements_tests_CI.txt @@ -0,0 +1,23 @@ +# This file was autogenerated by uv via the following command: +# uv pip compile -p 3.12 requirements/tests.txt +coverage==7.6.8 + # via pytest-cov +execnet==2.1.1 + # via pytest-xdist +iniconfig==2.0.0 + # via pytest +numpy==2.1.3 + # via -r requirements/tests.txt +packaging==24.2 + # via pytest +pluggy==1.5.0 + # via pytest +pytest==8.3.3 + # via + # -r requirements/tests.txt + # pytest-cov + # pytest-xdist +pytest-cov==6.0.0 + # via -r requirements/tests.txt +pytest-xdist==3.6.1 + # via -r requirements/tests.txt diff --git a/tests/test_demes.py b/tests/test_demes.py index df2b00a..632ae7a 100644 --- a/tests/test_demes.py +++ b/tests/test_demes.py @@ -3124,7 +3124,7 @@ def test_simultaneous_pulses_warning(self): with pytest.warns(UserWarning, match="Multiple pulses.*same.*time"): b2.resolve() - @pytest.mark.filterwarnings("error:Multiple pulses.*same.*time") + @pytest.mark.filterwarnings("error") def test_unrelated_pulses_no_warning(self): b1 = Builder() for j in range(4): @@ -3136,33 +3136,25 @@ def test_unrelated_pulses_no_warning(self): b2 = copy.deepcopy(b1) b2.add_pulse(sources=["d0"], dest="d1", time=T, proportions=[0.1]) b2.add_pulse(sources=["d0"], dest="d2", time=T, proportions=[0.1]) - with pytest.warns(None) as record: - b2.resolve() - assert len(record) == 0 + b2.resolve() # Shouldn't warn for: d0 -> d1; d2 -> d3. b2 = copy.deepcopy(b1) b2.add_pulse(sources=["d0"], dest="d1", time=T, proportions=[0.1]) b2.add_pulse(sources=["d2"], dest="d3", time=T, proportions=[0.1]) - with pytest.warns(None) as record: - b2.resolve() - assert len(record) == 0 + b2.resolve() # Different pulse times shouldn't warn for: d0 -> d1; d1 -> d2. b2 = copy.deepcopy(b1) b2.add_pulse(sources=["d0"], dest="d1", time=T, proportions=[0.1]) b2.add_pulse(sources=["d1"], dest="d2", time=2 * T, proportions=[0.1]) - with pytest.warns(None) as record: - b2.resolve() - assert len(record) == 0 + b2.resolve() # Different pulse times shouldn't warn for: d0 -> d2; d1 -> d2. b2 = copy.deepcopy(b1) b2.add_pulse(sources=["d0"], dest="d2", time=T, proportions=[0.1]) b2.add_pulse(sources=["d1"], dest="d2", time=2 * T, proportions=[0.1]) - with pytest.warns(None) as record: - b2.resolve() - assert len(record) == 0 + b2.resolve() @pytest.mark.filterwarnings("ignore:Multiple pulses.*same.*time") def test_pulse_proportions_sum_greater_than_one(self): diff --git a/tests/test_spec.py b/tests/test_spec.py index 1b3f8a7..3feb66c 100644 --- a/tests/test_spec.py +++ b/tests/test_spec.py @@ -2,6 +2,7 @@ Check that we do the right thing with the demes-spec test cases, by comparing against the reference implementation. """ + import math import json import operator