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
├── noxfile.py                      
├── 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.1.tar.gz (16.1 kB 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.1-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for krane-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5f699597a131ec8dfa0f973f1930f947c9e4462aa04953de78c5b2f88e3c7ed4
MD5 7e143b528797840047eeb818390cd1b3
BLAKE2b-256 f69e7263457f199f4b12aa1524e31d241d8d493e470f2176563451069b56e446

See more details on using hashes here.

Provenance

The following attestation bundles were made for krane-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: krane-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 30be6b9bc560296ffa1f8862f8659e29fd97300c23b1383eae42480cda8aca16
MD5 19158484fa32d462890de65549432ec1
BLAKE2b-256 9d60ff4c200a2db9020fbfa31e1f87bdb4939388bdbfdb9a4561095b0368a7e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for krane-0.1.1-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