Skip to main content

PyPI PyPI - Python Version GitHub all releases GitHub license PyPI - Implementation PyPI - Wheel PyPI - Status GitHub issues GitHub forks GitHub stars

Fullapp Notes


This combines the learning from these repos into one app;

  • fastapi_play
  • alembic_play
  • sqlalchemy_play
  • pydantic_play

Development log

Create minimal app

Python packages

  • Added the following to requirements.in;
alembic
fastapi[all]
pydantic
psycopg2
SQLAlchemy
sqlalchemy[mypy]
  • Then ran;
pip-compile requirements.in
pip-compile requirements_dev.in
pip-sync requirements.txt requirements_dev.txt 

Docker test db

  • Created docker-compose.yml - see the "Connecting to the test DB" section below

  • Created the app's test db;

docker-compose up
  • Add db/pgdata to .gitignore

Alembic setup

  • Initialise Alembic;
alembic init alembic
  • In alembic.ini update config for docker DB;
sqlalchemy.url = postgresql+psycopg2://play:play@localhost:5440/alembicplay
  • In alembic.ini uncomment file_template line as migration file default naming is pretty awful
file_template = %%(year)d_%%(month).2d_%%(day).2d_%%(hour).2d%%(minute).2d-%%(rev)s_%%(slug)s
  • Setup Alembic to find the app's ORM by changing target_metadata = None in alembic/env.py to;
from src.fullapp.apporm import Base
target_metadata = Base.metadata
  • Added initial ORM file; src/fullapp/apporm.py

  • Auto-generated migration using metadata created in apporm.py and apply it;

alembic revision --autogenerate -m "Bring in initial app orm"
alembic upgrade head

FastAPI setup

  • Added this to src/fullapp/myapp.py;
from fastapi import FastAPI

app = FastAPI()


@app.get("/")
async def root():
    return {"message": "Hello World"}

Installing

  • Run;
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install wheel pip-tools
pip-sync requirements.txt requirements_dev.txt
  • Create the app db;
docker-compose up
alembic upgrade head

Usage

FastAPI app server

  • Run the app server;
uvicorn src.fullapp.myapp:app --reload

Notes

Connecting to the test DB

  • Can connect using;
psql -hlocalhost -p5444 -dtestdb -Uappuser # with password 'generic'

Releasing to PyPI

How I did it this time

Initial upload to Test PyPI

  • Upload using Test PyPI global scope API key;
python3 -m pip install --upgrade twine # Maybe I should add twine to requirements_dev.in?
python3 -m build
python3 -m twine upload --repository testpypi dist/*
    # user name = __token__
    # For p/w, get "API token - Global scope" in 1Password "TestPyPI - grumBit" item 

Set up project specific token

  • Create a new token specifically for the project;
    • Head to Test PtPI -> Manage for fullapp -> Settings -> Create a token for fullapp
    • Set Token name to fullapp
    • Change the Scope to "Project: fullapp`
    • Click Add Token
    • Add the generated token in a new password field named '🔑 API Token - "fullapp"' in the 1Password "TestPyPI - grumBit" item
  • Test the new token by running python3 -m pip install --upgrade twine again, but with the new token

Test uploaded project

  • In a new directory, create a new python venv;
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install wheel pip-tools
  • Install the new project;
package_name="fullapp"
python3 -m pip install --index-url https://test.pypi.org/simple/ --pre ${package_name}  # Check the package can be installed
python3 -c "from fullapp import myapp" # Check package functions

Add the TestPyPi and PyPi API tokens to the repo

  • Open the repo on github -> Settings -> Secrets and variables -> Actions -> New respository secret
  • Name = "TEST_PYPI_API_TOKEN"
  • Secret = The project's API token form the 1Password "TestPyPI - grumBit" item

Metadata

Release files for fullapp 0.0.5

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

Source distribution (sdist)

Source distribution for fullapp 0.0.5
File Size Uploaded Provenance Actions
fullapp-0.0.5.tar.gz 7.1 kB Without provenance Details for fullapp-0.0.5.tar.gz

Built distribution (wheel)

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

Total release size: 13.5 kB

Release files / fullapp-0.0.5.tar.gz

Download URL fullapp-0.0.5.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
85d88f26e3ac0484f6eb25c783f467da4bbc0faa9e190f61eefb8f420c7b2672
BLAKE2b-256 checksum
How to use checksums
e61bd6a701cd2bda5ae123ddad91f9ce2e35f2bf0c9350c743cb8b0d0e031fc7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release files / fullapp-0.0.5-py3-none-any.whl

Download URL fullapp-0.0.5-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
24a27386b08f48068183a8f8f47e4a048101ade1c0e5e9d38417acf833932070
BLAKE2b-256 checksum
How to use checksums
f6bebaa6582262f7829a67f8e8dc1d62ba2a25d397a8cddd5ea1b3c3dff40a13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Security for fullapp 0.0.5

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files No provenance

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