Skip to content

Commit

Permalink
Merge pull request #314 from benjeffery/packaging-update
Browse files Browse the repository at this point in the history
Update packaging
  • Loading branch information
hyanwong authored Oct 3, 2023
2 parents c96e07d + d2c0ece commit d9ab7f2
Show file tree
Hide file tree
Showing 12 changed files with 117 additions and 104 deletions.
15 changes: 9 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ orbs:
jobs:
build:
docker:
- image: cimg/python:3.7
- image: cimg/python:3.10.13
steps:
- checkout
- run:
Expand All @@ -17,10 +17,6 @@ jobs:
sudo apt-get install libgsl-dev
# way to set path persistently https://circleci.com/docs/2.0/env-vars/#setting-path
echo 'export PATH=/home/circleci/.local/bin:$PATH' >> $BASH_ENV
- run:
name: Compile Python
command: |
python setup.py build_ext --inplace
- run:
name: install dependencies
command: |
Expand All @@ -44,6 +40,13 @@ jobs:
python -m pytest -vv -n0 --cov=tsdate --cov-report=xml --cov-branch tests
environment:
NUMBA_DISABLE_JIT: 1

- codecov/upload:
token: CODECOV_TOKEN
- run:
name: Build the distribution tarball.
command: |
python -m build
21 changes: 0 additions & 21 deletions .github/workflows/docker/buildwheel.sh

This file was deleted.

6 changes: 0 additions & 6 deletions .github/workflows/docker/shared.env

This file was deleted.

45 changes: 21 additions & 24 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,29 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: true

- name: Set up Python 3.8
uses: actions/setup-python@v2
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: "3.10"

- name: Build sdist
shell: bash
run: |
python setup.py sdist
python -m pip install --upgrade build
python -m build
- name: Upload sdist
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: sdist
path: dist

- name: Build wheels in docker
shell: bash
run: |
docker run --rm -v `pwd`:/project -w /project quay.io/pypa/manylinux2010_x86_64 bash .github/workflows/docker/buildwheel.sh
- name: Upload Wheels
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
Expand All @@ -54,11 +50,11 @@ jobs:
python: [3.7, 3.8, 3.9, "3.10"]
steps:
- name: Download wheels
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: wheels
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install wheel and test
Expand All @@ -80,11 +76,11 @@ jobs:
wordsize: [64]
steps:
- name: Download wheels
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: wheels
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install wheel and test
Expand All @@ -105,11 +101,11 @@ jobs:
python: [3.7, 3.8, 3.9, "3.10"]
steps:
- name: Download wheels
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: wheels
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install wheel and test
Expand All @@ -126,21 +122,22 @@ jobs:
PyPI_Upload:
runs-on: ubuntu-latest
needs: ['windows-test', 'OSX-test', 'manylinux-test']
environment: release
permissions:
id-token: write
steps:
- name: Download all
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
- 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@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/
- name: Publish distribution to PRODUCTION PyPI
if: github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.pypi_password }}
uses: pypa/gh-action-pypi-publish@release/v1

12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
rev: v4.4.0
hooks:
- id: check-merge-conflict
- id: debug-statements
- id: mixed-line-ending
- id: check-case-conflict
- id: check-yaml
- repo: https://github.com/asottile/reorder_python_imports
rev: v3.0.1
rev: v3.10.0
hooks:
- id: reorder-python-imports
- repo: https://github.com/asottile/pyupgrade
rev: v2.31.1
rev: v3.10.1
hooks:
- id: pyupgrade
args: [--py3-plus, --py37-plus]
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 23.7.0
hooks:
- id: black
language_version: python3
- repo: https://github.com/pycqa/flake8
rev: 3.9.2
rev: 6.1.0
hooks:
- id: flake8
args: [--config=.flake8]
additional_dependencies: ["flake8-bugbear==22.3.23", "flake8-builtins==1.5.3"]
additional_dependencies: ["flake8-bugbear==23.7.10", "flake8-builtins==2.1.0"]
12 changes: 12 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[build-system]
requires = [
"setuptools>=42",
"setuptools_scm",
"wheel",
"oldest-supported-numpy"
]

