Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 4 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
name: Build Docs
name: Docs

on:
pull_request:
push:
branches: [main]
tags:
- '*'
merge_group:

jobs:
Docs:
uses: tskit-dev/.github/.github/workflows/docs-build-template.yml@v1
uses: tskit-dev/.github/.github/workflows/docs.yml@v13
8 changes: 8 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: Lint

on:
pull_request:

jobs:
Lint:
uses: tskit-dev/.github/.github/workflows/lint.yml@v12
61 changes: 14 additions & 47 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,26 @@ name: Tests

on:
pull_request:
merge_group:
push:
branches: [main, test]
merge_group:

jobs:
pre-commit:
name: Lint
uses: tskit-dev/.github/.github/workflows/lint.yml@v2
packaging:
name: Python packaging
uses: tskit-dev/.github/.github/workflows/python-packaging.yml@v12
with:
cli-test-cmd: tsdate --help

test:
name: Python
runs-on: ${{ matrix.os }}
uses: tskit-dev/.github/.github/workflows/python-tests.yml@v12
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python }}
coverage-directory: tsdate
secrets: inherit
strategy:
fail-fast: false
matrix:
python: [ "3.10", 3.13 ]
os: [ macos-latest, ubuntu-24.04, windows-latest ]
defaults:
run:
shell: bash
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}

- name: Checkout
uses: actions/checkout@v4.2.2

- name: Install uv and set the python version
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python }}
version: "0.8.15"

- name: Install dependencies
run: |
uv venv
uv pip install -r pyproject.toml --extra test

- name: Run tests
run: |
NUMBA_DISABLE_JIT=1 uv run --no-sync python -m pytest -vv --cov=tsdate --cov-report=xml --cov-branch -n0 tests

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5.4.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
flags: python-tests
name: codecov-umbrella
verbose: true

- name: Build distribution
run: |
uv run --no-sync python -m build
python: ["3.11", "3.13"]
os: [macos-latest, ubuntu-24.04, windows-latest]
140 changes: 27 additions & 113 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -1,138 +1,52 @@
name: Build and test wheels
name: Publish Python release

on:
push:
branches:
- main
- test
tags:
- '*'
branches: [test-publish]
release:
types: [published]

jobs:
manylinux:
build:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4.2.2
- uses: actions/checkout@v4.2.2
with:
submodules: true
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5.4.0
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python-version: "3.10"
python-version: "3.12"
version: "0.8.15"

- name: Build sdist
shell: bash
run: |
python -m pip install --upgrade build
python -m build
- name: Build
run: uv build

- name: Upload
uses: actions/upload-artifact@v4.6.1
- uses: actions/upload-artifact@v4
with:
name: sdist-wheel
path: dist


OSX-test:
needs: ['manylinux']
runs-on: macos-15
strategy:
matrix:
python: ["3.10", 3.13]
steps:
- name: Download wheels
uses: actions/download-artifact@v4.2.0
with:
name: sdist-wheel
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5.4.0
with:
python-version: ${{ matrix.python }}
- name: Install wheel and test
run: |
python -VV
pip install wheel
# Install the local wheel, after getting deps
pip install tsdate --only-binary tsdate -f .
pip uninstall --yes msprime
pip install tsdate --no-index --only-binary tsdate -f .
python -c "import tsdate"
name: dist
path: dist/

windows-test:
needs: ['manylinux']
runs-on: windows-latest
strategy:
matrix:
python: ["3.10", 3.13]
wordsize: [64]
steps:
- name: Download wheels
uses: actions/download-artifact@v4.2.0
with:
name: sdist-wheel
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5.4.0
with:
python-version: ${{ matrix.python }}
- name: Install wheel and test
run: |
python -VV
pip install wheel
# Install the local wheel, after getting deps
pip install tsdate --only-binary tsdate -f .
pip uninstall --yes msprime
pip install tsdate --no-index --only-binary tsdate -f .
python -c "import tsdate"

