Skip to content

Commit

Permalink
Update to pyproject.toml specification, update workflows (#76)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
catanzaromj committed Mar 9, 2024
1 parent a44f6eb commit 39ec0bf
Show file tree
Hide file tree
Showing 9 changed files with 189 additions and 132 deletions.
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Set update schedule for GitHub Actions

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"
52 changes: 52 additions & 0 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Build and Upload Python Package

on:
workflow_dispatch:
pull_request:
push:
branches:
- main
release:
types:
- published

jobs:
build_wheel_and_sdist:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Build SDist and wheel
run: pipx run build

- uses: actions/upload-artifact@v4
with:
name: Packages
path: dist/*

- name: Check metadata
run: pipx run twine check dist/*

upload_pypi:
name: Upload release to PyPI
needs: [build_wheel_and_sdist]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/persim
permissions:
id-token: write
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v4
with:
name: Packages
path: dist

- uses: pypa/gh-action-pypi-publish@release/v1
42 changes: 0 additions & 42 deletions .github/workflows/python-app.yml

This file was deleted.

32 changes: 0 additions & 32 deletions .github/workflows/python-publish.yml

This file was deleted.

41 changes: 41 additions & 0 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python application

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
pip install -e ".[testing]"
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest --cov persim
- name: Upload coverage results
run: |
bash <(curl -s https://codecov.io/bash)
4 changes: 4 additions & 0 deletions RELEASE.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
0.3.6
- Update to pyproject.toml specification.
- Update github workflows.

0.3.5
- Fix broken notebook, Issue #77 (https://github.com/scikit-tda/persim/issues/77).

Expand Down
2 changes: 1 addition & 1 deletion persim/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.3.5"
__version__ = "0.3.6"
69 changes: 69 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
[build-system]
requires = ["setuptools >= 61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "persim"
dynamic = ["version"]
description = "Distances and representations of persistence diagrams"
readme = "README.md"
authors = [
{ name = "Nathaniel Saul", email = "nat@riverasaul.com" },
{ name = "Chris Tralie", email = "chris.tralie@gmail.com" },
{ name = "Francis Motta", email = "francis.c.motta@gmail.com" },
{ name = "Michael Catanzaro", email = "catanzaromj@pm.me" },
{ name = "Gabrielle Angeloro", email = "gabrielleangeloro@gmail.com" },
{ name = "Calder Sheagren", email = "caldersheagren@gmail.com" },
]
maintainers = [
{ name = "Nathaniel Saul", email = "nat@riverasaul.com" },
{ name = "Chris Tralie", email = "chris.tralie@gmail.com" },
{ name = "Michael Catanzaro", email = "catanzaromj@pm.me" },
{ name = "Abraham Smith", email = "abraham.smith@geomdata.com" },
]

dependencies = [
"deprecated",
"hopcroftkarp",
"joblib",
"matplotlib",
"numpy",
"scikit-learn",
]

classifiers = [
"Development Status :: 3 - Alpha",
"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",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
]


keywords = [
"persistent homology",
"persistence images",
"persistence diagrams",
"topological data analysis",
"algebraic topology",
"unsupervised learning",
"supervised learning",
"machine learning",
"sliced wasserstein distance",
"bottleneck distance",
]
[project.optional-dependencies]
testing = ["pytest", "pytest-cov"]

docs = ["ripser", "sktda_docs_config"]

[project.urls]
Homepage = "https://persim.scikit-tda.org"
Documentation = "https://persim.scikit-tda.org"
Repository = "https://github.com/scikit-tda/persim"
Issues = "https://github.com/scikit-tda/persim/issues"
Changelog = "https://github.com/scikit-tda/persim/blob/master/RELEASE.txt"
70 changes: 13 additions & 57 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,62 +1,18 @@
#!/usr/bin/env python

from setuptools import setup


import setuptools
import re

VERSIONFILE = "persim/_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,))

with open("README.md") as f:
long_description = f.read()
def get_version():
VERSIONFILE = "persim/_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="persim",
version=verstr,
description="Distances and representations of persistence diagrams",
long_description=long_description,
long_description_content_type="text/markdown",
author="Nathaniel Saul, Chris Tralie, Francis Motta, Michael Catanzaro, Gabrielle Angeloro, Calder Sheagren",
author_email="nat@riverasaul.com, chris.tralie@gmail.com, francis.c.motta@gmail.com, catanzaromj@gmail.com, gabrielleangeloro@gmail.com, caldersheagren@gmail.com",
url="https://persim.scikit-tda.org",
license="MIT",
packages=["persim"],
include_package_data=True,
install_requires=[
"scikit-learn",
"numpy",
"matplotlib",
"scipy",
"hopcroftkarp",
"deprecated",
"joblib",
],
extras_require={ # use `pip install -e ".[testing]"``
"testing": ["pytest", "pytest-cov"],
"docs": [ # `pip install -e ".[docs]"``
"sktda_docs_config"
],
},
python_requires=">=3.6",
classifiers=[
"Development Status :: 3 - Alpha",
"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",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
],
keywords="persistent homology, persistence images, persistence diagrams, topological data analysis, algebraic topology, unsupervised learning, supervised learning, machine learning, sliced wasserstein distance, bottleneck distance",
setuptools.setup(
version=get_version(),
)

0 comments on commit 39ec0bf

Please sign in to comment.