Skip to content

Commit

Permalink
Convert to pyproject.toml spec (#18)
Browse files Browse the repository at this point in the history
* Convert setup.py spec to pyproject.toml spec

* Remove requirements.txt

* Update workflows to use optional installs

* Add pytestcov to optional testing deps

* Fix two dep typos and add build dep,

* Optional dep is called 'testing' not 'tests'

* Fix windows tests

* Add doc requirements

* Remove changelog from pyproject.toml
  • Loading branch information
catanzaromj authored Sep 9, 2024
1 parent ca37386 commit 17cd2b1
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 64 deletions.
16 changes: 6 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
push:
pull_request:
schedule:
- cron: '0 0 * * *'
- cron: "0 0 * * *"

jobs:
test-linux-macos:
Expand All @@ -25,18 +25,16 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install ".[testing]"
: # pip install pytest nbmake
pip install pytest
- name: Run test
- name: Run test
run: |
: # we were also testing the jupyter notebooks with the command below
: # but some recent update broke this and we get "No such file or directory: 'latex'"
: # so for now we don't test notebooks
: # original command "pytest --nbmake ."
pytest .
test-windows:
runs-on: windows-latest
strategy:
Expand All @@ -54,10 +52,9 @@ jobs:
shell: bash -l {0}
run: |
python -m pip install --upgrade pip
pip install .
pip install ".[testing]"
: # pip install pytest nbmake
pip install pytest
- name: Run test
- name: Run test
shell: bash -l {0}
run: |
: # we were also testing the jupyter notebooks with the command below
Expand All @@ -81,8 +78,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov
pip install ".[testing]"
- name: Tests
run: |
export NUMBA_DISABLE_JIT=1
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sphinx:

python:
install:
- requirements: ./requirements.txt
- requirements: docs/requirements.txt
- method: pip
path: .
extra_requirements:
Expand Down
5 changes: 5 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sphinx
sphinx_rtd_theme
numpydoc
ipython
nbsphinx
57 changes: 57 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
[build-system]
requires = ["setuptools >= 61.0", "build", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "dreimac"
dynamic = ["version"]
description = "DREiMac: Dimensionality reduction with Eilenberg-MacLane coordinates"
readme = "README.md"
authors = [
{ name = "Jose A. Perea", email = "[email protected]" },
{ name = "Luis Scoccola", email = "[email protected]" },
{ name = "Chris Tralie", email = "[email protected]" },
]
maintainers = [
{ name = "Jose A. Perea", email = "[email protected]" },
{ name = "Luis Scoccola", email = "[email protected]" },
{ name = "Chris Tralie", email = "[email protected]" },
]

requires-python = ">=3.8, <3.12"

dependencies = [
"matplotlib >= 3.6",
"numba >= 0.56",
"numpy >= 1.23",
"persim >=0.3",
"ripser >= 0.6",
"scipy >=1.10",
]

classifiers = [
"Intended Audience :: Science/Research",
"Intended Audience :: Education",
"Intended Audience :: Financial and Insurance Industry",
"Intended Audience :: Healthcare Industry",
"Topic :: Scientific/Engineering :: Information Analysis",
"Topic :: Scientific/Engineering :: Mathematics",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"License :: OSI Approved :: Apache Software License",
]

keywords = ["dimensionality reduction", "topological data analysis"]

[project.optional-dependencies]
testing = ["pytest", "pytest-cov"]

docs = ["sphinx", "sphinx_rtd_theme", "numpydoc", "ipykernel", "nbsphinx"]

[project.urls]
Homepage = "https://dreimac.scikit-tda.org"
Documentation = "https://dreimac.scikit-tda.org"
Repository = "https://github.com/scikit-tda/DREiMac"
Issues = "https://github.com/scikit-tda/DREiMac/issues"
6 changes: 0 additions & 6 deletions requirements.txt

This file was deleted.

57 changes: 10 additions & 47 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,55 +1,18 @@
from setuptools import setup

## Get version information from _version.py
import re

VERSIONFILE = "dreimac/_version.py"
verstrline = open(VERSIONFILE, "rt").read()
VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]"
mo = re.search(VSRE, verstrline, re.M)
if mo:
verstr = mo.group(1)
else:
raise RuntimeError("Unable to find version string in %s." % (VERSIONFILE,))

# Use README.md as the package long description
with open("README.md") as f:
long_description = f.read()


# get requirements
def requirements():
with open("requirements.txt") as f:
return [line.strip() for line in f if line.strip()]
def get_version():
VERSIONFILE = "dreimac/_version.py"
verstrline = open(VERSIONFILE, "rt").read()
VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]"
mo = re.search(VSRE, verstrline, re.M)
if mo:
return mo.group(1)
else:
raise RuntimeError("Unable to find version string in %s." % (VERSIONFILE,))


setup(
name="dreimac",
version=verstr,
description="DREiMac: Dimensionality reduction with Eilenberg-MacLane coordinates",
long_description=long_description,
long_description_content_type="text/markdown",
author="Jose A. Perea, Luis Scoccola, Chris Tralie",
author_email="[email protected]",
license="Apache2",
packages=["dreimac"],
install_requires=requirements(),
extras_require={
"testing": ["pytest"],
"docs": ["sphinx", "sphinx_rtd_theme", "numpydoc", "ipykernel", "nbsphinx"],
},
python_requires=">=3.8,<3.12",
classifiers=[
"Intended Audience :: Science/Research",
"Intended Audience :: Education",
"Intended Audience :: Financial and Insurance Industry",
"Intended Audience :: Healthcare Industry",
"Topic :: Scientific/Engineering :: Information Analysis",
"Topic :: Scientific/Engineering :: Mathematics",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
],
keywords="topological data analysis, dimensionality reduction",
version=get_version(),
)

0 comments on commit 17cd2b1

Please sign in to comment.