build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
write_to = "tsdate/_version.py"
4 changes: 0 additions & 4 deletions pytest.ini

This file was deleted.

3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ pytest-xdist
pytest-cov
mpmath
numdifftools
setuptools>=45
twine
build
63 changes: 63 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
[metadata]
name = tsdate
author = Tskit Developers
author_email = admin@tskit.dev
license = MIT
description = Infer node ages from a tree sequence topology.
long_description = file: README.md
long_description_content_type = text/markdown
url = http://pypi.python.org/pypi/tsdate
project_urls =
Documentation = https://tsdate.readthedocs.io/en/latest/
Changelog = https://github.com/tskit-dev/tsdate/blob/main/CHANGELOG.rst
Bug Tracker = https://github.com/tskit-dev/tsdate/issues
GitHub = https://github.com/tskit-dev/tsdate
classifiers =
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3 :: Only
License :: OSI Approved :: MIT License
Development Status :: 3 - Alpha
Environment :: Other Environment
Intended Audience :: Science/Research
Operating System :: POSIX
Operating System :: MacOS :: MacOS X
Operating System :: Microsoft :: Windows
Topic :: Scientific/Engineering
Topic :: Scientific/Engineering :: Bio-Informatics
keywords =
population genetics
tree sequence
ancestral recombination graph
evolutionary tree
inference
dating
tsdate
platforms =
POSIX
Windows
MacOS X

[options]
packages = tsdate
python_requires = >=3.7
include_package_data = True
install_requires =
numpy
tskit>=0.2.3
scipy>1.2.3
numba>=0.46.0
tqdm
appdirs

[options.entry_points]
console_scripts =
tsdate=tsdate.__main__:main

[tool:pytest]
testpaths =
tests
37 changes: 2 additions & 35 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,8 @@
from setuptools import setup

with open("README.md") as fh:
long_description = fh.read()

setup(
# The package name along with all the other metadata is specified in setup.cfg
# However, GitHub's dependency graph can't see the package unless we put this here.
name="tsdate",
author="Anthony Wilder Wohns and Yan Wong",
author_email="awohns@gmail.com",
description="Infer node ages from a tree sequence topology",
long_description=long_description,
packages=["tsdate"],
long_description_content_type="text/markdown",
url="http://pypi.python.org/pypi/tsdate",
python_requires=">=3.7",
entry_points={
"console_scripts": [
"tsdate=tsdate.__main__:main",
]
},
setup_requires=["setuptools_scm"],
install_requires=[
"numpy",
"tskit>=0.2.3",
"scipy>1.2.3",
"numba>=0.46.0",
"tqdm",
"appdirs",
],
project_urls={
"Source": "https://github.com/awohns/tsdate",
"Bug Reports": "https://github.com/awohns/tsdate/issues",
},
classifiers=[
"Programming Language :: Python :: 3.7",
"License :: OSI Approved :: MIT License",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX",
],
use_scm_version={"write_to": "tsdate/_version.py"},
)
2 changes: 1 addition & 1 deletion tests/test_accuracy.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def test_basic(
}

expected = ts.nodes_time[nonsamples]
for (observed, src) in [
for observed, src in [
(dts.nodes_time[nonsamples], "ts"),
([dts.node(i).metadata["mn"] for i in np.where(nonsamples)[0]], "unconstr"),
]:
Expand Down
1 change: 0 additions & 1 deletion tsdate/prior.py
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,6 @@ def __init__(
allow_unary=False,
progress=False,
):

if approximate_priors:
if not approx_prior_size:
approx_prior_size = 1000
Expand Down

0 comments on commit d9ab7f2

Please sign in to comment.