No project description provided
Project description
Helps to prevent import of certain modules from certain modules.
It's useful if you have many modules in your project and want to keep them kind of isolated.
After installing just add import-rules
option to your setup.cfg
file.
[flake8]
...
import-rules=
# yaml format here
- module_one:
- allow module_two
- deny any
- module_two:
- deny module_one.sub.submodule
- module_two.sumbodule:
- deny module_one
- module_three: allow any
# many sectin for the same module are allowed
# for example
- module_two:
- deny some_other_module
# this will prevent any import everywhere
- any:
- deny any
# default behaviour is
- any:
- allow any
...
Rules are checking top-down. The Order Matters.
If current module name match section name or is submodule, then it will check all imports by rules from the section.
There can be one or more rules in section. There can be one or more sections for the same module/submodule.
allow modulepath
- means allow imports from modulepath
and its submodules
deny modulepath
- means deny imports from modulepath
and its submodules.
Keyword any
(or all
) - menas any module (like *
)
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 flake8_import_rules-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | cdb7455d79693a3273beff29d9162313d073ea42d997a13620da1c207eed0d8c |
|
MD5 | d37f9ed6f5fa292be1431a43cb288658 |
|
BLAKE2b-256 | bd763bd6c9204c4c0c609e33e55969dba020b126ccac800fbdfdf12e21cd83b2 |
Hashes for flake8_import_rules-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d0bc9b17eb52d075bff6b09688edb57ee00786156aad528769d774ad65f33d3 |
|
MD5 | 99878bd2fa4fc5a1a02249611244ea16 |
|
BLAKE2b-256 | 586288372a381568832d8c4c61930217272edb4c5fe0cc70afdfc24b5b12e4cf |