vaultconfig 0.2.0__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vaultconfig-0.3.0/.codecrate.toml +14 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/.github/workflows/pre-commit.yml +2 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/.github/workflows/tests.yml +1 -1
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/.gitignore +2 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/.pre-commit-config.yaml +19 -18
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/.ruff.toml +1 -1
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/LICENSE +1 -1
- vaultconfig-0.3.0/MANIFEST.in +7 -0
- vaultconfig-0.3.0/PKG-INFO +160 -0
- vaultconfig-0.3.0/README.md +121 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/docs/Makefile +2 -2
- vaultconfig-0.3.0/docs/api.md +76 -0
- vaultconfig-0.3.0/docs/architecture.md +195 -0
- vaultconfig-0.3.0/docs/changelog.md +37 -0
- vaultconfig-0.3.0/docs/cli.md +113 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/docs/conf.py +7 -1
- vaultconfig-0.3.0/docs/examples.md +75 -0
- vaultconfig-0.3.0/docs/index.md +53 -0
- vaultconfig-0.3.0/docs/installation.md +57 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/docs/make.bat +2 -1
- vaultconfig-0.3.0/docs/make.py +61 -0
- vaultconfig-0.3.0/docs/quickstart.md +96 -0
- vaultconfig-0.3.0/docs/requirements.txt +2 -0
- vaultconfig-0.3.0/docs/secrets.md +143 -0
- vaultconfig-0.3.0/docs/security.md +86 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/examples/ini_config/example.py +5 -8
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/examples/toml_config/example_advanced.py +0 -6
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/pyproject.toml +20 -4
- vaultconfig-0.3.0/requirements-test.txt +2 -0
- vaultconfig-0.3.0/tests/test_cli.py +1311 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/tests/test_config.py +373 -3
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/tests/test_crypt.py +80 -5
- vaultconfig-0.3.0/tests/test_env_export.py +226 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/tests/test_formats.py +40 -0
- vaultconfig-0.3.0/tests/test_io.py +210 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/tests/test_obscure.py +35 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/tests/test_schema.py +130 -0
- vaultconfig-0.3.0/tests/test_secrets_envelope.py +208 -0
- vaultconfig-0.3.0/tests/test_secrets_file.py +217 -0
- vaultconfig-0.3.0/tests/test_secrets_keyring.py +163 -0
- vaultconfig-0.3.0/vaultconfig/__init__.py +72 -0
- vaultconfig-0.3.0/vaultconfig/_version.py +24 -0
- vaultconfig-0.3.0/vaultconfig/cli.py +2123 -0
- vaultconfig-0.3.0/vaultconfig/config.py +634 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/vaultconfig/crypt.py +32 -11
- vaultconfig-0.3.0/vaultconfig/env_export.py +190 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/vaultconfig/exceptions.py +0 -16
- vaultconfig-0.3.0/vaultconfig/formats/__init__.py +54 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/vaultconfig/formats/base.py +4 -5
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/vaultconfig/formats/yaml_format.py +6 -2
- vaultconfig-0.3.0/vaultconfig/io.py +116 -0
- vaultconfig-0.3.0/vaultconfig/py.typed +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/vaultconfig/schema.py +62 -18
- vaultconfig-0.3.0/vaultconfig/secrets/__init__.py +27 -0
- vaultconfig-0.3.0/vaultconfig/secrets/api.py +12 -0
- vaultconfig-0.3.0/vaultconfig/secrets/crypto.py +85 -0
- vaultconfig-0.3.0/vaultconfig/secrets/encrypted_file.py +155 -0
- vaultconfig-0.3.0/vaultconfig/secrets/envelope.py +227 -0
- vaultconfig-0.3.0/vaultconfig/secrets/errors.py +30 -0
- vaultconfig-0.3.0/vaultconfig/secrets/fileio.py +258 -0
- vaultconfig-0.3.0/vaultconfig/secrets/keyring_store.py +123 -0
- vaultconfig-0.3.0/vaultconfig.egg-info/PKG-INFO +160 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/vaultconfig.egg-info/SOURCES.txt +31 -9
- vaultconfig-0.3.0/vaultconfig.egg-info/requires.txt +34 -0
- vaultconfig-0.3.0/vaultconfig.egg-info/scm_file_list.json +141 -0
- vaultconfig-0.3.0/vaultconfig.egg-info/scm_version.json +8 -0
- vaultconfig-0.2.0/PKG-INFO +0 -537
- vaultconfig-0.2.0/README.md +0 -492
- vaultconfig-0.2.0/docs/api.rst +0 -389
- vaultconfig-0.2.0/docs/cli.rst +0 -518
- vaultconfig-0.2.0/docs/examples.rst +0 -803
- vaultconfig-0.2.0/docs/index.rst +0 -75
- vaultconfig-0.2.0/docs/installation.rst +0 -193
- vaultconfig-0.2.0/docs/make.py +0 -83
- vaultconfig-0.2.0/docs/quickstart.rst +0 -383
- vaultconfig-0.2.0/docs/requirements.txt +0 -3
- vaultconfig-0.2.0/docs/security.rst +0 -504
- vaultconfig-0.2.0/examples/_update_examples.sh +0 -11
- vaultconfig-0.2.0/requirements-test.txt +0 -11
- vaultconfig-0.2.0/tests/test_cli.py +0 -342
- vaultconfig-0.2.0/vaultconfig/__init__.py +0 -60
- vaultconfig-0.2.0/vaultconfig/_version.py +0 -34
- vaultconfig-0.2.0/vaultconfig/cli.py +0 -400
- vaultconfig-0.2.0/vaultconfig/config.py +0 -496
- vaultconfig-0.2.0/vaultconfig/formats/__init__.py +0 -10
- vaultconfig-0.2.0/vaultconfig.egg-info/PKG-INFO +0 -537
- vaultconfig-0.2.0/vaultconfig.egg-info/requires.txt +0 -17
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/.coveragerc +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/.github/pytest.ini +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/.github/workflows/codecov.yml +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/.github/workflows/python-publish.yml +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/.prettierrc.yml +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/.readthedocs.yaml +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/examples/README.md +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/examples/custom_cipher_key_example.py +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/examples/ini_config/README.md +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/examples/ini_config/environments.ini +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/examples/ini_config/example_default_section.py +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/examples/ini_config/hosts_config.ini +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/examples/ini_config/invalid_database.ini +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/examples/ini_config/obscured_database.ini +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/examples/ini_config/valid_database.ini +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/examples/toml_config/README.md +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/examples/toml_config/app_config.toml +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/examples/toml_config/environments.toml +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/examples/toml_config/example.py +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/examples/toml_config/invalid_database.toml +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/examples/toml_config/nested_config.toml +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/examples/toml_config/obscured_database.toml +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/examples/toml_config/types_demo.toml +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/examples/toml_config/valid_database.toml +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/examples/yaml_config/README.md +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/examples/yaml_config/app_config.yaml +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/examples/yaml_config/environments.yaml +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/examples/yaml_config/example.py +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/examples/yaml_config/example_advanced.py +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/examples/yaml_config/invalid_database.yaml +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/examples/yaml_config/nested_config.yaml +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/examples/yaml_config/obscured_database.yaml +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/examples/yaml_config/types_demo.yaml +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/examples/yaml_config/valid_database.yaml +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/setup.cfg +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/setup.py +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/tests/__init__.py +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/tests/conftest.py +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/tests/test_obscure_custom_keys.py +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/vaultconfig/formats/ini_format.py +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/vaultconfig/formats/toml_format.py +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/vaultconfig/obscure.py +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/vaultconfig.egg-info/dependency_links.txt +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/vaultconfig.egg-info/entry_points.txt +0 -0
- {vaultconfig-0.2.0 → vaultconfig-0.3.0}/vaultconfig.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
[codecrate]
|
|
2
|
+
output = "context_vaultconfig.md"
|
|
3
|
+
keep_docstrings = true
|
|
4
|
+
dedupe = true
|
|
5
|
+
respect_gitignore = true
|
|
6
|
+
# exclude = ["*/.venv/*", "integration_tests", "examples", "docs"]
|
|
7
|
+
gitignore_allow = ["vaultconfig/_version.py"]
|
|
8
|
+
exclude = ["*/.venv/*", "integration_tests", "todo.md"]
|
|
9
|
+
include = ["**/*.py", "**/*.toml", "**/*.rst", "**/*.md", "**/*.typed", "**/*.js", "**/*.css", "**/*.html"]
|
|
10
|
+
split_max_chars = 0
|
|
11
|
+
manifest = false
|
|
12
|
+
layout = "full"
|
|
13
|
+
profile = "portable-agent"
|
|
14
|
+
emit_standalone_unpacker = true
|
|
@@ -6,7 +6,7 @@ jobs:
|
|
|
6
6
|
strategy:
|
|
7
7
|
matrix:
|
|
8
8
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
9
|
-
python-version: ["3.
|
|
9
|
+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
10
10
|
steps:
|
|
11
11
|
- uses: actions/checkout@master
|
|
12
12
|
- name: Setup Python
|
|
@@ -12,21 +12,32 @@ exclude: |
|
|
|
12
12
|
# Don't bother non-technical authors with formatting issues in docs
|
|
13
13
|
readme/.*\.(rst|md)$|
|
|
14
14
|
# Ignore build and dist directories in addons
|
|
15
|
-
/build/|/dist/|/dev/|/
|
|
15
|
+
/build/|/dist/|/dev/|/notnebooks/
|
|
16
16
|
# You don't usually want a bot to modify your legal texts
|
|
17
17
|
(LICENSE.*|COPYING.*)|
|
|
18
18
|
default_language_version:
|
|
19
19
|
python: python3
|
|
20
|
-
node: "16.17.0"
|
|
21
20
|
repos:
|
|
22
|
-
- repo:
|
|
23
|
-
rev: v0.6.8
|
|
21
|
+
- repo: local
|
|
24
22
|
hooks:
|
|
25
|
-
- id: ruff
|
|
26
|
-
|
|
23
|
+
- id: ruff-check
|
|
24
|
+
name: ruff check
|
|
25
|
+
entry:
|
|
26
|
+
ruff check --fix --exit-non-zero-on-fix --config=.ruff.toml --force-exclude
|
|
27
|
+
language: system
|
|
28
|
+
types_or: [python, pyi]
|
|
27
29
|
- id: ruff-format
|
|
30
|
+
name: ruff format
|
|
31
|
+
entry: ruff format --force-exclude
|
|
32
|
+
language: system
|
|
33
|
+
types_or: [python, pyi]
|
|
34
|
+
- repo: https://github.com/asottile/pyupgrade
|
|
35
|
+
rev: v3.21.2
|
|
36
|
+
hooks:
|
|
37
|
+
- id: pyupgrade
|
|
38
|
+
args: [--py310-plus]
|
|
28
39
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
29
|
-
rev:
|
|
40
|
+
rev: v6.0.0
|
|
30
41
|
hooks:
|
|
31
42
|
- id: check-toml
|
|
32
43
|
- id: check-yaml
|
|
@@ -37,8 +48,6 @@ repos:
|
|
|
37
48
|
- id: mixed-line-ending
|
|
38
49
|
args: ["--fix=lf"]
|
|
39
50
|
- id: debug-statements
|
|
40
|
-
- id: fix-encoding-pragma
|
|
41
|
-
args: ["--remove"]
|
|
42
51
|
- id: check-case-conflict
|
|
43
52
|
- id: check-docstring-first
|
|
44
53
|
- id: check-executables-have-shebangs
|
|
@@ -46,7 +55,7 @@ repos:
|
|
|
46
55
|
# exclude files where underlines are not distinguishable from merge conflicts
|
|
47
56
|
exclude: /README\.rst$|^docs/.*\.rst$
|
|
48
57
|
- repo: https://github.com/pre-commit/mirrors-prettier
|
|
49
|
-
rev:
|
|
58
|
+
rev: v4.0.0-alpha.8
|
|
50
59
|
hooks:
|
|
51
60
|
- id: prettier
|
|
52
61
|
name: prettier (with plugin-xml)
|
|
@@ -56,11 +65,3 @@ repos:
|
|
|
56
65
|
args:
|
|
57
66
|
- --plugin=@prettier/plugin-xml
|
|
58
67
|
files: \.(css|htm|html|js|json|jsx|less|md|scss|toml|ts|xml|yaml|yml)$
|
|
59
|
-
- repo: https://github.com/pre-commit/mirrors-eslint
|
|
60
|
-
rev: v8.24.0
|
|
61
|
-
hooks:
|
|
62
|
-
- id: eslint
|
|
63
|
-
verbose: true
|
|
64
|
-
args:
|
|
65
|
-
- --color
|
|
66
|
-
- --fix
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vaultconfig
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Secure configuration management library with encryption support for Python
|
|
5
|
+
Author-email: Holger Nahrstaedt <nahrstaedt@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: click>=8.0.0
|
|
11
|
+
Requires-Dist: rich>=13.0.0
|
|
12
|
+
Requires-Dist: cryptography>=41.0.0
|
|
13
|
+
Requires-Dist: PyNaCl>=1.5.0
|
|
14
|
+
Requires-Dist: tomli>=1.2.0; python_version < "3.11"
|
|
15
|
+
Requires-Dist: tomli-w>=1.0.0
|
|
16
|
+
Requires-Dist: pydantic>=2.0.0
|
|
17
|
+
Provides-Extra: keyring
|
|
18
|
+
Requires-Dist: keyring<27,>=25; extra == "keyring"
|
|
19
|
+
Provides-Extra: yaml
|
|
20
|
+
Requires-Dist: PyYAML>=6.0; extra == "yaml"
|
|
21
|
+
Provides-Extra: docs
|
|
22
|
+
Requires-Dist: sphinx>=7.0.0; extra == "docs"
|
|
23
|
+
Requires-Dist: sphinx-rtd-theme>=1.3.0; extra == "docs"
|
|
24
|
+
Requires-Dist: sphinx-autodoc-typehints>=1.24.0; extra == "docs"
|
|
25
|
+
Requires-Dist: myst-parser>=2.0.0; extra == "docs"
|
|
26
|
+
Requires-Dist: Pillow>=9.0; extra == "docs"
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
29
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
30
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
31
|
+
Requires-Dist: mypy>=1.0; extra == "dev"
|
|
32
|
+
Requires-Dist: pre-commit>=3.0; extra == "dev"
|
|
33
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
34
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
35
|
+
Requires-Dist: PyYAML>=6.0; extra == "dev"
|
|
36
|
+
Requires-Dist: types-PyYAML>=6.0; extra == "dev"
|
|
37
|
+
Requires-Dist: tomli>=1.2.0; extra == "dev"
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
|
|
40
|
+
[](https://pypi.org/project/vaultconfig/)
|
|
41
|
+

|
|
42
|
+
[](https://codecov.io/gh/holgern/vaultconfig)
|
|
43
|
+
|
|
44
|
+
# VaultConfig
|
|
45
|
+
|
|
46
|
+
VaultConfig manages application configuration files and provides separate APIs for
|
|
47
|
+
storing secrets. It supports TOML and INI directly, with optional YAML support, schema
|
|
48
|
+
validation, a command-line interface, and authenticated encryption for configuration
|
|
49
|
+
files.
|
|
50
|
+
|
|
51
|
+
## Features
|
|
52
|
+
|
|
53
|
+
- Manage named TOML, INI, or optional YAML configurations.
|
|
54
|
+
- Validate configuration data with Pydantic-backed schemas.
|
|
55
|
+
- Explicitly obscure schema-marked values or values passed to the CLI with `--obscure`.
|
|
56
|
+
Obscuring is not encryption.
|
|
57
|
+
- Read and write configuration files protected by authenticated encryption using the V1
|
|
58
|
+
configuration-encryption format.
|
|
59
|
+
- Store opaque secrets separately with a passphrase-protected `FileVault` or an optional
|
|
60
|
+
OS-backed `KeyringVault`.
|
|
61
|
+
|
|
62
|
+
## Installation
|
|
63
|
+
|
|
64
|
+
VaultConfig requires Python 3.10 or later.
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pip install vaultconfig
|
|
68
|
+
pip install 'vaultconfig[yaml]' # Optional YAML format support
|
|
69
|
+
pip install 'vaultconfig[keyring]' # Optional KeyringVault integration
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
For development, tests, and documentation:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pip install -e '.[dev,docs,yaml,keyring]'
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
See [installation](docs/installation.md) for the extras and [secrets](docs/secrets.md)
|
|
79
|
+
for keyring requirements.
|
|
80
|
+
|
|
81
|
+
## Configuration quick start
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
from pathlib import Path
|
|
85
|
+
from vaultconfig import ConfigManager
|
|
86
|
+
|
|
87
|
+
manager = ConfigManager(config_dir=Path("./app-config"), format="toml")
|
|
88
|
+
manager.add_config("database", {"host": "localhost", "port": 5432})
|
|
89
|
+
|
|
90
|
+
entry = manager.get_config("database")
|
|
91
|
+
if entry is not None:
|
|
92
|
+
print(entry.get("host"))
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
A value is obscured only when a schema marks it sensitive or the caller explicitly
|
|
96
|
+
requests obscuring. Do not put credentials in an unencrypted configuration file. For the
|
|
97
|
+
CLI, use `vaultconfig set --obscure`; for application secrets, prefer the dedicated
|
|
98
|
+
secret-storage API.
|
|
99
|
+
|
|
100
|
+
## CLI quick start
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
vaultconfig init --config-dir ./app-config --format toml
|
|
104
|
+
vaultconfig set --config-dir ./app-config --create database host=localhost port=5432
|
|
105
|
+
vaultconfig get --config-dir ./app-config database host
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
`init` creates a configuration directory. It does not enable persistent encryption. See
|
|
109
|
+
[CLI reference](docs/cli.md) for encryption commands, option aliases, format detection,
|
|
110
|
+
and environment export.
|
|
111
|
+
|
|
112
|
+
## Dedicated secret storage
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from getpass import getpass
|
|
116
|
+
from pathlib import Path
|
|
117
|
+
from vaultconfig.secrets import FileVault
|
|
118
|
+
|
|
119
|
+
vault = FileVault(Path.home() / ".local/share/myapp/credentials.vault")
|
|
120
|
+
# Run once when creating a new vault. This refuses to overwrite an existing file.
|
|
121
|
+
vault.initialize(getpass("Choose a vault passphrase: "))
|
|
122
|
+
|
|
123
|
+
with vault.open(getpass("Unlock the vault: ")) as store:
|
|
124
|
+
store.set_secret("service-token", "value supplied by your application")
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
`FileVault` is included in the normal installation. `KeyringVault` requires the
|
|
128
|
+
`keyring` extra and an accepted, configured native OS keyring. Neither backend makes
|
|
129
|
+
secrets safe from code or processes that can access them while the application is
|
|
130
|
+
running. See [secrets](docs/secrets.md) and [security guide](docs/security.md).
|
|
131
|
+
|
|
132
|
+
## Security boundaries
|
|
133
|
+
|
|
134
|
+
Password obscuring is reversible concealment for casual viewing, not encryption. The
|
|
135
|
+
default key is part of the package; a custom obscuring key does not turn this feature
|
|
136
|
+
into secret storage. Configuration-file encryption and the V2 `FileVault` format are
|
|
137
|
+
separate formats and APIs. VaultConfig does not automatically migrate values between
|
|
138
|
+
them.
|
|
139
|
+
|
|
140
|
+
See [security guide](docs/security.md) for the threat model, password handling, file
|
|
141
|
+
permissions, and recovery limits.
|
|
142
|
+
|
|
143
|
+
## Documentation
|
|
144
|
+
|
|
145
|
+
- [quick start](docs/quickstart.md)
|
|
146
|
+
- [CLI reference](docs/cli.md)
|
|
147
|
+
- [API reference](docs/api.md)
|
|
148
|
+
- [secrets](docs/secrets.md)
|
|
149
|
+
- [examples](docs/examples.md)
|
|
150
|
+
|
|
151
|
+
## Development
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
pip install -e '.[dev,docs,yaml,keyring]'
|
|
155
|
+
pytest
|
|
156
|
+
ruff check .
|
|
157
|
+
ruff format --check .
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
The project is licensed under the MIT License. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
[](https://pypi.org/project/vaultconfig/)
|
|
2
|
+

|
|
3
|
+
[](https://codecov.io/gh/holgern/vaultconfig)
|
|
4
|
+
|
|
5
|
+
# VaultConfig
|
|
6
|
+
|
|
7
|
+
VaultConfig manages application configuration files and provides separate APIs for
|
|
8
|
+
storing secrets. It supports TOML and INI directly, with optional YAML support, schema
|
|
9
|
+
validation, a command-line interface, and authenticated encryption for configuration
|
|
10
|
+
files.
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
- Manage named TOML, INI, or optional YAML configurations.
|
|
15
|
+
- Validate configuration data with Pydantic-backed schemas.
|
|
16
|
+
- Explicitly obscure schema-marked values or values passed to the CLI with `--obscure`.
|
|
17
|
+
Obscuring is not encryption.
|
|
18
|
+
- Read and write configuration files protected by authenticated encryption using the V1
|
|
19
|
+
configuration-encryption format.
|
|
20
|
+
- Store opaque secrets separately with a passphrase-protected `FileVault` or an optional
|
|
21
|
+
OS-backed `KeyringVault`.
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
VaultConfig requires Python 3.10 or later.
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install vaultconfig
|
|
29
|
+
pip install 'vaultconfig[yaml]' # Optional YAML format support
|
|
30
|
+
pip install 'vaultconfig[keyring]' # Optional KeyringVault integration
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
For development, tests, and documentation:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install -e '.[dev,docs,yaml,keyring]'
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
See [installation](docs/installation.md) for the extras and [secrets](docs/secrets.md)
|
|
40
|
+
for keyring requirements.
|
|
41
|
+
|
|
42
|
+
## Configuration quick start
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
from pathlib import Path
|
|
46
|
+
from vaultconfig import ConfigManager
|
|
47
|
+
|
|
48
|
+
manager = ConfigManager(config_dir=Path("./app-config"), format="toml")
|
|
49
|
+
manager.add_config("database", {"host": "localhost", "port": 5432})
|
|
50
|
+
|
|
51
|
+
entry = manager.get_config("database")
|
|
52
|
+
if entry is not None:
|
|
53
|
+
print(entry.get("host"))
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
A value is obscured only when a schema marks it sensitive or the caller explicitly
|
|
57
|
+
requests obscuring. Do not put credentials in an unencrypted configuration file. For the
|
|
58
|
+
CLI, use `vaultconfig set --obscure`; for application secrets, prefer the dedicated
|
|
59
|
+
secret-storage API.
|
|
60
|
+
|
|
61
|
+
## CLI quick start
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
vaultconfig init --config-dir ./app-config --format toml
|
|
65
|
+
vaultconfig set --config-dir ./app-config --create database host=localhost port=5432
|
|
66
|
+
vaultconfig get --config-dir ./app-config database host
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
`init` creates a configuration directory. It does not enable persistent encryption. See
|
|
70
|
+
[CLI reference](docs/cli.md) for encryption commands, option aliases, format detection,
|
|
71
|
+
and environment export.
|
|
72
|
+
|
|
73
|
+
## Dedicated secret storage
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
from getpass import getpass
|
|
77
|
+
from pathlib import Path
|
|
78
|
+
from vaultconfig.secrets import FileVault
|
|
79
|
+
|
|
80
|
+
vault = FileVault(Path.home() / ".local/share/myapp/credentials.vault")
|
|
81
|
+
# Run once when creating a new vault. This refuses to overwrite an existing file.
|
|
82
|
+
vault.initialize(getpass("Choose a vault passphrase: "))
|
|
83
|
+
|
|
84
|
+
with vault.open(getpass("Unlock the vault: ")) as store:
|
|
85
|
+
store.set_secret("service-token", "value supplied by your application")
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
`FileVault` is included in the normal installation. `KeyringVault` requires the
|
|
89
|
+
`keyring` extra and an accepted, configured native OS keyring. Neither backend makes
|
|
90
|
+
secrets safe from code or processes that can access them while the application is
|
|
91
|
+
running. See [secrets](docs/secrets.md) and [security guide](docs/security.md).
|
|
92
|
+
|
|
93
|
+
## Security boundaries
|
|
94
|
+
|
|
95
|
+
Password obscuring is reversible concealment for casual viewing, not encryption. The
|
|
96
|
+
default key is part of the package; a custom obscuring key does not turn this feature
|
|
97
|
+
into secret storage. Configuration-file encryption and the V2 `FileVault` format are
|
|
98
|
+
separate formats and APIs. VaultConfig does not automatically migrate values between
|
|
99
|
+
them.
|
|
100
|
+
|
|
101
|
+
See [security guide](docs/security.md) for the threat model, password handling, file
|
|
102
|
+
permissions, and recovery limits.
|
|
103
|
+
|
|
104
|
+
## Documentation
|
|
105
|
+
|
|
106
|
+
- [quick start](docs/quickstart.md)
|
|
107
|
+
- [CLI reference](docs/cli.md)
|
|
108
|
+
- [API reference](docs/api.md)
|
|
109
|
+
- [secrets](docs/secrets.md)
|
|
110
|
+
- [examples](docs/examples.md)
|
|
111
|
+
|
|
112
|
+
## Development
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
pip install -e '.[dev,docs,yaml,keyring]'
|
|
116
|
+
pytest
|
|
117
|
+
ruff check .
|
|
118
|
+
ruff format --check .
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
The project is licensed under the MIT License. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# API reference
|
|
2
|
+
|
|
3
|
+
## Configuration API
|
|
4
|
+
|
|
5
|
+
```{autoclass} vaultconfig.ConfigManager
|
|
6
|
+
:members:
|
|
7
|
+
:show-inheritance:
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```{autoclass} vaultconfig.ConfigEntry
|
|
11
|
+
:members:
|
|
12
|
+
:show-inheritance:
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Schema API
|
|
16
|
+
|
|
17
|
+
```{autoclass} vaultconfig.ConfigSchema
|
|
18
|
+
:members:
|
|
19
|
+
:show-inheritance:
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```{autoclass} vaultconfig.FieldDef
|
|
23
|
+
:members:
|
|
24
|
+
:show-inheritance:
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```{autofunction} vaultconfig.create_simple_schema
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Secret-storage API
|
|
32
|
+
|
|
33
|
+
The public secret-storage classes and protocol are documented in {doc}`secrets`.
|
|
34
|
+
|
|
35
|
+
```{autoclass} vaultconfig.secrets.FileVault
|
|
36
|
+
:members:
|
|
37
|
+
:show-inheritance:
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```{autoclass} vaultconfig.secrets.KeyringVault
|
|
41
|
+
:members:
|
|
42
|
+
:show-inheritance:
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
```{autoclass} vaultconfig.secrets.SecretStore
|
|
46
|
+
:members:
|
|
47
|
+
:show-inheritance:
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Encryption and obscuring
|
|
51
|
+
|
|
52
|
+
```{automodule} vaultconfig.crypt
|
|
53
|
+
:members:
|
|
54
|
+
:undoc-members:
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
```{automodule} vaultconfig.obscure
|
|
58
|
+
:members:
|
|
59
|
+
:undoc-members:
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Migration from 0.2.x
|
|
63
|
+
|
|
64
|
+
The 0.3 line adds the separate `vaultconfig.secrets` API. Existing V1 configuration
|
|
65
|
+
encryption remains a distinct format; VaultConfig does not convert V1 files to V2 secret
|
|
66
|
+
vaults automatically.
|
|
67
|
+
|
|
68
|
+
`vaultconfig init` creates a directory. Its `--format` option applies to that invocation
|
|
69
|
+
and is not saved as a directory setting. If automation previously passed
|
|
70
|
+
`init --encrypt`, remove that option and choose an explicit configuration-encryption
|
|
71
|
+
operation such as `create --encrypted` or `encrypt set`.
|
|
72
|
+
|
|
73
|
+
The `ConfigManager` API remains available. Review the command-specific help when
|
|
74
|
+
updating scripts because directory option aliases differ by command. The `run` command
|
|
75
|
+
supports both `--uppercase` and `--no-uppercase`; the default environment-variable
|
|
76
|
+
prefix is empty.
|