Skip to main content

tests lint

sync-settings-dotenv

A Python CLI to sync configs between dotenv files and Python settings module.

It allows to define your application settings in a Python module and use it as a source of truth, instead of maintaining both the settings module and multiple dotenv files manually.

Currently only supports BaseSettings model from pydantic-settings.

Prerequisites

  • uv installed

Installation

The tool can be installed using uv tool:

uv tool install sync-settings-dotenv

After installation, it will be available as sync-settings-dotenv command in your terminal.

Usage

For details on usage, run:

sync-settings-dotenv --help

Generate a .env.example from Python settings file

To generate a .env.example file from a Python settings file, run:

sync-settings-dotenv path.to.settings.Module path/to/.env.example --exact

This command will create a .env.example file with all environment variables defined in the specified settings module, using their default values.

A backup of the previous version will be created as .env.example.backup.timestamp if the file already exists.

Sync from Python settings file to .env file

sync-settings-dotenv path.to.settings.Module /path/to/.env

This command will generate or update the existing .env file with default values from the specified settings module. If the .env file already exists, it will only add missing variables without overwriting existing ones.

To overwrite existing values in the .env file, use the --overwrite-values flag:

sync-settings-dotenv path.to.settings.Module /path/to/.env --overwrite-values

Sync from .env.example file to .env file

It is also possible to sync from an existing .env.example file to a .env file:

sync-settings-dotenv /path/to/.env.example /path/to/.env

It works the same way as syncing from a Python settings file.

Known limitations

This approach only works with BaseSettings models from pydantic-settings.

The tool will execute the module to import the settings class, so any side effects in the module will be triggered.

It is assumed that the settings class can be instantiated without any required parameters other than those provided inside the module itself or via environment variables. Otherwise it will raise an error during execution.

Update and Uninstallation

To upgrade to the latest version, run:

uv tool upgrade sync-settings-dotenv

To uninstall the tool (noooo), run:

uv tool uninstall sync-settings-dotenv

Development

To set up the development environment, run:

make dev-setup

To verify all development checks:

make check-all

To install the tool in editable mode:

make local-install

Take a look at the Makefile for more commands to help with development and testing.

Metadata

Release files for sync-settings-dotenv 0.2.2

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

Source distribution (sdist)

Source distribution for sync-settings-dotenv 0.2.2
File Size Uploaded Provenance
sync_settings_dotenv-0.2.2.tar.gz 4.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for sync-settings-dotenv 0.2.2
File Interpreter ABI Platform
sync_settings_dotenv-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 10.7 kB

Release files / sync_settings_dotenv-0.2.2.tar.gz

Download URL sync_settings_dotenv-0.2.2.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b057f07ee6c193b213d6f37e85312aa8d07cb087d00c32efa2141525ace8ed00
BLAKE2b-256 checksum
How to use checksums
14450def844034cf1053fceeb5f1194da59f1d1f6bd07a7cc583501262040726
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.14 {"installer":{"name":"uv","version":"0.9.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / sync_settings_dotenv-0.2.2-py3-none-any.whl

Download URL sync_settings_dotenv-0.2.2-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3b20943e8e73325cab7e40969c5dc74381d0a2875265cd9d22d136488836dae5
BLAKE2b-256 checksum
How to use checksums
5921a31adc6b6ac667b1a833536947c7397db00c3fdc9d34096b83323813d38a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.14 {"installer":{"name":"uv","version":"0.9.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for sync-settings-dotenv 0.2.2

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.

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