TODO: Add description
Project description
__init__
file checker
Tool that ensures that __init__.py
files are not missing.
Installation
pip install init-file-checker
Installation requires Python 3.8.5 or higher.
Usage
A sample command that checks presence of __init__.py
files is:
init-file-checker my_project/
If you want to add missing __init__.py
files, add --add-missing
option:
init-file-checker --add-missing my_project/
License
MIT
Development setup
-
Make sure you have brew package manager installed.
-
Install pyenv, pyenv-virtualenv and poetry:
brew install pyenv brew install pyenv-virtualenv brew install poetry
-
Add the following lines to
.zshrc
or.bash_profile
and restart the terminal:# Pyenv settings export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" eval "$(pyenv init --path)" eval "$(pyenv virtualenv-init -)"
-
Create Python virtual environment with the correct Python version:
make install-python make create-environment
-
Install all dependencies
make install-dependencies
If you need to delete the Python virtual environment, you can do so with the
command make delete-environment
.
Running unit tests and code checks
If you make code change, run unit tests and code checks with the command:
make clean whitespace-format-check isort-check black-check flake8 pydocstyle pylint ruff mypy test coverage
or, equivalently, with the command:
make clean lint test coverage
Each make target runs different checks:
clean
deletes temporary fileswhitespace-format-check
runs whitespace-format checker on all filesisort-check
runs isort checker of imports in*.py
filesblack-check
runs black code format checker on*.py
filesflake8
runs flake8 code style checker on*.py
filespydocstyle
runs pydocstyle docstring checker on*.py
filespylint
runs pylint code checker on*.py
filesruff
runs ruff code checker on*.py
filesmypy
runs mypy type checker on*.py
filestest
runs unit testscoverage
generates code coverage reportlint
runs all code checks
You can automatically format code with the command:
make isort-format black-format whitespace-format
Modifying dependencies
The list of Python packages that this project depends on is specified in
pyproject.toml
and in poetry.lock
files. The file pyproject.toml
can be
edited by humans. The file poetry.lock
is automatically generated by poetry
.
Install a development dependency with the command:
poetry add --dev <some_new_python_tool>
Install a new production dependency with the command:
poetry add <some_python_library>
Manual modification of pyproject.toml
Instead of using poetry add
command, you can edit pyproject.toml
file. Then,
regenerate poetry.lock
file with the command:
poetry lock
or the command:
poetry lock --no-update
The latter command does not update already locked packages.
Fixing broken Python environment
If your Python virtual environment becomes broken or polluted with unnecessary packages, delete it, recreate it from scratch and install dependencies a fresh with the following commands:
make delete-environment
make create-environment
make install-dependencies
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for init_file_checker-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ccb5e29fd1f119f856af477c90c9343677110cff3b8dd028ae2bf19c43b9a489 |
|
MD5 | ecc8db5b8434620bdc0c749805c5d830 |
|
BLAKE2b-256 | add5f5dd8bd3373a4227c594a6fb60970a6aebeea52ebfc899fce9089738b2be |