env-use 1.0.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.
Files changed (35) hide show
  1. env_use-1.0.0/.github/workflows/ci.yml +44 -0
  2. env_use-1.0.0/.github/workflows/release.yml +187 -0
  3. env_use-1.0.0/.gitignore +11 -0
  4. env_use-1.0.0/.gitmessage +15 -0
  5. env_use-1.0.0/.pre-commit-config.yaml +23 -0
  6. env_use-1.0.0/.python-version +1 -0
  7. env_use-1.0.0/CHANGELOG.md +12 -0
  8. env_use-1.0.0/CONTRIBUTING.md +116 -0
  9. env_use-1.0.0/PKG-INFO +401 -0
  10. env_use-1.0.0/README.md +356 -0
  11. env_use-1.0.0/docs/architecture.md +167 -0
  12. env_use-1.0.0/docs/provider_development.md +374 -0
  13. env_use-1.0.0/docs/usage.md +381 -0
  14. env_use-1.0.0/examples/custom_provider.py +184 -0
  15. env_use-1.0.0/pyproject.toml +135 -0
  16. env_use-1.0.0/tests/__init__.py +1 -0
  17. env_use-1.0.0/tests/test_config.py +160 -0
  18. env_use-1.0.0/tests/test_env_provider.py +94 -0
  19. env_use-1.0.0/tests/test_file_provider.py +128 -0
  20. env_use-1.0.0/tests/test_loader.py +345 -0
  21. env_use-1.0.0/tests/test_providers.py +244 -0
  22. env_use-1.0.0/use_env/__init__.py +27 -0
  23. env_use-1.0.0/use_env/cli.py +276 -0
  24. env_use-1.0.0/use_env/config.py +116 -0
  25. env_use-1.0.0/use_env/loader.py +289 -0
  26. env_use-1.0.0/use_env/providers/__init__.py +314 -0
  27. env_use-1.0.0/use_env/providers/aws.py +197 -0
  28. env_use-1.0.0/use_env/providers/azure.py +151 -0
  29. env_use-1.0.0/use_env/providers/built_in.py +37 -0
  30. env_use-1.0.0/use_env/providers/env.py +162 -0
  31. env_use-1.0.0/use_env/providers/file.py +141 -0
  32. env_use-1.0.0/use_env/providers/gcp.py +141 -0
  33. env_use-1.0.0/use_env/providers/hashicorp.py +223 -0
  34. env_use-1.0.0/use_env/providers/onepassword.py +202 -0
  35. env_use-1.0.0/uv.lock +1979 -0
