FastAPI Global variable
Project description
FastAPI Global Variable
How to use
- Set a variable
# user_service.py
from fastapi import FastAPI
from fastapi_global_variable import GlobalVariable
app = FastAPI(title="Application")
GlobalVariable.set('app', app)
- Use variable
from fastapi_global_variable import GlobalVariable
print(GlobalVariable.get_or_fail('app'))
print(GlobalVariable.get('app'))
How to test in testpypi
- Increase the version in
pyproject.toml
- Run command
$ . ./build_and_test.sh
How to publish new version
- Increase the version in
pyproject.toml
- Run command
$ . ./build_and_publish.sh
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for fastapi_global_variable-0.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8687ffe779d6ab312db5bd30170e6ee9ebdbeac46e01de35b70e40df780cd14e |
|
MD5 | 03567f1d6ad56893d566eaa27b57625e |
|
BLAKE2b-256 | df96f1e06d947d49ada3b1377fb64094b484a28d5ff73042bcd78acfa4cc8621 |
Close
Hashes for fastapi_global_variable-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b21b074c4b73ebd329f35b2f78e7469d3f4687483bfeec184a31d5b7dde5297 |
|
MD5 | fdff020157e0ef2982f8e32c78786d01 |
|
BLAKE2b-256 | 04aaeed2d89fee2391e73bf88fc71c9243bdd07ee9ba1aa060b3e6117ea78eb2 |