From 008905ac02935fcf39774633ab3b80b3658e0447 Mon Sep 17 00:00:00 2001 From: Tyler Morrow Date: Wed, 7 Jul 2021 16:12:52 -0600 Subject: [PATCH] Set up for PyPi deployment. --- .github/workflows/publish-to-test-pypi.yml | 40 ++++++++++++++++++++++ README.md | 18 +++++----- pyproject.toml | 3 ++ setup.py | 35 +++++++++++++++++-- 4 files changed, 84 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/publish-to-test-pypi.yml create mode 100644 pyproject.toml diff --git a/.github/workflows/publish-to-test-pypi.yml b/.github/workflows/publish-to-test-pypi.yml new file mode 100644 index 0000000..d9a59bd --- /dev/null +++ b/.github/workflows/publish-to-test-pypi.yml @@ -0,0 +1,40 @@ +name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI +on: + release: + types: [published] +jobs: + build-n-publish: + name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@master + - name: Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: Install pypa/build + run: >- + python -m + pip install + build + --user + - name: Build a binary wheel and a source tarball + run: >- + python -m + build + --sdist + --wheel + --outdir dist/ + - name: Publish distribution 📦 to Test PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + continue-on-error: true + with: + user: __token__ + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository_url: https://test.pypi.org/legacy/ + skip_existing: true + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} \ No newline at end of file diff --git a/README.md b/README.md index b44c7e9..6346e65 100644 --- a/README.md +++ b/README.md @@ -6,24 +6,17 @@ This repository contains core functions and classes used by the BALDR project (B ## Prerequisites -- Python 3.7+ +- Python 3.7 ## Installation -This section will assume you have: - -- installed Python 3.7 or higher; and -- cloned this repo - -With the above done, perform the following: - ``` -pip install +pip install riid ``` ### Data Directory (optional) -Some functions are usable only if you set the `PYRIID_DATA_DIR` environment variable to a path to some directory on your computer. +Some *convenience* functions are usable only if you set the `PYRIID_DATA_DIR` environment variable to a path to some directory on your computer. ## Examples @@ -48,8 +41,13 @@ Please make sure to update tests as appropriate and adhere to our [code of condu ## Authors +Current: + - **Tyler Morrow** - tmorro@sandia.gov - **Nathan Price** - njprice@sandia.gov + +Past: + - [Travis McGuire](https://github.com/traviemcg) - Original creator of the `PoissonBayes` model. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..9787c3b --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index 2123f4a..e3ab1d7 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,19 @@ +# Copyright 2021 National Technology & Engineering Solutions of Sandia, LLC (NTESS). +# Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government retains certain rights in this software. """Simple setup script for installing the core package. """ -from setuptools import setup, find_packages +import platform +import sys + +from setuptools import find_packages, setup + +python_version_min = (3, 7, 0) +python_version_max = (3, 7, 11) +required_python_version_str = '.'.join(map(str, python_version_min[:2])) +if python_version_min < sys.version_info > python_version_max: + print("You are using Python {}. Python =={} is required.".format(platform.python_version(), + required_python_version_str)) + sys.exit(-1) setup( name="riid", @@ -8,7 +21,7 @@ description="Machine learning-based models and utilities for radioisotope identification", author="Tyler Morrow,Nathan Price", author_email="tmorro@sandia.gov,njprice@sandia.gov", - url="https://www.sandia.gov", + url="https://github.com/sandialabs/PyRIID", packages=find_packages(), install_requires=[ "tensorflow==2.0.0", @@ -21,4 +34,22 @@ "tqdm", "seaborn==0.10.1" ], + # PyPI package information. + classifiers=[ + 'Development Status :: 5 - Production/Stable', + 'Intended Audience :: Developers', + 'Intended Audience :: Education', + 'Intended Audience :: Science/Research', + 'License :: OSI Approved :: BSD License', + 'Topic :: Scientific/Engineering', + 'Topic :: Scientific/Engineering :: Mathematics', + 'Topic :: Scientific/Engineering :: Artificial Intelligence', + 'Topic :: Software Development', + 'Topic :: Software Development :: Libraries', + 'Topic :: Software Development :: Libraries :: Python Modules', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.7' + ], + license='BSD-3', + keywords='pyriid riid machine learning', )