diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 0000000..dc9c3f2 --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,77 @@ +name: Upload Python Package + +on: + release: + types: [published] + +permissions: + contents: read + id-token: write + +jobs: + release-build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.8" + + - name: Build release distributions + run: | + python -m pip install build + python -m build + + - name: Upload distributions + uses: actions/upload-artifact@v4 + with: + name: release-dists + path: dist/ + + testpypi-publish: + runs-on: ubuntu-latest + needs: + - release-build + permissions: + id-token: write + environment: + name: testpypi + url: https://test.pypi.org/p/catmap + + steps: + - name: Retrieve release distributions + uses: actions/download-artifact@v4 + with: + name: release-dists + path: dist/ + + - name: Publish release distributions to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: dist/ + repository-url: https://test.pypi.org/legacy/ + + pypi-publish: + runs-on: ubuntu-latest + needs: + - release-build + - testpypi-publish + permissions: + id-token: write + environment: + name: pypi + url: https://pypi.org/p/catmap + + steps: + - name: Retrieve release distributions + uses: actions/download-artifact@v4 + with: + name: release-dists + path: dist/ + + - name: Publish release distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: dist/ diff --git a/setup.py b/setup.py index 525291d..db70ca3 100755 --- a/setup.py +++ b/setup.py @@ -1,5 +1,8 @@ #!/usr/bin/env python -"""Catalysis Micro-kinetic Analysis Package (CatMAP)""" +# -*- coding:utf-8 -*- +""" +Catalysis Micro-kinetic Analysis Package (CatMAP) +""" import os import sys @@ -8,94 +11,72 @@ from setuptools import setup except ImportError: from distutils.core import setup -#from catmap import __version__ as version -__version__ = "0.3.1" -__python_version__ = sys.version - -maintainer = 'Andrew J. Medford' -maintainer_email = 'ajmedfor@slac.stanford.edu' -author = maintainer -author_email = maintainer_email -description = __doc__ -classifiers = [ - 'Development Status :: 4 - Beta', - 'Environment :: Console', - 'Environment :: X11 Applications :: GTK', - 'Intended Audience :: Science/Research', - 'Intended Audience :: Developers', - 'OSI Approved :: GNU General Public License (GPL)', - 'Natural Language :: English', - 'Operating System :: POSIX :: Linux', - 'Operating System :: POSIX :: Windows', - 'Programming Language :: Fortran', - 'Programming Language :: Python', - 'Topic :: Education', - 'Topic :: Scientific/Engineering :: Chemistry', - 'Topic :: Scientific/Engineering :: Physics', - 'Topic :: Scientific/Engineering :: Visualization', - ] -requires = ['matplotlib', - 'mpmath', - 'numpy', - 'graphviz', - 'ase' if sys.version >= '3.5' else 'ase==3.17'] +# from catmap import __version__ as version +__version__ = "0.4.1" +__python_version__ = sys.version -license = 'COPYING.txt' -long_description = open('README.md').read() -name='python-catmap' -packages = [ - 'catmap', - 'catmap.analyze', - 'catmap.api', - 'catmap.data', - 'catmap.mappers', - 'catmap.parsers', - 'catmap.scalers', - 'catmap.solvers', - 'catmap.thermodynamics', - ] -package_dir = {'catmap':'catmap'} -package_data = {'catmap':[]} -platforms = ['linux', 'windows'] -if os.name == 'nt': - scripts = [] -else: - scripts = [ - 'tools/catmap' - ] -tests = [ - "pgtest~=1.3", - "pytest~=6.0", - "pytest-regressions~=1.0" - ] -extras_require = { +setup( + author="Andrew J. Medford", + author_email="ajmedfor@slac.stanford.edu", + classifiers=[ + "Development Status :: 4 - Beta", + "Environment :: Console", + "Environment :: X11 Applications :: GTK", + "Intended Audience :: Science/Research", + "Intended Audience :: Developers", + "OSI Approved :: GNU General Public License (GPL)", + "Natural Language :: English", + "Operating System :: POSIX :: Linux", + "Operating System :: POSIX :: Windows", + "Programming Language :: Fortran", + "Programming Language :: Python", + "Topic :: Education", + "Topic :: Scientific/Engineering :: Chemistry", + "Topic :: Scientific/Engineering :: Physics", + "Topic :: Scientific/Engineering :: Visualization", + ], + description=__doc__, + license="COPYING.txt", + long_description=open("README.md", "r", encoding="utf-8").read(), + maintainer="Andrew J. Medford", + maintainer_email="ajmedfor@slac.stanford.edu", + name="python-catmap", + package_data={"catmap": []}, + package_dir={"catmap": "catmap"}, + packages=[ + "catmap", + "catmap.analyze", + "catmap.api", + "catmap.data", + "catmap.mappers", + "catmap.parsers", + "catmap.scalers", + "catmap.solvers", + "catmap.thermodynamics", + ], + platforms=["linux", "windows"], + scripts=[] if os.name == "nt" else ["tools/catmap"], + url="https://github.com/ajmedford/catmap", + version=__version__, + install_requires=[ + "matplotlib", + "mpmath", + "numpy", + "graphviz", + "ase" if sys.version_info >= (3, 5) else "ase==3.17", + ], + tests=[ + "pgtest~=1.3", + "pytest~=6.0", + "pytest-regressions~=1.0", + ], + extras_require={ "tests": [ "pgtest~=1.3", "pytest~=6.0", - "pytest-regressions~=1.0" + "pytest-regressions~=1.0", ], - } -url = 'https://github.com/ajmedford/catmap' - -setup( - author=author, - author_email=author_email, - description=description, - license=license, - long_description=long_description, - maintainer=maintainer, - maintainer_email=maintainer_email, - name=name, - package_data=package_data, - package_dir=package_dir, - packages=packages, - platforms=platforms, - scripts=scripts, - url=url, - version=__version__, - install_requires = requires, - tests=tests, - extras_require=extras_require, - ) + }, +)