This guide provides all necessary instructions for developers who want to:
- Run or contribute to the
dotenv-loaderproject. - Understand the test layout and configuration resolution logic.
- Set up a local development environment.
- Publish the package to PyPI.
- Ensure consistent development and testing practices.
If you plan to submit a pull request or maintain the package — this is your go-to reference.
- Python 3.9 or higher
- Git
pip(Python package manager)- Unix-like system recommended (Linux/macOS) — but Windows is supported.
Optional (but recommended):
venvorvirtualenvpytest,coverage,twine,buildblack,flake8,mypyfor static checks and formatting
git clone https://github.com/dbdeveloper/dotenv-loader.git
cd dotenv-loaderpython3 -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activatepip install -r requirements-dev.txtOr manually:
pip install -e .[dev,test]Optional (for static checking and formatting):
black
flake8
mypypytestpytest -vpytest --cov=dotenv_loader --cov-report=term-missingThe
.coveragercfile (optional) can be added if you want to fine-tune what's included.
To remove Python cache and temporary test files:
find . -type d -name "__pycache__" -exec rm -r {} +
rm -rf .pytest_cache .coverage dist build- Default
.envloading from project root - Use of
DOTPROJECT,DOTSTAGE, andDOTENVoverrides - Custom
config_root,steps_to_project_root, and other arguments - Environment variable vs parameter priority
- Fallbacks and error handling (e.g., missing or invalid files)
- Resolution path combinations via environment or arguments
dotenv-loader/
│
├── src/dotenv_loader/ # Main loader logic
│ └── __init__.py
│
├── tests/ # Tests for full path resolution logic
│ ├── test_dotenv_loader.py
│ ├── proj1/
│ │ └── manage.py
│ ├── proj2/
│ │ ├── app/
│ │ └── manage.py
│ └── dotconfig_root/ # Configs: ~/.config/python-projects (mocked)
│ ├── proj1/.env
│ ├── proj2/.env
│ └── ...
│
├── pyproject.toml # Metadata for PyPI
├── requirements-dev.txt # Dev dependencies
├── .gitignore
├── .coveragerc (optional)
└── CONTRIBUTING.md # This fileEnsure the following before publishing:
- All tests pass.
- Version in
pyproject.tomlis updated. README.mdis correct and well-formatted (rendered by PyPI).LICENSE(MIT) is present.
- Build the package:
python -m build- Inspect the output under
dist/. It should include:
dist/dotenv_loader-X.Y.Z.tar.gz
dist/dotenv_loader-X.Y.Z-py3-none-any.whl
- Upload to PyPI:
twine upload dist/*- (Optional) If publishing for the first time, create an account at https://pypi.org/account/register
- Credentials can be stored in
~/.pypirc. - You can test publishing using TestPyPI by replacing
twine uploadwith:
twine upload --repository-url https://test.pypi.org/legacy/ dist/*Steps 1,2,3 can be automated by executing the script tools/publish.sh
Your ci.yml workflow ensures:
- Tests are run on every
pushandpull_request. - Uses Python 3.9+
- Fails early if tests do not pass.
You can enable code coverage via codecov.io for 100% badges.
- Follow PEP8.
- Write tests for every feature or bug fix.
- Use readable comments and docstrings.
- Follow the structure of existing tests.
This project was created collaboratively by Vladyslav Kozlovskyy with the help of ChatGPT (OpenAI), using models GPT-4o, GPT-4.5, and GPT-3.5 — to combine human clarity with AI precision.