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: 0 additions & 6 deletions .flake8

This file was deleted.

10 changes: 5 additions & 5 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Build Docs
name: Build docs

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

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

on:
pull_request:
merge_group:

jobs:
lint:
uses: tskit-dev/.github/.github/workflows/lint.yml@v13
11 changes: 11 additions & 0 deletions .github/workflows/python-packaging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Packaging

on:
pull_request:
merge_group:

jobs:
packaging:
uses: tskit-dev/.github/.github/workflows/python-packaging.yml@v13
with:
pyproject-directory: .
38 changes: 9 additions & 29 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,16 @@ on:
merge_group:

jobs:
pre-commit:
name: Lint
uses: tskit-dev/.github/.github/workflows/lint.yml@v2

test:
name: Python
runs-on: ${{ matrix.os }}
uses: tskit-dev/.github/.github/workflows/python-tests.yml@v13
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python }}
pyproject-directory: .
coverage-directory: tscompare
secrets: inherit
strategy:
matrix:
python-version: [ "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 }}
version: "0.8.15"

- name: Install dependencies
run: |
uv venv
uv pip install -e ".[test]"
- name: Test with pytest
run: |
uv run --no-sync python -m pytest --cov=tscompare --cov-report=xml --cov-branch -n 0 tests
python: ["3.11", "3.13"]
os: [macos-latest, ubuntu-24.04, windows-latest]
47 changes: 47 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Publish Python release

on:
push:
branches: [test-publish]
release:
types: [published]

jobs:
build:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4.2.2
with:
fetch-depth: 0
- uses: astral-sh/setup-uv@v6
with:
python-version: "3.12"
version: "0.8.15"
- run: uv build
- uses: actions/upload-artifact@v4.6.1
with:
name: dist
path: dist/

publish:
runs-on: ubuntu-24.04
environment: release
needs: [build]
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4.2.0
with:
name: dist
path: dist

- name: Publish to Test PyPI
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.13.0
29 changes: 0 additions & 29 deletions .pre-commit-config.yaml

This file was deleted.

14 changes: 2 additions & 12 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@

# Need to set PYTHONPATH so that we pick up the local tscompare
PYPATH=${PWD}/..
TSC_VERSION:=$(shell PYTHONPATH=${PYPATH} \
python3 -c 'import tscompare; print(tscompare.__version__.split("+")[0])')

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

dist:
@echo Building distribution for tscompare version ${TSC_VERSION}
sed -i s/__TSCOMPARE__VERSION__/${TSC_VERSION}/g _config.yml
PYTHONPATH=${PYPATH} ./build.sh
all:
./build.sh

clean:
rm -fR _build
3 changes: 1 addition & 2 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ sphinx:
navigation_with_keys: false
pygments_dark_style: monokai
logo:
text: "Version __TSCOMPARE_VERSION__"
text: "Version __PKG_VERSION__"
myst_enable_extensions:
- colon_fence
- deflist
Expand All @@ -54,7 +54,6 @@ sphinx:
tskit: ["https://tskit.dev/tskit/docs/stable", null]
tutorials: ["https://tskit.dev/tutorials/", null]
stdpopsim: ["https://popsim-consortium.github.io/stdpopsim-docs/stable", null]
pyslim: ["https://tskit.dev/pyslim/docs/latest/", null]
numpy: ["https://numpy.org/doc/stable/", null]
demes: ["https://popsim-consortium.github.io/demes-docs/main/", null]
demes-spec: ["https://popsim-consortium.github.io/demes-spec-docs/main/", null]
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"],
},
]
73 changes: 42 additions & 31 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
Expand All @@ -42,10 +41,9 @@ classifiers = [
"Operating System :: POSIX",
"Operating System :: MacOS",
]
requires-python = ">=3.10"
requires-python = ">=3.11"
dependencies = [
"numpy>=1.21.0",
"tskit>=0.5.0",
"tskit>=1.0.0",
"scipy>=1.7.0",
]

Expand All @@ -58,39 +56,36 @@ Homepage = "https://tskit.dev/tscompare"
Documentation = "https://tskit.dev/tscompare/docs/"
"Source Code" = "https://github.com/tskit-dev/tscompare"

[project.optional-dependencies]
[dependency-groups]
test = [
"tskit==0.6.0",
"numpy==2.2.4",
"pytest==8.3.5",
"pytest-cov==6.0.0",
"pytest-xdist==3.6.1",
"scipy==1.15.2",
"msprime==1.3.4",
"msprime",
"pytest",
"pytest-cov",
"pytest-xdist",
]
docs = [
"jupyter-book==1.0.4.post1",
"breathe==4.35.0",
"sphinx-autodoc-typehints==2.3.0",
"sphinx-issues==5.0.0",
"sphinx-argparse==0.5.2",
"svgwrite==1.4.3",
"tskit==0.6.0",
"tsinfer==0.4.1",
"scipy==1.15.2",
"msprime==1.3.4",
"jupyter-book<2",
"msprime",
"sphinx-argparse",
"sphinx-autodoc-typehints",
"sphinx-book-theme",
"numcodecs>=0.6,<0.15.1", #Pinned due to https://github.com/zarr-developers/numcodecs/issues/733
"setuptools_scm==9.2.0",
"sphinx-copybutton",
"sphinx-issues",
"tsinfer",
]
lint = [
"ruff==0.15.1",
"prek==0.3.3",
]
packaging = [
"twine",
"validate-pyproject[all]",
]
dev = [
"tskit",
"numpy",
"scipy",
"pytest",
"pytest-cov",
"pytest-xdist",
"msprime",
{include-group = "docs"},
{include-group = "lint"},
{include-group = "test"},
{include-group = "packaging"},
]

[tool.setuptools]
Expand All @@ -105,3 +100,19 @@ testpaths = [
"tests",
]

[tool.ruff]
target-version = "py311"
line-length = 89

[tool.ruff.lint]
select = ["E", "F", "B", "W", "I", "N", "UP", "A", "PT"]
fixable = ["ALL"]

ignore = [
"A001", "A002", "RUF",
"B905", #Don't add strict=False to zips (B905)
"E741", # using 'l' as a variable name
"N806", "N802", "N803", # Various nags about uppercase vars
"PT030", # `pytest.warns(DeprecationWarning)` is too broad.
]

Loading