Skip to main content

Inspari configuration utilities

Project description

This repository provides Python configuration utilities.

Usage

The most common usage pattern is to create a config.py file that defines the configuration. The configuration itself is parsed from environment variables. They are typically read from a .env file during local development.

A minimal example is bundled, with the configuration defined in example_config.py, a few variables in example.env, and the typical access pattern (i.e. how settings are access in application code) illustrated in example_usage.py.

Usage with Keyvault

An especially nice features is the ability to refer to secrets in a Keyvault without committing them to git. All you need to do is add a variable to your .env file like

MY_SECRET="@Microsoft.KeyVault(VaultName=<keyvaultname>,SecretName=<my-secret>)"

where keyvaultname is the name (not fqdn) of a keyvault that you have access to eg. by doing az login and my-secret is the relevant name of the secret. Remember that keys can not have underscores but dashes are allowed, whereas it's the opposite for the environment variables.

Development

Create a new Python environment with all dependencies installed,

poetry install

That's it! You can validate that the environment is setup correctly by running the tests,

poetry run coverage run -m pytest

Deployment

Update the version in pyproject.toml, run poetry lock, and add a new entry in CHANGELOG.md.

Automatic (preferred)

Merge the changes into master (using PRs). Create a new tag. If the new version is 1.1.1, the new tag would be v1.1.1.

The tag creation will trigger automated deployment of the package to PyPi, as well as synchronization of the code with the public GitHub mirror repository.

Manual (not recommended)

Build the project via Poetry,

poetry build

and push it to pypi,

poetry publish -u __token__ -p $INSPARI_PYPI_TOKEN

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

inspari_config-0.1.7.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

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

inspari_config-0.1.7-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file inspari_config-0.1.7.tar.gz.

File metadata

  • Download URL: inspari_config-0.1.7.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.12.3 Linux/6.14.0-1017-azure

File hashes

Hashes for inspari_config-0.1.7.tar.gz
Algorithm Hash digest
SHA256 00f7e69e4e6f15426d9e7c212e875b0af32dca1e552d20e4fd2d67683fbde279
MD5 e66317927de6fac38634a5199d9d3bd8
BLAKE2b-256 3a7cccaefb85b3ae6375ad51545fdd7cf031f148527540ddd0d68600289e2762

See more details on using hashes here.

File details

Details for the file inspari_config-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: inspari_config-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.12.3 Linux/6.14.0-1017-azure

File hashes

Hashes for inspari_config-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 423a0c47982c4d6eb55f63b91533ab1605b573cd48483c4850f33ec771c40300
MD5 1d725523ab1c1314b8b419750aeef5af
BLAKE2b-256 c7e0a3bbf83c710b1063ff2178326d1d5af6566bce718880e31d35ce3b0b4567

See more details on using hashes here.

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