Skip to main content

Press one key, ship your web app — detect FastAPI/Flask/Streamlit/Django and deploy to the cloud (stdlib-only engine).

Project description

publishkey — press one key, ship your web app

publishkey looks at your project, figures out what web framework it is (FastAPI, Flask, Streamlit, or Django), works out the right production start command, and deploys it to a cloud host — all from one command (and, soon, one keystroke inside VS Code).

This package is the engine: a small, zero-dependency Python core. Two "faces" sit on top of it — a CLI (in this package) and a VS Code extension (separate) — so the deploy logic is written once and shared.

        publishkey (Python engine)          ← this package
        detect framework · deploy
              ▲                 ▲
        CLI face          VS Code extension  ← the two UIs

Install

pip install publishkey            # once published
# or, for local development:
cd publishkey && pip install -e .

You also need the CLI of whichever provider you deploy to — e.g. Railway:

npm i -g @railway/cli && railway login

Use it

publishkey detect       # what framework is this folder?
publishkey init         # write a .publishkey.json for the project
publishkey providers    # which deploy targets are installed & logged in?
publishkey deploy       # detect → pre-flight checks → confirm → ship
publishkey deploy --yes # skip the confirmation prompt (for scripts/hotkeys)

Typical first run:

$ publishkey deploy
Project: .
  framework      fastapi  (high confidence)
  entry file     main.py
  start command  uvicorn main:app --host 0.0.0.0 --port $PORT

Deploy this fastapi to railway? [y/N] y
Deploying to railway ...
✓ Deploy started on Railway (wrote Procfile). Track it with `railway logs`.

What it detects

Framework Signal Start command it generates
FastAPI FastAPI( + import fastapi uvicorn <module>:<app> --host 0.0.0.0 --port $PORT
Flask Flask( gunicorn <module>:<app> --bind 0.0.0.0:$PORT
Streamlit import streamlit streamlit run <file> --server.port $PORT
Django manage.py + wsgi.py gunicorn <project>.wsgi --bind 0.0.0.0:$PORT

Detection is heuristic but deterministic — same folder in, same answer out. Override anything in .publishkey.json.

Configuration (.publishkey.json)

{
  "provider": "railway",
  "hotkey": "cmd+shift+p",
  "framework": "fastapi",
  "start_command": "uvicorn main:app --host 0.0.0.0 --port $PORT",
  "providers": { "railway": { "service": "web" } }
}

Everything is optional — with no config, publishkey auto-detects and uses Railway.

Providers

Providers are pluggable adapters over a real deployment CLI:

Provider CLI Notes
Railway railway Auto-creates the service; writes a Procfile for the start command.
Fly.io flyctl / fly Needs a fly.toml first (fly launch once); then fly deploy.

Adding another (Render, AWS App Runner, ...) is a small file — implement is_installed, is_authenticated, and deploy against the injectable command runner, then register it in providers/__init__.py. That runner is why the whole engine is unit-testable without ever spawning a real deploy. Buildpack hosts share the base class's ensure_procfile helper, so a new adapter is often just the CLI-specific glue.

Set the provider (and per-provider options) in .publishkey.json:

{ "provider": "fly", "providers": { "fly": { "app": "my-app" } } }

Design principles

  • Zero required dependencies — pure standard library, Python 3.8+.
  • Deterministic & testable — every shell-out goes through an injectable Runner; tests use a FakeRunner that scripts responses.
  • One engine, many faces — the CLI and the VS Code extension call the same functions; deploy logic lives in exactly one place.

Run the tests

python -m unittest discover -s tests

Publishing to PyPI

Releases go out via GitHub Actions using Trusted Publishing (OIDC) — no tokens stored. Bump version in pyproject.toml, then run the "Publish publishkey to PyPI" workflow from the Actions tab. One-time PyPI setup is documented in .github/workflows/publish-publishkey.yml.

Roadmap

  • VS Code extension face (native keybinding → the "publish key" experience).
  • More providers: Fly.io, Render, AWS App Runner.
  • Deploy history + one-click rollback (premium tier).
  • Env-var / secrets management UI (premium tier).

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

publishkey-0.1.1.tar.gz (18.3 kB view details)

Uploaded Source

Built Distribution

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

publishkey-0.1.1-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for publishkey-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f3dacf2044bba143eed313eea3b133c21da3a57deb3e6d9ab395af8c24b5c0a1
MD5 57e103478036551a13247d3f5c5889b1
BLAKE2b-256 b25e5a02f5e5625a54395544bc2a10f296c1f73773d0386e768663d1f4e87b3b

See more details on using hashes here.

Provenance

The following attestation bundles were made for publishkey-0.1.1.tar.gz:

Publisher: publish-publishkey.yml on Meet2147/pythonLibraries

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

File details

Details for the file publishkey-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: publishkey-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for publishkey-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bb981224db1faadc809d8eb6efc7696a7e3204bb9d3eb10bf0df5ef91c212f83
MD5 2a0c873e26b4e52df02e6dbbcb0aa9bb
BLAKE2b-256 fbe2cfd0a4a01e8538361990c0e58bc3ac2db3deca4cb9b54ac63079032e0f99

See more details on using hashes here.

Provenance

The following attestation bundles were made for publishkey-0.1.1-py3-none-any.whl:

Publisher: publish-publishkey.yml on Meet2147/pythonLibraries

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