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: 3 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
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@main
11 changes: 11 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Lint

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

jobs:
Lint:
uses: tskit-dev/.github/.github/workflows/lint.yml@main
77 changes: 11 additions & 66 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,74 +7,19 @@ on:
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@main

test:
name: Python
runs-on: ${{ matrix.os }}
uses: tskit-dev/.github/.github/workflows/python-tests.yml@main
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python }}
coverage-directory: tstrait
secrets: inherit
strategy:
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 }}
- 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: Test with pytest
run: |
uv run --no-sync python -m pytest --cov=tstrait --cov-report=xml --cov-branch -n 0 tests
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5.1.1
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Delete coverage
run: |
rm .coverage

dist-tests:
name: Distribution
runs-on: ubuntu-24.04
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v4.2.2
- uses: actions/setup-python@v5.3.0
with:
python-version: '3.12'
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install twine build
- name: Build sdist and wheel
run: |
python -m build
- name: Check distribution artefacts
run: |
python3 -m twine check dist/*
- name: Install wheel
run: |
python3 -m pip install dist/*.whl
- name: Import package
# Don't import from current dir
run: |
cd /
python3 -c "import tstrait"
python: ["3.11", "3.13"]
os: [macos-latest, ubuntu-24.04, windows-latest]
130 changes: 28 additions & 102 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -1,126 +1,52 @@
name: Build and test wheels
name: Publish Python release

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

jobs:
distbuild:
name: Build Distribution
build:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-python@v5.3.0
with:
python-version: '3.12'
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install twine build
- name: Build sdist and wheel
run: |
python -m build
- name: Check distribution artefacts
run: |
python3 -m twine check dist/*
- name: Upload wheel and sdist
uses: actions/upload-artifact@v4.4.3
with:
name: wheels
path: dist
fetch-depth: 0

OSX-test:
needs: ['distbuild']
runs-on: macos-latest
strategy:
matrix:
python: ["3.10", "3.11", "3.12", "3.13"]
steps:
- name: Download wheels
uses: actions/download-artifact@v4.1.8
with:
name: wheels
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5.3.0
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python }}
- name: Install wheel and test
run: |
python -VV
# Install the local wheel
pip install tstrait --only-binary tstrait -f .
python -c "import tstrait"
python-version: "3.12"
version: "0.8.15"

windows-test:
needs: ['distbuild']
runs-on: windows-latest
strategy:
matrix:
python: ["3.10", "3.11", "3.12", "3.13"]
wordsize: [64]
steps:
- name: Download wheels
uses: actions/download-artifact@v4.1.8
with:
name: wheels
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5.3.0
with:
python-version: ${{ matrix.python }}
- name: Install wheel and test
run: |
python -VV
pip install wheel
# Install the local wheel
pip install tstrait --only-binary tstrait -f .
python -c "import tstrait"
- name: Build
run: uv build

linux-test:
runs-on: ubuntu-24.04
needs: ['distbuild']
strategy:
matrix:
python: ["3.10", "3.11", "3.12", "3.13"]
steps:
- name: Download wheels
uses: actions/download-artifact@v4.1.8
- uses: actions/upload-artifact@v4
with:
name: wheels
- name: Set up Python
uses: actions/setup-python@v5.3.0
with:
python-version: ${{ matrix.python }}
- name: Install wheel and test
run: |
python -VV
# Install the local wheel
pip install tstrait --only-binary tstrait -f .
python -c "import tstrait"
name: dist
path: dist/

PyPI_Upload:
publish:
runs-on: ubuntu-24.04
environment: release
needs: ['windows-test', 'OSX-test', 'linux-test']
needs: [build]
permissions:
id-token: write
steps:
- name: Download all
uses: actions/download-artifact@v4.1.8
- 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: pypa/gh-action-pypi-publish@v1.12.3
- uses: actions/download-artifact@v7.0.0
with:
repository_url: https://test.pypi.org/legacy/
- name: Publish distribution to PRODUCTION PyPI
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/
verbose: true

- name: Publish to PyPI
if: github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@v1.12.3
uses: pypa/gh-action-pypi-publish@v1.13.0
39 changes: 0 additions & 39 deletions .pre-commit-config.yaml

This file was deleted.

7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## [0.1.2] - 2026-XX-XX
Unreleased

- Upgrade supported Python versions to 3.11 -> 3.14

## [0.1.1] - 2025-09-18

### Update:
Expand Down Expand Up @@ -56,7 +61,7 @@
### Highlights:

- Initial stable release of tstrait in PyPI https://pypi.org/project/tstrait/
- Initial stable release of tstrait in conda-forge
- Initial stable release of tstrait in conda-forge

### Documentation:

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