Skip to main content

A light-weight bioinformatics package

Project description

krane

AWS Scholarship Capstone Project - A light-weight bioinformatics package

Folder structure

krane/
├── LICENSE
├── MANIFEST.in
├── README.md
├── dispatch.yaml                   # For GAE domain mapping
├── gae-deploy-flow.yml             # For GAE workflow (move to workflow)
├── krane.app.yaml                  # For GAE gloud deployment
├── pyproject.toml
├── requirements-dev.txt
├── requirements.txt
├── src
│   └── krane
│       ├── README.md
│       ├── __init__.py             # Package version and top-level imports       ├── cli
│          ├── __init__.py
│          └── commands.py         # CLI commands       ├── core
│          ├── __init__.py
│          ├── models.py           # Pydantic/data models          ├── sequence.py         # Core sequence analysis logic          └── utils.py
│       └── web
│           ├── __init__.py
│           ├── app.py              # FastAPI application setup           ├── documentation.md    # Markdown documentation           ├── index.md            # Markdown home description           ├── routes
│              ├── __init__.py
│              ├── sequence.py     # Sequence-related endpoints              └── utils.py        # Utility endpoints           ├── schemas
│              ├── __init__.py
│              └── sequence.py     # Request/Response models           ├── static
│              ├── css
│              ├── img
│              └── js
│           └── templates           # For web interface               ├── demo.html
│               ├── help.html
│               └── index.html
├── tests                           # For automated tests   ├── __init__.py
│   ├── test_cli.py
│   ├── test_core.py
│   └── test_web.py
└── tox.ini

Generate requirements.txt

Install pip-tools

pip install pip-tools

Generate requirements.txt from pyproject.toml

pip-compile pyproject.toml -o requirements.txt

Generate dev requirements (includes test dependencies)

pip-compile pyproject.toml --extra dev --extra test -o requirements-dev.txt

Install package

Dev mode

python3 -m pip install --editable .

How to use krane

pip install krane

Install the package in development mode:

pip install -e .

Run web application

Using the installed command

krane-web

Running directly with uvicorn

uvicorn krane.web.app:app --reload

Use command line

Analyze a sequence

krane analyze ATCG --type DNA --label "Test"

Generate random sequence

krane generate --length 20 --type DNA

Read FASTA file

krane read-fasta sequence.fasta

Automated Test

Install test dependencies

pip install -e ".[test]"

Run all tests

pytest

Run with verbose output

pytest -v

Run with coverage report

pytest --cov=krane

Run all tests together

pytest tests/ -v

Run specific test file

pytest tests/test_web.py
pytest tests/test_core.py

Run tests matching a pattern

pytest -k "test_sequence"

Deployment Process

Deployment to Pypi

  • Create PyPI account and get API token
  • Add PYPI_API_TOKEN to GitHub repository secrets

For PyPI

# Tag a new version by creating annotated tags
# git tag -a v0.1.0 -m "Release version v0.1.0" 
# git tag -a v0.1.0 -m "Version 0.1.0" # setuptools_scm does not recognize lightweight tags
git tag -a v0.1.0 -m "Release version 0.1.0" # setuptools_scm does not recognize lightweight tags
# Push the Specific Tag to Remote
git push origin v0.1.0
# Push all tags to the remote
git push --tags --force  # Push updated tags to remote
# This triggers PyPI workflow

Debug tag

git ls-remote --tags origin
git push origin --delete v0.1.0 # Deletes a tag named v0.1.0 from the remote repository named origin
git fetch --prune origin # Removes any remote-tracking references in local that no longer exist in the remote.
git tag
git tag -l | xargs git tag -d # Removes local tag
git show v0.1.0
git tag -d v0.1.1 v0.1.0

Force update tag locally first:

git tag -f v0.1.0 <local-commit-hash>
git push -f origin v0.1.0

Deployment to GAE

  • Create Google Cloud project
  • Create service account with App Engine Admin role
  • Download JSON key
  • Add to GitHub secrets:
  • GCP_PROJECT_ID: Your project ID
  • GCP_SA_KEY: The entire JSON key content

For Google App Engine:

# Push to main branch
git push origin main

# This triggers GAE workflow

Testing the deployments

After PyPI deployment:

# In a new virtual environment
pip install krane

# Test library
python -c "from krane.core import Sequence; print(Sequence('ATCG', 'DNA').transcription())"

# Test CLI
krane --help

After GAE deployment:

# Your app will be available at
https://krane.barestripe.com/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

krane-0.1.2.tar.gz (3.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

krane-0.1.2-py3-none-any.whl (3.6 MB view details)

Uploaded Python 3

File details

Details for the file krane-0.1.2.tar.gz.

File metadata

  • Download URL: krane-0.1.2.tar.gz
  • Upload date:
  • Size: 3.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for krane-0.1.2.tar.gz
Algorithm Hash digest
SHA256 3aea3ac5bcaec48f5f553530fd17c2e52d0dccfe8eaa2f39b32de12dd6c3b943
MD5 68209b594ff53f652bc3e18b59f6a424
BLAKE2b-256 bd41cfb0b84bba873f5e70f8ced2c87b7945070a381ab79eb67059c0661421bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for krane-0.1.2.tar.gz:

Publisher: pypi-deploy-flow.yml on callezenwaka/krane

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file krane-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: krane-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for krane-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 95e50178a22f50256406c46f5559ab1e361f0a5f5220bd3b44fdf69b0a938524
MD5 c951c13539178fb0d5d27254fdb8fc83
BLAKE2b-256 70dd64516c5d98f2769d6404f595c5dab0850ceafa66db52c5a1a15894c37aff

See more details on using hashes here.

Provenance

The following attestation bundles were made for krane-0.1.2-py3-none-any.whl:

Publisher: pypi-deploy-flow.yml on callezenwaka/krane

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page