manylinux-test:
publish:
runs-on: ubuntu-24.04
needs: ['manylinux']
strategy:
matrix:
python: ["3.10", 3.13]
steps:
- name: Download wheels
uses: actions/download-artifact@v4.2.0
with:
name: sdist-wheel
- name: Set up Python
uses: actions/setup-python@v5.4.0
with:
python-version: ${{ matrix.python }}
- name: Install wheel and test
run: |
python -VV
pip install wheel
# Install the local wheel, after getting deps
pip install tsdate --only-binary tsdate -f .
pip uninstall --yes msprime
pip install tsdate --no-index --only-binary tsdate -f .
python -c "import tsdate"


PyPI_Upload:
runs-on: ubuntu-24.04
needs: ['windows-test', 'OSX-test', 'manylinux-test']
environment: release
needs: [build]
permissions:
id-token: write
steps:
- name: Download all
uses: actions/download-artifact@v4.2.0
- name: Move to dist
run: |
mkdir dist
cp */*.{whl,gz} dist/.
- name: Publish distribution to Test PyPI
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
- uses: actions/download-artifact@v7.0.0
with:
name: dist
path: dist

- name: Publish to TestPyPI
if: github.event_name == 'push' && github.ref_name == 'test-publish'
uses: pypa/gh-action-pypi-publish@v1.13.0
with:
repository_url: https://test.pypi.org/legacy/
- name: Publish distribution to PRODUCTION PyPI
repository-url: https://test.pypi.org/legacy/
verbose: true

- name: Publish to PyPI
if: github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@v1.13.0

16 changes: 0 additions & 16 deletions .pre-commit-config.yaml

This file was deleted.

22 changes: 0 additions & 22 deletions docs/.readthedocs.yml

This file was deleted.

20 changes: 3 additions & 17 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
# Need to set PYTHONPATH so that we pick up the local tsdate
PYPATH=$(shell pwd)/../
TSDATE_VERSION:=$(shell PYTHONPATH=${PYPATH} \
python -c 'import tsdate; print(tsdate.__version__.split("+")[0])')

BUILDDIR = _build

all: dev

dev:
PYTHONPATH=${PYPATH} ./build.sh

dist:
@echo Building distribution for tsdate version ${TSDATE_VERSION}
sed -i -e s/__TSDATE_VERSION__/${TSDATE_VERSION}/g _config.yml
PYTHONPATH=${PYPATH} ./build.sh
all:
./build.sh

clean:
rm -fR $(BUILDDIR)
rm -fR _build
2 changes: 1 addition & 1 deletion docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ sphinx:
pygments_dark_style: monokai
navigation_with_keys: false
logo:
text: "Version __TSDATE_VERSION__"
text: "Version __PKG_VERSION__"
pygments_style: monokai
bibtex_reference_style: author_year
myst_enable_extensions:
Expand Down
2 changes: 1 addition & 1 deletion docs/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

REPORTDIR=_build/html/reports

jupyter-book build -nW --keep-going .
uv run --project=.. --group docs jupyter-book build . -vnW --keep-going
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
if [ -e $REPORTDIR ]; then
Expand Down
40 changes: 40 additions & 0 deletions prek.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# The prek configuration defining linting requirements. This
# setup is optimised for long-term stability and determinism,
# and therefore only uses either "builtin" rules or "local"
# rules implementing lint workflows. We do not use any remote
# workflow repos.

[[repos]]
repo = "builtin"
hooks = [
{ id = "check-added-large-files" },
{ id = "check-merge-conflict" },
{ id = "mixed-line-ending" },
{ id = "check-case-conflict" },
{ id = "check-yaml" },
{ id = "check-toml" },
]

[[repos]]
repo = "local"
hooks = [
{
id = "ruff-check",
name = "ruff check",
language = "system",
entry = "ruff check --fix --force-exclude",
types = ["python"],
},
]

[[repos]]
repo = "local"
hooks = [
{
id = "ruff-format",
name = "ruff format",
language = "system",
entry = "ruff format --force-exclude",
types = ["python"],
},
]
Loading