-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from monarch-initiative/setup-release-workflow
Setup release workflow
- Loading branch information
Showing
17 changed files
with
205 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,25 +8,22 @@ on: | |
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
- windows-latest | ||
- macOS-latest | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Initialize Python ${{ matrix.python }} | ||
- uses: actions/checkout@v4 | ||
- name: Initialize Python 3.11 | ||
uses: actions/[email protected] | ||
with: | ||
python-version: "3.11" | ||
- name: Install package | ||
run: | | ||
python3 -m pip install .[test] | ||
python3 -m pip install .[test,docs] | ||
- name: Run pytest tests | ||
run: | | ||
pytest | ||
- name: Run documentation tests | ||
run: | | ||
cd docs | ||
sphinx-apidoc --separate --module-first -d 2 -H "API reference" -o apidocs ../src/genophenocorr | ||
make doctest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# How to release | ||
|
||
The document describes how to release `genophenocorr` to *PyPi*. | ||
|
||
## Release checklist | ||
|
||
- update documentation and notebooks to present the latest features | ||
- create and checkout a release branch | ||
- remove deprecated methods targeted for removal in this version. The `TODO` markers are labeled using | ||
the target version (e.g. `TODO[v0.3.0]`) | ||
- bump versions to a release: | ||
- `src/genophenocorr/__init__.py` | ||
- `docs/conf.py` | ||
- ensure the CI passes | ||
- deploy to PyPi (described below) | ||
- merge to `main` | ||
- create a GitHub release from the latest `main` commit, including a new tag | ||
- merge `main` to `develop` | ||
- bump versions to a `dev` version to begin next development iteration | ||
|
||
## Deploy to PyPi | ||
|
||
### Virtual environment for deployment | ||
|
||
As an optional one-time step, consider creating a dedicated virtual environment with the packages required | ||
for testing, building, and deployment: | ||
|
||
```shell | ||
# Create and activate the virtual environment | ||
python3 -m venv build | ||
source build/bin/activate | ||
|
||
# Install the build packages | ||
python3 -m pip install build twine | ||
``` | ||
|
||
### Setup PyPi credentials | ||
|
||
As another one-time action, you must create a profile on PyPi and generate an access token. | ||
The token is used to upload the packages. | ||
|
||
First, create an account (e.g. associated with your GitHub account), configure 2FA, store recovery codes, etc. | ||
Then, generate a token to upload the packages. You can generate a token per project or for all projects. | ||
Store the token into `$HOME/.pypirc` file with `-rw-------` permissions. The file should look like: | ||
|
||
``` | ||
[pypi] | ||
username = __token__ | ||
password = <YOUR-TOKEN-HERE> | ||
``` | ||
|
||
Now we're ready to publish packages! | ||
|
||
### Deploy | ||
Run the following to deploy `genophenocorr` to PyPi: | ||
|
||
```bash | ||
# Ensure you're on the release branch | ||
cd genophenocorr | ||
|
||
# Build the package | ||
python3 -m build | ||
|
||
# Deploy | ||
python3 -m twine upload dist/* | ||
|
||
# Clear the built and deployed files | ||
rm -rf build dist | ||
``` | ||
|
||
The commands will build source distribution and a wheel, and deploy the source distribution and wheel to PyPi. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,41 @@ | ||
# Genophenocorr | ||
# [![CI](https://github.com/monarch-initiative/genophenocorr/workflows/CI/badge.svg)](https://github.com/monarch-initiative/genophenocorr/actions/workflows/python_ci.yml) | ||
[![Build status](https://github.com/monarch-initiative/genophenocorr/workflows/CI/badge.svg)](https://github.com/monarch-initiative/genophenocorr/actions/workflows/python_ci.yml) | ||
![PyPi downloads](https://img.shields.io/pypi/dm/genophenocorr.svg?label=Pypi%20downloads) | ||
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/genophenocorr) | ||
|
||
A Python library for genotype-phenotype association analysis. | ||
Genophenocorr is a Python library for genotype-phenotype association analysis. | ||
|
||
An example of simple genotype-phenotype association analysis | ||
```python | ||
# Load HPO | ||
import hpotk | ||
hpo = hpotk.load_minimal_ontology('http://purl.obolibrary.org/obo/hp.json') | ||
|
||
# Set up | ||
# Load a cohort of phenopackets | ||
from genophenocorr.data import get_toy_cohort | ||
cohort = get_toy_cohort() | ||
|
||
Create a virtual environment. This is an optional step, otherwise the package will be installed into the active | ||
Python environment. | ||
# Analyze genotype-phenotype associations | ||
from genophenocorr.analysis import CohortAnalysis | ||
from genophenocorr.constants import VariantEffect | ||
|
||
```shell | ||
python3 -m venv venv | ||
source venv/bin/activate | ||
cohort_analysis = CohortAnalysis(cohort, 'NM_1234.5', hpo) | ||
frameshift = cohort_analysis.compare_by_variant_type(VariantEffect.FRAMESHIFT_VARIANT) | ||
print(frameshift) | ||
``` | ||
|
||
Install the package into the environment: | ||
prints a table with genotype-phenotype correlations: | ||
|
||
```shell | ||
python3 -m pip install genophenocorr | ||
```text | ||
With frameshift_variant Without frameshift_variant | ||
Count Percent Count Percent p-value | ||
HP:0001166 (Arachnodactyly) 4 30.77% 10 76.92% 0.04718 | ||
HP:0001250 (Seizure) 11 84.62% 9 69.23% 0.64472 | ||
HP:0001257 (Spasticity) 8 61.54% 9 69.23% 1.00000 | ||
``` | ||
|
||
# Run tests | ||
## Documentation | ||
|
||
Tests can be run after checking the source code from GitHub and installing the test dependencies: | ||
Check out the User guide and the API reference for more info: | ||
|
||
```shell | ||
cd genophenocorr | ||
python3 -m pip install .[test] | ||
|
||
pytest | ||
``` | ||
|
||
# Build documentation | ||
|
||
First, make sure you have the necessary dependencies: | ||
|
||
```shell | ||
cd genophenocorr | ||
python3 -m pip install .[docs] | ||
``` | ||
Setting up dependencies is a one-time action for a given Python environment. | ||
|
||
Next, we can run the doc tests and build the HTML documentation: | ||
|
||
```shell | ||
cd docs | ||
|
||
# Generate the API reference from Python docstrings | ||
sphinx-apidoc --separate --module-first -d 2 -H "API reference" --follow-links -o apidocs ../src/genophenocorr | ||
|
||
# Run the doc tests and build the documentation | ||
make doctest html | ||
``` | ||
|
||
The code above will run the documentation and fail if the docs are out of sync with the code. | ||
Then, the docs will be built at `docs/build/html` | ||
- [Stable documentation](https://thejacksonlaboratory.github.io/genophenocorr/stable) (last release on `main` branch) | ||
- [Latest documentation](https://thejacksonlaboratory.github.io/genophenocorr/latest) (bleeding edge, latest commit on `development` branch) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.