Layer Linter checks that your project follows a custom-defined layered architecture.
Project description
Layer Linter
Layer Linter checks that your project follows a custom-defined layered architecture.
Free software: BSD license
Documentation: https://layer-linter.readthedocs.io.
Overview
Layer Linter can be used as part of an automated test suite to check that you are following a self-imposed layered architecture within your Python project. This is particularly useful if you are working on a complex codebase within a team, when you want to enforce a particular architectural style.
To define how layers work within your project, you create a layers.yaml file. This file prescribes the order in which different modules within your project may import from each other.
Running the layer-lint command will parse the file, analyse your project’s internal dependencies within your project, and error if you are violating your prescribed architecture.
Quick start
Install Layer Linter:
pip install layer-linter
Create a layers.yaml in the root of your project, in this format:
My Layers Contract:
packages:
- myproject.packageone
- myproject.packagetwo
- myproject.packagethree
layers:
- highlevelmodule
- mediumlevelmodule
- lowlevelmodule
From your project root, run:
layer-lint myproject
If your code violates the contract, you will see an error message as follows:
============
Layer Linter
============
---------
Contracts
---------
Analyzed 23 files, 44 dependencies.
-----------------------------------
My layer contract BROKEN
Contracts: 0 kept, 1 broken.
----------------
Broken contracts
----------------
My layer contract
-----------------
1. myproject.packagetwo.lowlevelmodule imports myproject.packagetwo.highlevelmodule:
myproject.packagetwo.lowlevelmodule <-
myproject.utils <-
myproject.packagetwo.highlevelmodule
History
0.1.0 (2018-06-20)
First release on PyPI.
0.2.0 (2018-06-23)
Look for layers.yaml in current working directory.
0.3.0 (2018-06-24)
Rename command to layer-lint.
Changed order of layers in layers.yaml to be listed high level to low level.
0.4.0 (2018-07-22)
Made dependency analysis more efficient and robust.
Improved report formatting.
Removed illegal dependencies that were implied by other, more succinct illegal dependencies.
Added --debug command line argument.
0.5.0 (2018-08-01)
Added count of analysed files and dependencies to report.
Fixed issues from running command in a different directory to the package.
Increased speed of analysis.
Changed --config_directory command line argument to --config-directory.
0.6.0 (2018-08-07)
Added ability to whitelist paths.
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 layer_linter-0.6.1-py34,py35,py36-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 292d0ea497422291a9fdb5a587d965fcde27a0cefb023324f26e351907755dc4 |
|
MD5 | e1909c0cdfb612d20ff4fa035b042e97 |
|
BLAKE2b-256 | 8308eb03942a3545ba41ed8af504b8a9b362ed00006ea3b3cb1630c4bc2bbec0 |