Skip to main content

FastAPI Global Variable

How to use

  1. Set a variable
# user_service.py
from fastapi import FastAPI
from fastapi_global_variable import GlobalVariable

app = FastAPI(title="Application")

GlobalVariable.set('app', app)
  1. Use variable
from fastapi_global_variable import GlobalVariable

print(GlobalVariable.get_or_fail('app'))
print(GlobalVariable.get('app'))

How to test in testpypi

  1. Increase the version in pyproject.toml
  2. Run command
$ . ./build_and_test.sh

How to publish new version

  1. Increase the version in pyproject.toml
  2. Run command
$ . ./build_and_publish.sh

Metadata

Release files for fastapi-global-variable 0.0.4

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

Source distribution (sdist)

Source distribution for fastapi-global-variable 0.0.4
File Size Uploaded
fastapi_global_variable-0.0.4.tar.gz 3.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fastapi-global-variable 0.0.4
File Interpreter ABI Platform
fastapi_global_variable-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 6.7 kB

Release files / fastapi_global_variable-0.0.4.tar.gz

Download URL fastapi_global_variable-0.0.4.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
733638e0bf29de1efb2b3a0d7835a4e23044100e5af078d235511fde3348bc88
BLAKE2b-256 checksum
How to use checksums
97519061a84743820af8ef18fe991de7c113c01388dc557319a3e029b22313b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release files / fastapi_global_variable-0.0.4-py3-none-any.whl

Download URL fastapi_global_variable-0.0.4-py3-none-any.whl
Size 2.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
adf25fe03c5fccaae9590e2a1c2e628e18e95033e07ef00871bb82ae764ad215
BLAKE2b-256 checksum
How to use checksums
bedc6cd330a24e129b27b6d389a300d73fc9af135003cb7c40e2e9149e5ec727
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

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