Skip to main content

Layer Linter checks that your project follows a custom-defined layered architecture.

Project description

Layer Linter

https://img.shields.io/pypi/v/layer_linter.svg Python versions https://img.shields.io/travis/seddonym/layer_linter.svg https://codecov.io/gh/seddonym/layer_linter/branch/master/graph/badge.svg Documentation Status Updates

Layer Linter checks that your project follows a custom-defined layered architecture.

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 with in 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-linter 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:
    - lowlevelmodule
    - mediumlevelmodule
    - highlevelmodule

From your project root, run:

layer-linter myproject

If your code violates the contract, you will see an error message as follows:

Contracts: 0 kept, 1 broken.
- Broken contract My Layers Contract:
  - myproject.packagetwo.mediumlevelmodule not allowed to import myproject.packagetwo.highlevelmodule.

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.1.0 (2018-06-20)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

layer_linter-0.2.0.tar.gz (23.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

layer_linter-0.2.0-py34,py35,py36-none-any.whl (7.3 kB view details)

Uploaded Python 3.4,py35,py36

File details

Details for the file layer_linter-0.2.0.tar.gz.

File metadata

  • Download URL: layer_linter-0.2.0.tar.gz
  • Upload date:
  • Size: 23.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for layer_linter-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b1071c45af0a6dac2564911cd1d00805dd973f7624c17dac1fac61e481bd51b3
MD5 f3297d4d1a9bf5cb34f58ae87049dc06
BLAKE2b-256 20eacfe3dc28a029e3223bcecbed8fbe09a4314d05ec27326ed57a57942164a4

See more details on using hashes here.

File details

Details for the file layer_linter-0.2.0-py34,py35,py36-none-any.whl.

File metadata

File hashes

Hashes for layer_linter-0.2.0-py34,py35,py36-none-any.whl
Algorithm Hash digest
SHA256 3d707646935b5efe5d1b6259aedbca6ff5985a26c824e964f2be8de4ab4bd337
MD5 1528897829a7812b9c9600c2a0f343e1
BLAKE2b-256 29ed9160e04090fbfd55f2d9c39f29f2381454e2b01e822f6b892147aad97930

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page