Skip to content

Commit 39ec0bf

Browse files
authored
Update to pyproject.toml specification, update workflows (#76)
* Add pyproject.toml * Remove old specs from setup.py * Add dependabot * Update build and deploy github workflow * Add ripser.py as an optional dependency * Update testing workflow, rename to test * Remove dist specification from action * Allow for python 3.7 * Remove python requirement; remove build, wheel, and toml setuptool requires * Bump version * Add Abe as maintainer
1 parent a44f6eb commit 39ec0bf

File tree

9 files changed

+189
-132
lines changed

9 files changed

+189
-132
lines changed

.github/dependabot.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Set update schedule for GitHub Actions
2+
3+
version: 2
4+
updates:
5+
- package-ecosystem: "github-actions"
6+
directory: "/"
7+
schedule:
8+
# Check for updates to GitHub Actions every week
9+
interval: "weekly"
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# This workflows will upload a Python Package using Twine when a release is created
2+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
4+
name: Build and Upload Python Package
5+
6+
on:
7+
workflow_dispatch:
8+
pull_request:
9+
push:
10+
branches:
11+
- main
12+
release:
13+
types:
14+
- published
15+
16+
jobs:
17+
build_wheel_and_sdist:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Build SDist and wheel
26+
run: pipx run build
27+
28+
- uses: actions/upload-artifact@v4
29+
with:
30+
name: Packages
31+
path: dist/*
32+
33+
- name: Check metadata
34+
run: pipx run twine check dist/*
35+
36+
upload_pypi:
37+
name: Upload release to PyPI
38+
needs: [build_wheel_and_sdist]
39+
runs-on: ubuntu-latest
40+
environment:
41+
name: pypi
42+
url: https://pypi.org/p/persim
43+
permissions:
44+
id-token: write
45+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
46+
steps:
47+
- uses: actions/download-artifact@v4
48+
with:
49+
name: Packages
50+
path: dist
51+
52+
- uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/python-app.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

.github/workflows/python-publish.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.github/workflows/python-test.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# This workflow will install Python dependencies, run tests and lint with a single version of Python
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Python application
5+
6+
on:
7+
push:
8+
branches: [master]
9+
pull_request:
10+
branches: [master]
11+
12+
jobs:
13+
test:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install flake8
29+
pip install -e ".[testing]"
30+
- name: Lint with flake8
31+
run: |
32+
# stop the build if there are Python syntax errors or undefined names
33+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
34+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
35+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
36+
- name: Test with pytest
37+
run: |
38+
pytest --cov persim
39+
- name: Upload coverage results
40+
run: |
41+
bash <(curl -s https://codecov.io/bash)

RELEASE.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
0.3.6
2+
- Update to pyproject.toml specification.
3+
- Update github workflows.
4+
15
0.3.5
26
- Fix broken notebook, Issue #77 (https://github.com/scikit-tda/persim/issues/77).
37

persim/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.3.5"
1+
__version__ = "0.3.6"

pyproject.toml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
[build-system]
2+
requires = ["setuptools >= 61.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "persim"
7+
dynamic = ["version"]
8+
description = "Distances and representations of persistence diagrams"
9+
readme = "README.md"
10+
authors = [
11+
{ name = "Nathaniel Saul", email = "[email protected]" },
12+
{ name = "Chris Tralie", email = "[email protected]" },
13+
{ name = "Francis Motta", email = "[email protected]" },
14+
{ name = "Michael Catanzaro", email = "[email protected]" },
15+
{ name = "Gabrielle Angeloro", email = "[email protected]" },
16+
{ name = "Calder Sheagren", email = "[email protected]" },
17+
]
18+
maintainers = [
19+
{ name = "Nathaniel Saul", email = "[email protected]" },
20+
{ name = "Chris Tralie", email = "[email protected]" },
21+
{ name = "Michael Catanzaro", email = "[email protected]" },
22+
{ name = "Abraham Smith", email = "[email protected]" },
23+
]
24+
25+
dependencies = [
26+
"deprecated",
27+
"hopcroftkarp",
28+
"joblib",
29+
"matplotlib",
30+
"numpy",
31+
"scikit-learn",
32+
]
33+
34+
classifiers = [
35+
"Development Status :: 3 - Alpha",
36+
"Intended Audience :: Science/Research",
37+
"Intended Audience :: Education",
38+
"Intended Audience :: Financial and Insurance Industry",
39+
"Intended Audience :: Healthcare Industry",
40+
"Topic :: Scientific/Engineering :: Information Analysis",
41+
"Topic :: Scientific/Engineering :: Mathematics",
42+
"License :: OSI Approved :: MIT License",
43+
"Programming Language :: Python",
44+
]
45+
46+
47+
keywords = [
48+
"persistent homology",
49+
"persistence images",
50+
"persistence diagrams",
51+
"topological data analysis",
52+
"algebraic topology",
53+
"unsupervised learning",
54+
"supervised learning",
55+
"machine learning",
56+
"sliced wasserstein distance",
57+
"bottleneck distance",
58+
]
59+
[project.optional-dependencies]
60+
testing = ["pytest", "pytest-cov"]
61+
62+
docs = ["ripser", "sktda_docs_config"]
63+
64+
[project.urls]
65+
Homepage = "https://persim.scikit-tda.org"
66+
Documentation = "https://persim.scikit-tda.org"
67+
Repository = "https://github.com/scikit-tda/persim"
68+
Issues = "https://github.com/scikit-tda/persim/issues"
69+
Changelog = "https://github.com/scikit-tda/persim/blob/master/RELEASE.txt"

setup.py

Lines changed: 13 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,18 @@
1-
#!/usr/bin/env python
2-
3-
from setuptools import setup
4-
5-
1+
import setuptools
62
import re
73

8-
VERSIONFILE = "persim/_version.py"
9-
verstrline = open(VERSIONFILE, "rt").read()
10-
VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]"
11-
mo = re.search(VSRE, verstrline, re.M)
12-
if mo:
13-
verstr = mo.group(1)
14-
else:
15-
raise RuntimeError("Unable to find version string in %s." % (VERSIONFILE,))
164

17-
with open("README.md") as f:
18-
long_description = f.read()
5+
def get_version():
6+
VERSIONFILE = "persim/_version.py"
7+
verstrline = open(VERSIONFILE, "rt").read()
8+
VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]"
9+
mo = re.search(VSRE, verstrline, re.M)
10+
if mo:
11+
return mo.group(1)
12+
else:
13+
raise RuntimeError("Unable to find version string in %s." % (VERSIONFILE,))
14+
1915

20-
setup(
21-
name="persim",
22-
version=verstr,
23-
description="Distances and representations of persistence diagrams",
24-
long_description=long_description,
25-
long_description_content_type="text/markdown",
26-
author="Nathaniel Saul, Chris Tralie, Francis Motta, Michael Catanzaro, Gabrielle Angeloro, Calder Sheagren",
27-
28-
url="https://persim.scikit-tda.org",
29-
license="MIT",
30-
packages=["persim"],
31-
include_package_data=True,
32-
install_requires=[
33-
"scikit-learn",
34-
"numpy",
35-
"matplotlib",
36-
"scipy",
37-
"hopcroftkarp",
38-
"deprecated",
39-
"joblib",
40-
],
41-
extras_require={ # use `pip install -e ".[testing]"``
42-
"testing": ["pytest", "pytest-cov"],
43-
"docs": [ # `pip install -e ".[docs]"``
44-
"sktda_docs_config"
45-
],
46-
},
47-
python_requires=">=3.6",
48-
classifiers=[
49-
"Development Status :: 3 - Alpha",
50-
"Intended Audience :: Science/Research",
51-
"Intended Audience :: Education",
52-
"Intended Audience :: Financial and Insurance Industry",
53-
"Intended Audience :: Healthcare Industry",
54-
"Topic :: Scientific/Engineering :: Information Analysis",
55-
"Topic :: Scientific/Engineering :: Mathematics",
56-
"License :: OSI Approved :: MIT License",
57-
"Programming Language :: Python :: 3.6",
58-
"Programming Language :: Python :: 3.7",
59-
"Programming Language :: Python :: 3.8",
60-
],
61-
keywords="persistent homology, persistence images, persistence diagrams, topological data analysis, algebraic topology, unsupervised learning, supervised learning, machine learning, sliced wasserstein distance, bottleneck distance",
16+
setuptools.setup(
17+
version=get_version(),
6218
)

0 commit comments

Comments
 (0)