Skip to main content

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/

Metadata

Release files for krane 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for krane 0.1.2
File Size Uploaded Provenance Actions
krane-0.1.2.tar.gz 3.6 MB With provenance Details for krane-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for krane 0.1.2
File Interpreter ABI Platform Actions
krane-0.1.2-py3-none-any.whl Python 3 none any Details for krane-0.1.2-py3-none-any.whl

Total release size: 7.3 MB

Release files / krane-0.1.2.tar.gz

Download URL krane-0.1.2.tar.gz
Size 3.6 MB
Tags Source
SHA-256 checksum
How to use checksums
3aea3ac5bcaec48f5f553530fd17c2e52d0dccfe8eaa2f39b32de12dd6c3b943
BLAKE2b-256 checksum
How to use checksums
bd41cfb0b84bba873f5e70f8ced2c87b7945070a381ab79eb67059c0661421bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 24, 2025.

Transparency log

Release files / krane-0.1.2-py3-none-any.whl

Download URL krane-0.1.2-py3-none-any.whl
Size 3.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
95e50178a22f50256406c46f5559ab1e361f0a5f5220bd3b44fdf69b0a938524
BLAKE2b-256 checksum
How to use checksums
70dd64516c5d98f2769d6404f595c5dab0850ceafa66db52c5a1a15894c37aff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 24, 2025.

Transparency log

Security for krane 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for krane-0.1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 24, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page