@@ -0,0 +1,44 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ branches: [main, master]
6
+ push:
7
+ branches: [main, master]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.12", "3.13"]
15
+ steps:
16
+ - name: Checkout repository
17
+ uses: actions/checkout@v4
18
+
19
+ - name: Set up uv with Python ${{ matrix.python-version }}
20
+ uses: astral-sh/setup-uv@v3
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+
24
+ - name: Install dependencies
25
+ run: |
26
+ uv sync --all-extras --dev
27
+
28
+ - name: Run Pyrefly type checking
29
+ run: uv run pyrefly check use_env/ tests/
30
+
31
+ - name: Run ruff check
32
+ run: uv run ruff check use_env/ tests/
33
+
34
+ - name: Run ruff format check
35
+ run: uv run ruff format --check use_env/ tests/
36
+
37
+ - name: Run pytest with coverage
38
+ run: uv run pytest --cov=use_env --cov-report=xml --cov-report=term tests/
39
+
40
+ - name: Upload coverage report
41
+ uses: codecov/codecov-action@v4
42
+ with:
43
+ files: ./coverage.xml
44
+ fail_ci_if_error: false
@@ -0,0 +1,187 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ branches: [main, master]
6
+ pull_request:
7
+ types: [closed]
8
+ branches: [main, master]
9
+
10
+ permissions:
11
+ contents: write
12
+ pull-requests: write
13
+
14
+ jobs:
15
+ prepare_release_pr:
16
+ if: github.event_name == 'push'
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - name: Checkout repository
20
+ uses: actions/checkout@v4
21
+ with:
22
+ fetch-depth: 0
23
+
24
+ - name: Set up Python
25
+ uses: actions/setup-python@v5
26
+ with:
27
+ python-version: "3.12"
28
+ cache: "pip"
29
+
30
+ - name: Install semantic-release
31
+ run: |
32
+ python -m pip install --upgrade pip
33
+ pip install python-semantic-release
34
+
35
+ - name: Prepare release changes
36
+ run: |
37
+ semantic-release version --no-commit --no-tag --no-push --no-vcs-release --skip-build
38
+
39
+ - name: Build release PR metadata
40
+ id: release_meta
41
+ run: |
42
+ if git diff --quiet && git diff --cached --quiet; then
43
+ echo "No release changes detected. Skipping release PR update."
44
+ echo "should_release=false" >> "$GITHUB_OUTPUT"
45
+ exit 0
46
+ fi
47
+
48
+ CHANGED_FILES="$( { git diff --name-only; git diff --name-only --cached; } | sort -u )"
49
+
50
+ if ! echo "$CHANGED_FILES" | grep -q '^CHANGELOG\.md$'; then
51
+ echo "Expected CHANGELOG.md to be updated for release PR."
52
+ exit 1
53
+ fi
54
+
55
+ if ! echo "$CHANGED_FILES" | grep -q '^pyproject\.toml$'; then
56
+ echo "Expected pyproject.toml to be updated for release PR."
57
+ exit 1
58
+ fi
59
+
60
+ VERSION="$(python - <<'PY'
61
+ import tomllib
62
+ with open('pyproject.toml', 'rb') as f:
63
+ print(tomllib.load(f)['project']['version'])
64
+ PY
65
+ )"
66
+
67
+ LAST_TAG="$(git describe --tags --abbrev=0 --match 'v*' 2>/dev/null || true)"
68
+ if [ -n "$LAST_TAG" ]; then
69
+ RANGE="${LAST_TAG}..HEAD"
70
+ else
71
+ RANGE="HEAD"
72
+ fi
73
+
74
+ git log --no-merges --pretty='- %s (%h)' ${RANGE} > /tmp/release_commits.md
75
+ if [ ! -s /tmp/release_commits.md ]; then
76
+ echo "- No user-facing commits detected." > /tmp/release_commits.md
77
+ fi
78
+
79
+ {
80
+ echo "## Release v${VERSION}"
81
+ echo
82
+ echo "This PR prepares release \`v${VERSION}\`."
83
+ echo
84
+ echo "### Included commits"
85
+ cat /tmp/release_commits.md
86
+ echo
87
+ echo "### Files updated by release automation"
88
+ echo "- CHANGELOG.md"
89
+ echo "- pyproject.toml"
90
+ } > /tmp/release_pr_body.md
91
+
92
+ echo "should_release=true" >> "$GITHUB_OUTPUT"
93
+ echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
94
+
95
+ - name: Create or update release PR
96
+ if: steps.release_meta.outputs.should_release == 'true'
97
+ uses: peter-evans/create-pull-request@v6
98
+ with:
99
+ token: ${{ secrets.GITHUB_TOKEN }}
100
+ commit-message: "chore(release): prepare release"
101
+ branch: "release/${{ github.ref_name }}"
102
+ base: "${{ github.ref_name }}"
103
+ title: "chore(release): v${{ steps.release_meta.outputs.version }}"
104
+ body-path: /tmp/release_pr_body.md
105
+ labels: release
106
+ delete-branch: false
107
+
108
+ tag_release:
109
+ if: |
110
+ github.event_name == 'pull_request' &&
111
+ github.event.pull_request.merged == true &&
112
+ startsWith(github.event.pull_request.head.ref, 'release/') &&
113
+ contains(github.event.pull_request.labels.*.name, 'release')
114
+ runs-on: ubuntu-latest
115
+ outputs:
116
+ tag: ${{ steps.compute_tag.outputs.tag }}
117
+ steps:
118
+ - name: Checkout merged commit
119
+ uses: actions/checkout@v4
120
+ with:
121
+ ref: ${{ github.event.pull_request.merge_commit_sha }}
122
+ fetch-depth: 0
123
+
124
+ - name: Configure git author
125
+ run: |
126
+ git config user.name "github-actions[bot]"
127
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
128
+
129
+ - name: Compute tag
130
+ id: compute_tag
131
+ run: |
132
+ VERSION="$(python - <<'PY'
133
+ import tomllib
134
+ with open('pyproject.toml', 'rb') as f:
135
+ print(tomllib.load(f)['project']['version'])
136
+ PY
137
+ )"
138
+ echo "tag=v${VERSION}" >> "$GITHUB_OUTPUT"
139
+
140
+ - name: Create and push version tag
141
+ run: |
142
+ TAG="${{ steps.compute_tag.outputs.tag }}"
143
+
144
+ if git rev-parse "${TAG}" >/dev/null 2>&1; then
145
+ echo "Tag ${TAG} already exists. Skipping."
146
+ exit 0
147
+ fi
148
+
149
+ git tag "${TAG}" "${{ github.event.pull_request.merge_commit_sha }}"
150
+ git push origin "${TAG}"
151
+
152
+ publish_release:
153
+ if: github.event_name == 'pull_request' && needs.tag_release.result == 'success'
154
+ needs: [tag_release]
155
+ runs-on: ubuntu-latest
156
+ steps:
157
+ - name: Checkout tagged commit
158
+ uses: actions/checkout@v4
159
+ with:
160
+ ref: ${{ needs.tag_release.outputs.tag }}
161
+ fetch-depth: 0
162
+
163
+ - name: Set up Python
164
+ uses: actions/setup-python@v5
165
+ with:
166
+ python-version: "3.12"
167
+ cache: "pip"
168
+
169
+ - name: Build package
170
+ run: |
171
+ python -m pip install --upgrade pip
172
+ pip install build twine
173
+ python -m build
174
+
175
+ - name: Publish to PyPI
176
+ env:
177
+ TWINE_USERNAME: __token__
178
+ TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
179
+ run: |
180
+ python -m twine upload dist/*
181
+
182
+ - name: Create GitHub Release
183
+ uses: softprops/action-gh-release@v2
184
+ with:
185
+ tag_name: ${{ needs.tag_release.outputs.tag }}
186
+ generate_release_notes: true
187
+ files: dist/*
@@ -0,0 +1,11 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
11
+ .DS_Store
@@ -0,0 +1,15 @@
1
+ # <type>(<scope>): <subject>
2
+ #
3
+ # <body>
4
+ #
5
+ # <footer>
6
+ #
7
+ # Types: feat, fix, docs, style, refactor, perf, test, chore
8
+ # Examples:
9
+ # feat(provider): add AWS Secrets Manager support
10
+ # fix: resolve environment variable caching issue
11
+ # docs: update installation instructions
12
+ #
13
+ # Breaking changes:
14
+ # feat!: remove deprecated provider
15
+ # BREAKING CHANGE: description of the change
@@ -0,0 +1,23 @@
1
+ repos:
2
+ - repo: local
3
+ hooks:
4
+ - id: pyrefly-check
5
+ name: Pyrefly type check
6
+ entry: uv run pyrefly check use_env/ tests/
7
+ language: system
8
+ pass_filenames: false
9
+ - id: ruff-check
10
+ name: Ruff lint
11
+ entry: uv run ruff check use_env/ tests/
12
+ language: system
13
+ pass_filenames: false
14
+ - id: ruff-format
15
+ name: Ruff format
16
+ entry: uv run ruff format use_env/ tests/
17
+ language: system
18
+ pass_filenames: false
19
+ - id: pytest
20
+ name: PyTest
21
+ entry: uv run pytest
22
+ language: system
23
+ pass_filenames: false
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,12 @@
1
+ # CHANGELOG
2
+
3
+ <!-- version list -->
4
+
5
+ ## v1.0.0 (2026-03-03)
6
+
7
+ - Initial Release
8
+
9
+ ## v0.1.0 (2026-03-03)
10
+
11
+ - Repository history reset
12
+ - Project/package baseline set to `env-use` at `0.1.0`
@@ -0,0 +1,116 @@
1
+ # Contributing to use-env
2
+
3
+ Thank you for your interest in contributing! This document outlines the guidelines for contributing to this project.
4
+
5
+ ## Getting Started
6
+
7
+ 1. Fork the repository
8
+ 2. Clone your fork
9
+ 3. Create a feature branch
10
+
11
+ ## Development Setup
12
+
13
+ ```bash
14
+ # Clone and install
15
+ git clone https://github.com/YOUR_USERNAME/use-env.git
16
+ cd use-env
17
+ uv sync --all-extras --dev
18
+
19
+ # Run tests
20
+ pytest
21
+
22
+ # Run linters
23
+ pyrefly check use_env/ tests/
24
+ ruff check use_env/ tests/
25
+ ruff format use_env/ tests/
26
+ ```
27
+
28
+ ## Commit Message Convention
29
+
30
+ This project uses [Conventional Commits](https://www.conventionalcommits.org/) for automatic versioning and changelog generation.
31
+
32
+ ### Format
33
+
34
+ ```
35
+ <type>[optional scope]: <description>
36
+
37
+ [optional body]
38
+
39
+ [optional footer(s)]
40
+ ```
41
+
42
+ ### Types
43
+
44
+ - **feat**: A new feature
45
+ - **fix**: A bug fix
46
+ - **docs**: Documentation only changes
47
+ - **style**: Changes that do not affect the meaning of the code (white-space, formatting, etc)
48
+ - **refactor**: A code change that neither fixes a bug nor adds a feature
49
+ - **perf**: A code change that improves performance
50
+ - **test**: Adding missing tests or correcting existing tests
51
+ - **chore**: Changes to the build process or auxiliary tools
52
+
53
+ ### Examples
54
+
55
+ ```
56
+ feat: add AWS Secrets Manager provider
57
+
58
+ fix: resolve environment variable caching issue
59
+
60
+ docs: update installation instructions
61
+
62
+ refactor: improve provider registry lookup performance
63
+
64
+ BREAKING CHANGE: the provider interface has been updated
65
+ ```
66
+
67
+ ### Breaking Changes
68
+
69
+ Breaking changes must be indicated by:
70
+ 1. Starting the footer with `BREAKING CHANGE:`
71
+ 2. Using a `!` after the type/scope
72
+
73
+ ```
74
+ feat!: remove deprecated vault CLI provider
75
+
76
+ BREAKING CHANGE: The vault CLI provider has been removed.
77
+ Use the azure-keyvault provider instead.
78
+ ```
79
+
80
+ ## Pull Requests
81
+
82
+ 1. Ensure all tests pass
83
+ 2. Ensure linting passes
84
+ 3. Update documentation if needed
85
+ 4. Add tests for new features
86
+ 5. Keep commits atomic and properly formatted
87
+
88
+ ## Release Process
89
+
90
+ Releases are automatically handled by [python-semantic-release](https://python-semantic-release.readthedocs.io/) plus GitHub Actions.
91
+
92
+ Release flow:
93
+ 1. Commits merge into `main`/`master`.
94
+ 2. The release workflow runs semantic-release versioning and updates a release PR branch (`release/main` or `release/master`).
95
+ 3. When the release PR is merged, the workflow creates and pushes a `vX.Y.Z` tag from the merged commit.
96
+ 4. The publish workflow triggers on that tag.
97
+ 5. The publish workflow uploads to PyPI and creates the GitHub Release.
98
+
99
+ ## Code Style
100
+
101
+ - Follow PEP 8 (enforced by ruff)
102
+ - Add type hints to all functions
103
+ - Write docstrings for public APIs
104
+ - Keep functions small and focused
105
+
106
+ ## Testing
107
+
108
+ All new features should include tests:
109
+
110
+ ```bash
111
+ # Run all tests
112
+ pytest
113
+
114
+ # Run with coverage
115
+ pytest --cov=use_env --cov-report=xml
116
+ ```