diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..03336c3 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,118 @@ +name: Publish Python package to PyPI and TestPyPI + +on: push + +jobs: + build: + name: Build distribution package + runs-on: "ubuntu-latest" + + steps: + - name: Checkout source + uses: actions/checkout@v4 + + - name: Set up Python 3.7 + uses: actions/setup-python@v4 + with: + python-version: "3.7" + + - name: Install pypa/build + run: python3 -m pip install build --user + + - name: Build a binary wheel and a source tarball + run: cd draw_rna && python3 -m build + + - name: Store the distribution packages + uses: actions/upload-artifact@v3 + with: + name: python-package-distributions + path: draw_rna/dist/ + + publish-to-pypi: + name: >- + Publish Python distribution to PyPI + if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes + needs: + - build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/rdat-kit # Replace with your PyPI project name + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + + steps: + - name: Download all the dists + uses: actions/download-artifact@v3 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + + publish-to-testpypi: + name: Publish Python distribution to TestPyPI + needs: + - build + runs-on: ubuntu-latest + + environment: + name: testpypi + url: https://test.pypi.org/p/rdat-kit + + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + + steps: + - name: Download all the dists + uses: actions/download-artifact@v3 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + + github-release: + name: >- + Sign the Python distribution with Sigstore + and upload them to GitHub Release + needs: + - publish-to-pypi + runs-on: ubuntu-latest + + permissions: + contents: write # IMPORTANT: mandatory for making GitHub Releases + id-token: write # IMPORTANT: mandatory for sigstore + + steps: + - name: Download all the dists + uses: actions/download-artifact@v3 + with: + name: python-package-distributions + path: dist/ + - name: Sign the dists with Sigstore + uses: sigstore/gh-action-sigstore-python@v1.2.3 + with: + inputs: >- + ./dist/*.tar.gz + ./dist/*.whl + - name: Create GitHub Release + env: + GITHUB_TOKEN: ${{ github.token }} + run: >- + gh release create + '${{ github.ref_name }}' + --repo '${{ github.repository }}' + --notes "" + - name: Upload artifact signatures to GitHub Release + env: + GITHUB_TOKEN: ${{ github.token }} + # Upload to GitHub Release using the `gh` CLI. + # `dist/` contains the built packages, and the + # sigstore-produced signatures and certificates. + run: >- + gh release upload + '${{ github.ref_name }}' dist/** + --repo '${{ github.repository }}' diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..9916624 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Leland Stanford Junior University + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index eefeae9..89348f6 100644 --- a/README.md +++ b/README.md @@ -9,16 +9,15 @@ A communal and continuing effort by the Das Lab, Eterna Players, M. Wu, H. Wayme The default behavior is to output the secondary structure visualization to both svg and png. The png requires Inkscape, whose directory must be set by environmental variable `INKSCAPEDIR`. ## Install +`draw_rna` is [available on PyPI](https://pypi.org/project/draw-rna/). -Clone this repository to your hard drive and install as follows: +`pip install draw_rna` -``` -git clone git@github.com:DasLab/draw_rna.git -cd draw_rna/ -python setup.py install -``` +Alternatively, clone the Github repository to your hard drive as follows: + +`git clone git@github.com:DasLab/draw_rna.git` -*Warning* if you see errors in using the repository, it maybe due to your `draw_rna` directory sitting in a folder like `src/` which already is in your Python Path. in that case, *rename* `draw_rna` to `draw_rna_directory` and/or move it to another spot in your system. +*Warning* if you see errors in using the repository, it may be due to your `draw_rna` directory sitting in a folder like `src/` which already is in your Python Path. in that case, *rename* `draw_rna` to `draw_rna_directory` and/or move it to another spot in your system. ## Basic Usage diff --git a/draw_rna/__init__.py b/draw_rna/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/ipynb/__init__.py b/ipynb/__init__.py deleted file mode 100644 index 8d1c8b6..0000000 --- a/ipynb/__init__.py +++ /dev/null @@ -1 +0,0 @@ - diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..3ed11ef --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,28 @@ +[project] +name = "draw_rna" +version = "0.1.1" +authors = [ + { name="Das Lab", email="thedaslab@stanford.edu" }, +] +description = "Draw RNA secondary structures in Python" +readme = "README.md" +requires-python = ">=3.7" +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", +] +dependencies = [ + "argparse>=1.4", + "numpy>=1.15", + "matplotlib>=3.2", + "rdat-kit>=1.6" +] + +[project.urls] +"Homepage" = "https://github.com/DasLab/draw_rna" +"Bug Tracker" = "https://github.com/DasLab/draw_rna/issues" + +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" \ No newline at end of file diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index d2b22c9..0000000 --- a/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -RDATkit (for draw_from_rdat.py) - diff --git a/setup.py b/setup.py deleted file mode 100644 index 8494039..0000000 --- a/setup.py +++ /dev/null @@ -1,6 +0,0 @@ -from setuptools import setup, find_packages -setup( - name="draw_rna", - version="0.1", - packages=find_packages(), -) diff --git a/__init__.py b/src/draw_rna/__init__.py similarity index 100% rename from __init__.py rename to src/draw_rna/__init__.py diff --git a/draw_rna/draw.py b/src/draw_rna/draw.py similarity index 100% rename from draw_rna/draw.py rename to src/draw_rna/draw.py diff --git a/draw_rna/draw_all.py b/src/draw_rna/draw_all.py similarity index 100% rename from draw_rna/draw_all.py rename to src/draw_rna/draw_all.py diff --git a/draw_rna/draw_from_rdat.py b/src/draw_rna/draw_from_rdat.py similarity index 100% rename from draw_rna/draw_from_rdat.py rename to src/draw_rna/draw_from_rdat.py diff --git a/draw_rna/draw_utils.py b/src/draw_rna/draw_utils.py similarity index 100% rename from draw_rna/draw_utils.py rename to src/draw_rna/draw_utils.py diff --git a/draw_rna/inv_utils.py b/src/draw_rna/inv_utils.py similarity index 100% rename from draw_rna/inv_utils.py rename to src/draw_rna/inv_utils.py diff --git a/ipynb/draw.py b/src/draw_rna/ipynb_draw.py similarity index 100% rename from ipynb/draw.py rename to src/draw_rna/ipynb_draw.py diff --git a/draw_rna/mpl.py b/src/draw_rna/mpl.py similarity index 100% rename from draw_rna/mpl.py rename to src/draw_rna/mpl.py diff --git a/draw_rna/render_rna.py b/src/draw_rna/render_rna.py similarity index 100% rename from draw_rna/render_rna.py rename to src/draw_rna/render_rna.py diff --git a/draw_rna/render_rna_flip.py b/src/draw_rna/render_rna_flip.py similarity index 100% rename from draw_rna/render_rna_flip.py rename to src/draw_rna/render_rna_flip.py diff --git a/draw_rna/svg.py b/src/draw_rna/svg.py similarity index 100% rename from draw_rna/svg.py rename to src/draw_rna/svg.py