envgap 0.1.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.
@@ -0,0 +1,43 @@
1
+ name: Bug report
2
+ description: Report a bug in envgap.
3
+ title: "[Bug]: "
4
+ labels: ["bug"]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: Thanks for helping make envgap sharper.
9
+ - type: textarea
10
+ id: what-happened
11
+ attributes:
12
+ label: What happened?
13
+ description: Tell us what envgap did and what you expected instead.
14
+ placeholder: envgap reported X, but I expected Y.
15
+ validations:
16
+ required: true
17
+ - type: textarea
18
+ id: reproduce
19
+ attributes:
20
+ label: Reproduction
21
+ description: Include the smallest `.env`, `.env.example`, and Python snippet that reproduces it.
22
+ render: shell
23
+ validations:
24
+ required: true
25
+ - type: textarea
26
+ id: output
27
+ attributes:
28
+ label: envgap output
29
+ description: Paste the relevant output. Please redact real secrets.
30
+ render: shell
31
+ validations:
32
+ required: true
33
+ - type: input
34
+ id: version
35
+ attributes:
36
+ label: envgap version
37
+ placeholder: envgap --version
38
+ - type: input
39
+ id: python-version
40
+ attributes:
41
+ label: Python version
42
+ placeholder: python --version
43
+
@@ -0,0 +1,32 @@
1
+ name: Config false positive
2
+ description: Report a case where envgap warns incorrectly.
3
+ title: "[False positive]: "
4
+ labels: ["false-positive"]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: False positives are especially useful for keeping envgap practical.
9
+ - type: textarea
10
+ id: finding
11
+ attributes:
12
+ label: Finding
13
+ description: Which envgap finding seems wrong?
14
+ render: shell
15
+ validations:
16
+ required: true
17
+ - type: textarea
18
+ id: expected
19
+ attributes:
20
+ label: Why is it valid in your project?
21
+ description: Explain the framework pattern, default, alias, or deployment behavior envgap missed.
22
+ validations:
23
+ required: true
24
+ - type: textarea
25
+ id: minimal-example
26
+ attributes:
27
+ label: Minimal example
28
+ description: Include redacted config/code that reproduces the false positive.
29
+ render: shell
30
+ validations:
31
+ required: true
32
+
@@ -0,0 +1,27 @@
1
+ name: Feature request
2
+ description: Suggest a new envgap capability.
3
+ title: "[Feature]: "
4
+ labels: ["enhancement"]
5
+ body:
6
+ - type: textarea
7
+ id: problem
8
+ attributes:
9
+ label: Problem
10
+ description: What repeated config pain would this solve?
11
+ placeholder: I often hit this when...
12
+ validations:
13
+ required: true
14
+ - type: textarea
15
+ id: solution
16
+ attributes:
17
+ label: Proposed behavior
18
+ description: What should envgap report or detect?
19
+ validations:
20
+ required: true
21
+ - type: textarea
22
+ id: example
23
+ attributes:
24
+ label: Example project shape
25
+ description: Include sample `.env`, code, Docker, CI, or framework config if relevant.
26
+ render: shell
27
+
@@ -0,0 +1,22 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ jobs:
8
+ test:
9
+ runs-on: ubuntu-latest
10
+ strategy:
11
+ fail-fast: false
12
+ matrix:
13
+ python-version: ["3.9", "3.10", "3.11", "3.12"]
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: actions/setup-python@v5
17
+ with:
18
+ python-version: ${{ matrix.python-version }}
19
+ - run: python -m pip install --upgrade pip
20
+ - run: python -m pip install -e ".[dev]"
21
+ - run: python -m pytest
22
+
@@ -0,0 +1,12 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .pytest_cache/
4
+ .mypy_cache/
5
+ .ruff_cache/
6
+ .venv/
7
+ venv/
8
+ build/
9
+ dist/
10
+ *.egg-info/
11
+ .coverage
12
+
@@ -0,0 +1,10 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0
4
+
5
+ - Initial MVP with `envgap check`.
6
+ - Dotenv and `.env.example` parsing.
7
+ - Python AST scanning for common `os.environ` and `os.getenv` usage.
8
+ - Missing, duplicate, placeholder, undocumented, and possible-typo findings.
9
+ - Terminal and JSON reporters.
10
+
@@ -0,0 +1,66 @@
1
+ # Contributing
2
+
3
+ Thanks for helping improve envgap.
4
+
5
+ envgap is intentionally a practical diagnostic tool, not a configuration framework. Good contributions make broken environment config easier to understand without adding surprising runtime behavior.
6
+
7
+ ## Setup
8
+
9
+ ```console
10
+ python -m venv .venv
11
+ . .venv/bin/activate
12
+ pip install -e ".[dev]"
13
+ ```
14
+
15
+ ## Run Tests
16
+
17
+ ```console
18
+ pytest
19
+ ```
20
+
21
+ You can also run the sample broken project:
22
+
23
+ ```console
24
+ envgap check examples/basic
25
+ ```
26
+
27
+ ## Good Issues
28
+
29
+ The most useful reports include:
30
+
31
+ - a small `.env`
32
+ - a small `.env.example`
33
+ - the Python code that reads environment variables
34
+ - the envgap output
35
+ - what you expected instead
36
+
37
+ Please redact real API keys, tokens, passwords, and connection strings.
38
+
39
+ ## Scope
40
+
41
+ In scope:
42
+
43
+ - clearer diagnostics
44
+ - fewer false positives
45
+ - Python env usage detection
46
+ - `.env` / `.env.example` drift detection
47
+ - CI-friendly output
48
+ - common framework support when it can be explained clearly
49
+
50
+ Out of scope:
51
+
52
+ - loading environment variables for the app
53
+ - mutating your shell environment
54
+ - becoming a general secrets manager
55
+ - replacing framework settings systems
56
+
57
+ ## Pull Requests
58
+
59
+ Before opening a PR:
60
+
61
+ ```console
62
+ pytest
63
+ ```
64
+
65
+ For user-facing behavior changes, add or update tests and include a short README or changelog update when useful.
66
+
envgap-0.1.0/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 envgap contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
envgap-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,319 @@
1
+ Metadata-Version: 2.4
2
+ Name: envgap
3
+ Version: 0.1.0
4
+ Summary: Find the gaps in your Python environment config.
5
+ Project-URL: Homepage, https://github.com/Pinak-Datta/envgap
6
+ Project-URL: Repository, https://github.com/Pinak-Datta/envgap
7
+ Project-URL: Issues, https://github.com/Pinak-Datta/envgap/issues
8
+ Project-URL: Changelog, https://github.com/Pinak-Datta/envgap/blob/main/CHANGELOG.md
9
+ Author: envgap contributors
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: cli,configuration,diagnostics,dotenv,environment
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Software Development :: Quality Assurance
24
+ Classifier: Topic :: Utilities
25
+ Requires-Python: >=3.9
26
+ Provides-Extra: dev
27
+ Requires-Dist: build>=1.2; extra == 'dev'
28
+ Requires-Dist: pytest>=8.0; extra == 'dev'
29
+ Requires-Dist: twine>=5.0; extra == 'dev'
30
+ Description-Content-Type: text/markdown
31
+
32
+ # envgap
33
+
34
+ Find the gaps in your Python environment config.
35
+
36
+ `envgap` is a diagnostic CLI for Python projects that use `.env` files, `.env.example`, shell variables, and `os.environ` / `os.getenv` in code. It does not load your config. It shows the gaps between what your app expects, what your project documents, and what your environment actually provides.
37
+
38
+ ![envgap terminal diagnosis screenshot](docs/assets/envgap-terminal.svg)
39
+
40
+ ## 30-Second Demo
41
+
42
+ Given a project with:
43
+
44
+ ```dotenv
45
+ # .env
46
+ DB_URL=postgres://localhost/app
47
+ OPENAI_API_KEY=changeme
48
+ ```
49
+
50
+ ```python
51
+ # app.py
52
+ import os
53
+
54
+ DATABASE_URL = os.environ["DATABASE_URL"]
55
+ ```
56
+
57
+ Run:
58
+
59
+ ```console
60
+ $ DATABASE_URL=postgres://shell/app envgap check examples/basic
61
+
62
+ envgap check
63
+ ===============
64
+
65
+ Checked:
66
+ shell environment: available (1/4 expected key(s) found)
67
+ .env: found (3 key(s))
68
+ .env.example: found (3 key(s))
69
+ Python code: 3 env usage(s)
70
+
71
+ Diagnosis:
72
+ DATABASE_URL
73
+ ! Missing value: DATABASE_URL is missing from .env (app.py:3)
74
+ It is present in your shell environment, so local commands may work while CI or Docker still fails.
75
+ Suggested fix: Add DATABASE_URL=... to .env or document how CI/Docker should provide it.
76
+
77
+ DB_URL
78
+ ~ Possible typo: DB_URL may be a typo for DATABASE_URL (.env:1)
79
+ Suggested fix: Rename DB_URL to DATABASE_URL if they represent the same setting.
80
+ ```
81
+
82
+ ## Why
83
+
84
+ Environment config bugs are boring until they eat an afternoon.
85
+
86
+ Common examples:
87
+
88
+ - The app expects `DATABASE_URL`, but `.env` contains `DB_URL`.
89
+ - `.env.example` says a key exists, but local `.env` never got it.
90
+ - A secret is still set to `changeme`.
91
+ - A variable works locally only because it is exported in your shell.
92
+ - CI, Docker, or another developer's machine fails because the real required variables are not documented.
93
+
94
+ `envgap` is for that moment when you want the project to explain itself.
95
+
96
+ ## Install
97
+
98
+ ```console
99
+ pip install envgap
100
+ ```
101
+
102
+ From a local checkout:
103
+
104
+ ```console
105
+ pip install -e ".[dev]"
106
+ ```
107
+
108
+ ## Quick Start
109
+
110
+ Run a check in the current project:
111
+
112
+ ```console
113
+ envgap check
114
+ ```
115
+
116
+ Try the included broken example:
117
+
118
+ ```console
119
+ envgap check examples/basic
120
+ ```
121
+
122
+ Show machine-readable output:
123
+
124
+ ```console
125
+ envgap check --json
126
+ ```
127
+
128
+ Ignore shell variables for deterministic CI checks:
129
+
130
+ ```console
131
+ envgap check --no-shell
132
+ ```
133
+
134
+ Fail on warnings as well as errors:
135
+
136
+ ```console
137
+ envgap check --strict
138
+ ```
139
+
140
+ `--ci` is supported as a CI-friendly alias for `--strict`:
141
+
142
+ ```console
143
+ envgap check --ci
144
+ ```
145
+
146
+ Use custom dotenv filenames:
147
+
148
+ ```console
149
+ envgap check --env-file .env.local --example-file .env.example
150
+ ```
151
+
152
+ ## What It Checks Today
153
+
154
+ `envgap check` currently inspects:
155
+
156
+ - current shell environment
157
+ - `.env`
158
+ - `.env.example`
159
+ - Python files using common environment variable APIs
160
+
161
+ It detects:
162
+
163
+ - missing keys
164
+ - undocumented extra keys
165
+ - duplicate keys
166
+ - empty values
167
+ - placeholder values like `your-key-here`, `changeme`, `todo`, and `replace-me`
168
+ - likely typo pairs like `DB_URL` vs `DATABASE_URL`
169
+ - required env vars used in Python code but missing from `.env.example`
170
+ - missing `.env`
171
+ - missing `.env.example`
172
+
173
+ It scans Python code for:
174
+
175
+ ```python
176
+ os.environ["DATABASE_URL"]
177
+ os.getenv("DATABASE_URL")
178
+ os.getenv("DATABASE_URL", "sqlite:///local.db")
179
+ os.environ.get("DATABASE_URL", "sqlite:///local.db")
180
+ ```
181
+
182
+ Required vs optional behavior:
183
+
184
+ - `os.environ["KEY"]` is required
185
+ - `os.getenv("KEY")` is required
186
+ - `os.getenv("KEY", default)` is optional
187
+ - `os.environ.get("KEY", default)` is optional
188
+
189
+ ## Exit Codes
190
+
191
+ | Command | Exit code behavior |
192
+ | --- | --- |
193
+ | `envgap check` | exits `1` when errors are present |
194
+ | `envgap check --strict` | exits `1` when errors or warnings are present |
195
+ | `envgap check --ci` | same as `--strict` |
196
+ | `envgap check --json` | same pass/fail behavior, JSON output |
197
+ | `envgap check --no-shell` | ignores current shell variables when diagnosing missing keys |
198
+
199
+ Warnings do not fail a normal check unless `--strict` or `--ci` is used.
200
+
201
+ ## CI
202
+
203
+ ```yaml
204
+ name: envgap
205
+
206
+ on: [push, pull_request]
207
+
208
+ jobs:
209
+ envgap:
210
+ runs-on: ubuntu-latest
211
+ steps:
212
+ - uses: actions/checkout@v4
213
+ - uses: actions/setup-python@v5
214
+ with:
215
+ python-version: "3.12"
216
+ - run: pip install envgap
217
+ - run: envgap check --ci
218
+ ```
219
+
220
+ ## Example Diagnosis
221
+
222
+ Given:
223
+
224
+ ```dotenv
225
+ # .env
226
+ DB_URL=postgres://localhost/app
227
+ OPENAI_API_KEY=changeme
228
+ ```
229
+
230
+ ```dotenv
231
+ # .env.example
232
+ DATABASE_URL=
233
+ OPENAI_API_KEY=your-key-here
234
+ ```
235
+
236
+ ```python
237
+ # app.py
238
+ import os
239
+
240
+ DATABASE_URL = os.environ["DATABASE_URL"]
241
+ DEBUG = os.getenv("DEBUG", "false")
242
+ ```
243
+
244
+ `envgap` can report:
245
+
246
+ - `DATABASE_URL` is required in code but missing from `.env`
247
+ - `DB_URL` may be a typo for `DATABASE_URL`
248
+ - `OPENAI_API_KEY` still looks like a placeholder
249
+ - `DEBUG` is optional because it has a default
250
+
251
+ ## Why Not Just python-dotenv?
252
+
253
+ `python-dotenv` loads environment variables.
254
+
255
+ `envgap` explains whether the environment variables your app expects match the variables your project defines and documents.
256
+
257
+ The useful question is not only:
258
+
259
+ > Did `.env` load?
260
+
261
+ It is:
262
+
263
+ > What does my app expect, where should it come from, and why is it missing or wrong here?
264
+
265
+ ## Current Scope
266
+
267
+ This is intentionally a small diagnostic tool, not a config framework.
268
+
269
+ In scope now:
270
+
271
+ - `.env`
272
+ - `.env.example`
273
+ - shell environment
274
+ - Python `os.environ` / `os.getenv` scanning
275
+ - terminal and JSON reports
276
+ - CI-friendly exit codes
277
+
278
+ Not in scope yet:
279
+
280
+ - loading or mutating your environment
281
+ - validating every framework-specific settings pattern
282
+ - Docker Compose parsing
283
+ - GitHub Actions secrets parsing
284
+ - Pydantic `BaseSettings` extraction
285
+
286
+ ## Roadmap
287
+
288
+ - Pydantic `BaseSettings` support
289
+ - Django settings helper detection
290
+ - Docker Compose env detection
291
+ - GitHub Actions env/secrets detection
292
+ - precedence explanations for shell vs `.env` vs framework defaults
293
+ - GitHub Actions annotations
294
+ - richer JSON schema for editor and CI integrations
295
+
296
+ ## Development
297
+
298
+ ```console
299
+ python -m venv .venv
300
+ . .venv/bin/activate
301
+ pip install -e ".[dev]"
302
+ pytest
303
+ ```
304
+
305
+ Run the example locally:
306
+
307
+ ```console
308
+ envgap check examples/basic
309
+ ```
310
+
311
+ Run the shell-aware example:
312
+
313
+ ```console
314
+ DATABASE_URL=postgres://shell/app envgap check examples/basic
315
+ ```
316
+
317
+ ## License
318
+
319
+ MIT