dotenvcheck


Namedotenvcheck JSON
Version 0.1.9 PyPI version JSON
download
home_pageNone
SummaryCross-check environment variables used in Python code against .env and docker-compose.
upload_time2025-10-23 03:31:01
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords ci devops dotenv env linter
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            `dotenvcheck` cross-checks the environment variables used in your Python code against those declared in your `.env` and `docker-compose.yml` files.
It reports **unused**, **missing**, and **mismatched** variables — helping you keep your environment configuration clean and consistent.

For example, if you’ve ever had a project with 20 variables in `.env` but only 10 actually used, `dotenvcheck` instantly shows you which ones can be safely removed or fixed.

---

## Installation

```bash
pip install dotenvcheck
# or
pipx install dotenvcheck

# with docker-compose support
pip install "dotenvcheck[compose]"
```

---

## Usage

From your project root (where `.env` lives):

```bash
dotenvcheck .
```

You’ll get a report listing missing, unused, or suspicious environment variables.

Example output:

```
== dotenvcheck report ==
unused (2): DATABASE_URL, NOTUSEDAPI_KEY

sources:
  API_KEY: .env
  DATABASE_URL: .env
  DEBUG: .env
  NOTUSEDAPI_KEY: .env
```

---

## Configuration (optional)

You can configure defaults globally for your project via a `[tool.dotenvcheck]` section in your `pyproject.toml`.

```toml
[tool.dotenvcheck]
exclude = [".venv", "venv", "env", ".git", "__pycache__", "dist", "build", "node_modules"]
fail_on = ["missing"]
dotenv = ".env"
include = "*.py"
```

### Options

| Key       | Type                      | Default                                                                            | Description                                                                                                          |
| --------- | ------------------------- | ---------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| `exclude` | list of strings           | `[".venv", "venv", "env", ".git", "__pycache__", "dist", "build", "node_modules"]` | Directories or file patterns to ignore while scanning your code.                                                     |
| `include` | string or list of strings | `"*.py"`                                                                           | Glob pattern(s) of files to include when scanning for environment variable usage.                                    |
| `dotenv`  | string                    | `".env"`                                                                           | Path to your `.env` file used for validation.                                                                        |
| `fail_on` | list of strings           | `["missing"]`                                                                      | Determines which findings trigger a non-zero exit code. Options: `"missing"`, `"typos"`, `"bad_values"`, `"unused"`. |

---

## Behavior

- Ignores common directories like `.venv`, `dist/`, `build/`, and `.git/` by default.
- Command-line arguments always override `pyproject.toml`.
- Works seamlessly across macOS, Linux, and Windows.
- Fully supports Python 3.8 → 3.12+.

---

## Project structure

```
dotenvcheck/
├─ src/
│  └─ envguard/
│     ├─ __init__.py
│     ├─ __main__.py
│     ├─ cli.py
│     ├─ scanner.py
│     ├─ dotenv.py
│     ├─ compose.py
│     └─ report.py
├─ tests/
├─ pyproject.toml
├─ LICENSE
├─ README.md
└─ .github/
   └─ workflows/
      ├─ test.yml
      └─ workflow.yml
```

---

## License

