Skip to content

Commit

Permalink
Add Python 3.12 support (#409)
Browse files Browse the repository at this point in the history
* attempt upgrades

* thrash

* fix install

* upgrade deploy action [ci skip]
  • Loading branch information
alimanfoo authored Mar 26, 2024
1 parent e865e72 commit a17ecee
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 119 deletions.
27 changes: 13 additions & 14 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,36 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, windows-2019, macos-11]
os: [ubuntu-latest, windows-latest, macos-13, macos-14]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.8'
- uses: actions/setup-python@v5

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.17.0

- name: Build wheels
uses: pypa/cibuildwheel@v2.12.3
run: python -m cibuildwheel --output-dir wheelhouse
env:
# Only build on Python 3 and skip 32-bit builds
CIBW_BUILD: "cp3*-*"
CIBW_SKIP: "cp36-* cp37-* *-win32 *linux_i686"
CIBW_SKIP: "cp36-* cp37-* *-win32 *i686 *musl*"

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.8'

- name: Build sdist
run: |
Expand All @@ -63,7 +62,7 @@ jobs:
name: artifact
path: dist

- uses: pypa/gh-action-pypi-publish@master
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
11 changes: 6 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@ jobs:
- windows-latest
- macos-latest
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"

steps:

- uses: actions/checkout@v1
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -50,12 +51,12 @@ jobs:
pytest -v allel
- name: Test with doctest
if: matrix.platform == 'ubuntu-latest' && matrix.python-version == '3.10'
if: matrix.platform == 'ubuntu-latest' && matrix.python-version == '3.12'
run: |
pytest -v --cov=allel --doctest-modules allel
coverage report -m
- name: Build docs
if: matrix.platform == 'ubuntu-latest' && matrix.python-version == '3.10'
if: matrix.platform == 'ubuntu-latest' && matrix.python-version == '3.12'
run: |
cd docs && make html
4 changes: 2 additions & 2 deletions allel/stats/roh.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,11 @@ def roh_poissonhmm(gv, pos, phet_roh=0.001, phet_nonroh=(0.0025, 0.01), transiti
Notes
-----
This function requires `pomegranate` (>= 0.9.0) to be installed.
This function requires `protopunica` to be installed.
"""

from pomegranate import HiddenMarkovModel, PoissonDistribution
from protopunica import HiddenMarkovModel, PoissonDistribution

is_accessible = asarray_ndim(is_accessible, 1, dtype=bool, allow_none=True)

Expand Down
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
[project]
name = "scikit-allel"
requires-python = ">=3.6"
dynamic = ["version", "description"]
requires-python = ">=3.9"
description = "A Python package for exploring and analysing genetic variation data."
readme = "README.rst"
dynamic = ["version", "classifiers", "license", "maintainers", "dependencies", "optional-dependencies"]


[build-system]
# Minimum requirements for the build system to execute.
Expand Down
6 changes: 3 additions & 3 deletions requirements_dev_base.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# required
cython==0.29.34
numpy==1.24.3
dask[array]==2023.4.1
cython
numpy
dask[array]
24 changes: 12 additions & 12 deletions requirements_dev_optional.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# optional
scipy==1.10.1
matplotlib==3.7.1
seaborn==0.12.2
pandas==2.0.1
scikit-learn==1.2.2
h5py==3.8.0
numexpr==2.8.4
zarr==2.14.2
hmmlearn==0.3.0
pomegranate<1.0.0
pyfasta==0.5.2
ipython==8.13.0
scipy
matplotlib
seaborn
pandas
scikit-learn
h5py
numexpr
zarr
hmmlearn
protopunica
pyfasta
ipython
118 changes: 66 additions & 52 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,90 +3,104 @@
import setuptools_scm


DISTNAME = 'scikit-allel'
DISTNAME = "scikit-allel"

PACKAGE_NAME = 'allel'
PACKAGE_NAME = "allel"

DESCRIPTION = 'A Python package for exploring and analysing genetic ' \
'variation data.'
DESCRIPTION = "A Python package for exploring and analysing genetic variation data."

with open('README.rst') as f:
LONG_DESCRIPTION = f.read()
MAINTAINER = "Alistair Miles"

MAINTAINER = 'Alistair Miles'
MAINTAINER_EMAIL = "[email protected]"

MAINTAINER_EMAIL = 'alimanfoo@googlemail.com'
URL = "https://github.com/cggh/scikit-allel"

URL = 'https://github.com/cggh/scikit-allel'
DOWNLOAD_URL = "http://pypi.python.org/pypi/scikit-allel"

DOWNLOAD_URL = 'http://pypi.python.org/pypi/scikit-allel'
LICENSE = "MIT"

LICENSE = 'MIT'

INSTALL_REQUIRES = ['numpy', 'dask[array]']
INSTALL_REQUIRES = ["numpy", "dask[array]"]

# full installation with all optional dependencies
EXTRAS_REQUIRE = {'full': ['scipy', 'matplotlib', 'seaborn', 'pandas', 'scikit-learn',
'h5py', 'numexpr', 'zarr', 'hmmlearn', 'pomegranate', 'nose']}
EXTRAS_REQUIRE = {
"full": [
"scipy",
"matplotlib",
"seaborn",
"pandas",
"scikit-learn",
"h5py",
"numexpr",
"zarr",
"hmmlearn",
"protopunica",
"nose",
]
}

CLASSIFIERS = [
'Development Status :: 4 - Beta',
'License :: OSI Approved :: MIT License',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'Programming Language :: Python',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Scientific/Engineering',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Operating System :: Unix',
'Operating System :: MacOS',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Programming Language :: Python",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Scientific/Engineering",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Operating System :: Unix",
"Operating System :: MacOS",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]


# noinspection PyUnresolvedReferences
def setup_extensions(metadata):
try:
print('[scikit-allel] setup extensions with cython')
print("[scikit-allel] setup extensions with cython")
from Cython.Build import cythonize
import numpy
ext_modules = cythonize([
Extension('allel.opt.model',
sources=['allel/opt/model.pyx'],
include_dirs=[numpy.get_include()],
),
Extension('allel.opt.stats',
sources=['allel/opt/stats.pyx'],
include_dirs=[numpy.get_include()],
),
Extension('allel.opt.io_vcf_read',
sources=['allel/opt/io_vcf_read.pyx'],
include_dirs=[numpy.get_include()],
),
])
metadata['ext_modules'] = ext_modules

ext_modules = cythonize(
[
Extension(
"allel.opt.model",
sources=["allel/opt/model.pyx"],
include_dirs=[numpy.get_include()],
),
Extension(
"allel.opt.stats",
sources=["allel/opt/stats.pyx"],
include_dirs=[numpy.get_include()],
),
Extension(
"allel.opt.io_vcf_read",
sources=["allel/opt/io_vcf_read.pyx"],
include_dirs=[numpy.get_include()],
),
]
)
metadata["ext_modules"] = ext_modules
except ImportError:
print('[scikit-allel] cython not available, not including extensions')
print("[scikit-allel] cython not available, not including extensions")


def setup_package():

metadata = dict(
name=DISTNAME,
maintainer=MAINTAINER,
maintainer_email=MAINTAINER_EMAIL,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
license=LICENSE,
url=URL,
download_url=DOWNLOAD_URL,
package_dir={'': '.'},
package_dir={"": "."},
packages=find_packages(),
package_data={'allel.test': ['data/*']},
package_data={"allel.test": ["data/*"]},
classifiers=CLASSIFIERS,
install_requires=INSTALL_REQUIRES,
extras_require=EXTRAS_REQUIRE,
Expand All @@ -96,5 +110,5 @@ def setup_package():
setup(**metadata)


if __name__ == '__main__':
if __name__ == "__main__":
setup_package()
29 changes: 0 additions & 29 deletions tox.ini

This file was deleted.

0 comments on commit a17ecee

Please sign in to comment.