From a93a30119d6ed27bc7a9e7954446ed9acaddf9b4 Mon Sep 17 00:00:00 2001 From: Ian Kenney Date: Fri, 13 Oct 2023 15:36:11 -0700 Subject: [PATCH] Automatic deployment to PyPI on release (#3) * Use MDAnalysis deployment action * Updated docs to reflect PyPI installations --- .github/workflows/deploy.yaml | 37 +++++++++++++++++++++++++++++++ README.md | 10 +++++++++ devtools/conda-envs/test_env.yaml | 4 ++++ docs/source/getting_started.rst | 31 ++++++++++++++++++++++++-- pyproject.toml | 9 +++++--- 5 files changed, 86 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/deploy.yaml diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 0000000..fb1ee1d --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -0,0 +1,37 @@ +name: Build and upload to PyPi + +on: + push: + tags: + - "*" + release: + types: + - published + +jobs: + pypi_push: + environment: deploy + if: "github.repository == 'MDAnalysis/PathSimAnalysis'" + name: Build, upload and test pure Python wheels + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: testpypi_deploy + uses: MDAnalysis/pypi-deployment@main + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + with: + token: ${{ secrets.TEST_PYPI_API_TOKEN }} + test_submission: true + tests: true + test_deps: 'pytest MDAnalysisTests' + package_name: 'pathsimanalysis' + + - name: pypi_deploy + uses: MDAnalysis/pypi-deployment@main + if: github.event_name == 'release' && github.event.action == 'published' + with: + token: ${{ secrets.PYPI_API_TOKEN }} + package_name: 'pathsimanalysis' + tests: false \ No newline at end of file diff --git a/README.md b/README.md index ba46a8b..ee1a7f9 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,16 @@ conda deactivate #### With pip +##### Install from PyPI + +The latest release of PathSimAnalysis is available on [PyPI](https://pypi.org/project/pathsimanalysis/) and can be installed with: + +``` +pip install pathsimanalysis +``` + +##### Install from source + To build the package from source, run: ``` diff --git a/devtools/conda-envs/test_env.yaml b/devtools/conda-envs/test_env.yaml index 0ed4cd2..520fe92 100644 --- a/devtools/conda-envs/test_env.yaml +++ b/devtools/conda-envs/test_env.yaml @@ -9,6 +9,10 @@ dependencies: # MDAnalysis - MDAnalysis + - scipy>=1.5.0 + - matplotlib>=1.5.1 + - numpy>=1.22.3 + # Testing - MDAnalysisTests diff --git a/docs/source/getting_started.rst b/docs/source/getting_started.rst index dfd56bb..0e0fb48 100644 --- a/docs/source/getting_started.rst +++ b/docs/source/getting_started.rst @@ -6,10 +6,37 @@ This page details how to get started with PathSimAnalysis. Installation ------------ -PathSimAnalysis is currently only installable from source. +PyPi +~~~~ + +PathSimAnalysis can be installed from PyPI with: + +.. code-block:: bash + + pip install pathsimanalysis + +If you would like to test your installation, use the `test` optional dependencies and run the tests: + +.. code-block:: bash + + pip install "pathsimanalysis[test]" + pytest --pyargs pathsimanalysis.tests + +From source +~~~~~~~~~~~ + +If you want the latest (non-release) version of PathSimAnalysis, you should install the package from source. .. code-block:: bash git clone --depth=1 https://github.com/MDAnalysis/PathSimAnalysis cd PathSimAnalysis - pip install . \ No newline at end of file + pip install . + +If you want to run tests on your installation, install the `test` dependencies and run the tests: + +.. code-block:: bash + + pip install ".[test]" + pytest --pyargs pathsimanalysis.tests + diff --git a/pyproject.toml b/pyproject.toml index cdfb6b1..b63f464 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,6 +19,9 @@ readme = "README.md" requires-python = ">=3.9" dependencies = [ "MDAnalysis>=2.0.0", + "scipy>=1.5.0", + "matplotlib>=1.5.1", + "numpy>=1.22.3", ] keywords = [ "molecular simulations", @@ -39,9 +42,9 @@ doc = [ "sphinx_rtd_theme", ] -# [project.urls] -# source = "https://github.com/MDAnalysis/pathsimanalysis" -# documentation = "https://pathsimanalysis.readthedocs.io" +[project.urls] +source = "https://github.com/MDAnalysis/pathsimanalysis" +documentation = "https://mdanalysis.org/PathSimAnalysis" [tool.pytest.ini_options] minversion = "6.0"