Skip to content

Commit c58e6eb

Browse files
committed
Bump version to 0.1.6
1 parent 2c4e768 commit c58e6eb

1 file changed

Lines changed: 79 additions & 34 deletions

File tree

README.md

Lines changed: 79 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,82 @@
1-
This project cross-check environment variables used in your Python code against declarations in `.env` and `docker-compose.yml`. And gives the report showing the list of unused environment variable. It is a great package at least i was waiting for a long time.
1+
`envguard` cross-checks the environment variables used in your Python code against those declared in your `.env` and `docker-compose.yml` files.
2+
It reports **unused**, **missing**, and **mismatched** variables — helping you keep your environment configuration clean and consistent.
23

3-
## Install
4+
For example, if you’ve ever had a project with 20 variables in `.env` but only 10 actually used, `envguard` instantly shows you which ones can be safely removed or fixed.
45

5-
````bash
6-
pipx install envguard
7-
# or
6+
---
7+
8+
## Installation
9+
10+
```bash
811
pip install envguard
9-
# docker-compose extras:
12+
# or
13+
pipx install envguard
14+
15+
# with docker-compose support
1016
pip install "envguard[compose]"
17+
```
18+
19+
---
20+
21+
## Usage
22+
23+
From your project root (where `.env` lives):
24+
25+
```bash
26+
envguard .
27+
```
28+
29+
You’ll get a report listing missing, unused, or suspicious environment variables.
30+
31+
Example output:
32+
33+
```
34+
== envguard report ==
35+
unused (2): DATABASE_URL, NOTUSEDAPI_KEY
36+
37+
sources:
38+
API_KEY: .env
39+
DATABASE_URL: .env
40+
DEBUG: .env
41+
NOTUSEDAPI_KEY: .env
42+
```
43+
44+
---
45+
46+
## Configuration (optional)
47+
48+
You can configure defaults globally for your project via a `[tool.envguard]` section in your `pyproject.toml`.
49+
50+
```toml
51+
[tool.envguard]
52+
exclude = [".venv", "venv", "env", ".git", "__pycache__", "dist", "build", "node_modules"]
53+
fail_on = ["missing"]
54+
dotenv = ".env"
55+
include = "*.py"
56+
```
57+
58+
### Options
59+
60+
| Key | Type | Default | Description |
61+
| --------- | ------------------------- | ---------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
62+
| `exclude` | list of strings | `[".venv", "venv", "env", ".git", "__pycache__", "dist", "build", "node_modules"]` | Directories or file patterns to ignore while scanning your code. |
63+
| `include` | string or list of strings | `"*.py"` | Glob pattern(s) of files to include when scanning for environment variable usage. |
64+
| `dotenv` | string | `".env"` | Path to your `.env` file used for validation. |
65+
| `fail_on` | list of strings | `["missing"]` | Determines which findings trigger a non-zero exit code. Options: `"missing"`, `"typos"`, `"bad_values"`, `"unused"`. |
66+
67+
---
68+
69+
## Behavior
70+
71+
- Ignores common directories like `.venv`, `dist/`, `build/`, and `.git/` by default.
72+
- Command-line arguments always override `pyproject.toml`.
73+
- Works seamlessly across macOS, Linux, and Windows.
74+
- Fully supports Python 3.8 → 3.12+.
75+
76+
---
77+
78+
## Project structure
1179

12-
## Project
1380
```
1481
envguard/
1582
├─ src/
@@ -25,36 +92,14 @@ envguard/
2592
├─ pyproject.toml
2693
├─ LICENSE
2794
├─ README.md
28-
├─ .gitignore
2995
└─ .github/
3096
└─ workflows/
31-
└─ test.yml
97+
├─ test.yml
98+
└─ workflow.yml
3299
```
33100

34-
## Configuration
35-
36-
`envguard` can be configured globally for your project using a `[tool.envguard]` section in your `pyproject.toml`.
37-
38-
### Example, Optional project-wide configuration
39-
```toml
40-
[tool.envguard]
41-
exclude = [".venv", "venv", "env", ".git", "__pycache__", "dist", "build", "node_modules"]
42-
fail_on = ["missing"]
43-
dotenv = ".env"
44-
include = "*.py"
45-
````
46-
47-
### Options
48-
49-
| Key | Type | Default | Description |
50-
| --------- | ------------------------- | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
51-
| `exclude` | list of strings | `[".venv", "venv", "env", ".git", "__pycache__", "dist", "build", "node_modules"]` | Directories or file patterns to ignore while scanning your code. |
52-
| `include` | string or list of strings | `"*.py"` | Glob pattern(s) of files to include when scanning for environment variable usage. |
53-
| `dotenv` | string | `".env"` | Path to your `.env` file used for validation. |
54-
| `fail_on` | list of strings | `["missing"]` | Defines which issues should cause a non-zero exit code. Possible values: `"missing"` (variable used in code but not declared), `typos`,`bad_values`, `"unused"` (variable declared but not used). |
101+
---
55102

56-
### Behavior
103+
## License
57104

58-
- By default, `envguard` ignores common virtual environments, build directories, and version control folders.
59-
- You can override any of these defaults in your `pyproject.toml` to fit your project structure.
60-
- Command-line arguments override `pyproject.toml` only when explicitly provided.
105+
**MIT License** – feel free to use, modify, and contribute.

0 commit comments

Comments
 (0)