**MIT License** – feel free to use, modify, and contribute.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "dotenvcheck",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "ci, devops, dotenv, env, linter",
    "author": null,
    "author_email": "Dipendra Pant <dipendrapant778@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/21/62/7265a7e561f837cadbc17dc98424222558930698d50dc9f27ad913c79bb1/dotenvcheck-0.1.9.tar.gz",
    "platform": null,
    "description": "`dotenvcheck` cross-checks the environment variables used in your Python code against those declared in your `.env` and `docker-compose.yml` files.\nIt reports **unused**, **missing**, and **mismatched** variables \u2014 helping you keep your environment configuration clean and consistent.\n\nFor example, if you\u2019ve ever had a project with 20 variables in `.env` but only 10 actually used, `dotenvcheck` instantly shows you which ones can be safely removed or fixed.\n\n---\n\n## Installation\n\n```bash\npip install dotenvcheck\n# or\npipx install dotenvcheck\n\n# with docker-compose support\npip install \"dotenvcheck[compose]\"\n```\n\n---\n\n## Usage\n\nFrom your project root (where `.env` lives):\n\n```bash\ndotenvcheck .\n```\n\nYou\u2019ll get a report listing missing, unused, or suspicious environment variables.\n\nExample output:\n\n```\n== dotenvcheck report ==\nunused (2): DATABASE_URL, NOTUSEDAPI_KEY\n\nsources:\n  API_KEY: .env\n  DATABASE_URL: .env\n  DEBUG: .env\n  NOTUSEDAPI_KEY: .env\n```\n\n---\n\n## Configuration (optional)\n\nYou can configure defaults globally for your project via a `[tool.dotenvcheck]` section in your `pyproject.toml`.\n\n```toml\n[tool.dotenvcheck]\nexclude = [\".venv\", \"venv\", \"env\", \".git\", \"__pycache__\", \"dist\", \"build\", \"node_modules\"]\nfail_on = [\"missing\"]\ndotenv = \".env\"\ninclude = \"*.py\"\n```\n\n### Options\n\n| Key       | Type                      | Default                                                                            | Description                                                                                                          |\n| --------- | ------------------------- | ---------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |\n| `exclude` | list of strings           | `[\".venv\", \"venv\", \"env\", \".git\", \"__pycache__\", \"dist\", \"build\", \"node_modules\"]` | Directories or file patterns to ignore while scanning your code.                                                     |\n| `include` | string or list of strings | `\"*.py\"`                                                                           | Glob pattern(s) of files to include when scanning for environment variable usage.                                    |\n| `dotenv`  | string                    | `\".env\"`                                                                           | Path to your `.env` file used for validation.                                                                        |\n| `fail_on` | list of strings           | `[\"missing\"]`                                                                      | Determines which findings trigger a non-zero exit code. Options: `\"missing\"`, `\"typos\"`, `\"bad_values\"`, `\"unused\"`. |\n\n---\n\n## Behavior\n\n- Ignores common directories like `.venv`, `dist/`, `build/`, and `.git/` by default.\n- Command-line arguments always override `pyproject.toml`.\n- Works seamlessly across macOS, Linux, and Windows.\n- Fully supports Python 3.8 \u2192 3.12+.\n\n---\n\n## Project structure\n\n```\ndotenvcheck/\n\u251c\u2500 src/\n\u2502  \u2514\u2500 envguard/\n\u2502     \u251c\u2500 __init__.py\n\u2502     \u251c\u2500 __main__.py\n\u2502     \u251c\u2500 cli.py\n\u2502     \u251c\u2500 scanner.py\n\u2502     \u251c\u2500 dotenv.py\n\u2502     \u251c\u2500 compose.py\n\u2502     \u2514\u2500 report.py\n\u251c\u2500 tests/\n\u251c\u2500 pyproject.toml\n\u251c\u2500 LICENSE\n\u251c\u2500 README.md\n\u2514\u2500 .github/\n   \u2514\u2500 workflows/\n      \u251c\u2500 test.yml\n      \u2514\u2500 workflow.yml\n```\n\n---\n\n## License\n\n**MIT License** \u2013 feel free to use, modify, and contribute.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Cross-check environment variables used in Python code against .env and docker-compose.",
    "version": "0.1.9",
    "project_urls": null,
    "split_keywords": [
        "ci",
        " devops",
        " dotenv",
        " env",
        " linter"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "85f1a9018a6393cb1a029f5d67180ff2582f717392ae1b6e7b8ba733ee7b7710",
                "md5": "ed631d401cc6f0890859fb0e55606a47",
                "sha256": "58af6b1c90e387ce88d2cabdce6ac20a4bbc0f761fd8ecc90cad39154774b712"
            },
            "downloads": -1,
            "filename": "dotenvcheck-0.1.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ed631d401cc6f0890859fb0e55606a47",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 9928,
            "upload_time": "2025-10-23T03:31:00",
            "upload_time_iso_8601": "2025-10-23T03:31:00.014809Z",
            "url": "https://files.pythonhosted.org/packages/85/f1/a9018a6393cb1a029f5d67180ff2582f717392ae1b6e7b8ba733ee7b7710/dotenvcheck-0.1.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "21627265a7e561f837cadbc17dc98424222558930698d50dc9f27ad913c79bb1",
                "md5": "6099522c4e068fc286d4af899be942df",
                "sha256": "36bd6474b9cbe9248d9d45d2cd9074d9690ca0e251682533ba478e0ea02c9a30"
            },
            "downloads": -1,
            "filename": "dotenvcheck-0.1.9.tar.gz",
            "has_sig": false,
            "md5_digest": "6099522c4e068fc286d4af899be942df",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 7417,
            "upload_time": "2025-10-23T03:31:01",
            "upload_time_iso_8601": "2025-10-23T03:31:01.143185Z",
            "url": "https://files.pythonhosted.org/packages/21/62/7265a7e561f837cadbc17dc98424222558930698d50dc9f27ad913c79bb1/dotenvcheck-0.1.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-23 03:31:01",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "dotenvcheck"
}
        
Elapsed time: 2.25872s