Skip to main content

Layerz

A simple module for creating layers of dependencies.

Installation

Just use pip!:

$ pip install layerz

Usage

from layerz import Layers

dep1 = type("dep1", (object, ), {"dependencies": lambda s, all_deps: []})()
dep2 = type("dep2", (object, ), {"dependencies": lambda s, all_deps: ["dep3"]})()
dep3 = type("dep3", (object, ), {"dependencies": lambda s, all_deps: ["dep1"]})()
dep4 = type("dep4", (object, ), {"dependencies": lambda s, all_deps: ["dep3"]})()
dep5 = type("dep1", (object, ), {"dependencies": lambda s, all_deps: ["dep4", "dep2"]})()

layers = Layers({"dep1": dep1, "dep2": dep2, "dep3": dep3, "dep4": dep4, "dep5": dep5})
layers.add_to_layers("dep5")
for layer in layers.layered:
    # might get something like
    # [("dep5", dep5)]
    # [("dep4", dep4), ("dep2", dep2)]
    # [("dep3", dep3)]
    # [("dep1", dep1)]

When we create the layers, it will do a depth first addition of all dependencies and only add a dep to a layer that occurs after all it’s dependencies.

Cyclic dependencies will be complained about.

Tests

Install locally:

$ pip install -e .
$ pip install -e ".[tests]"

And then use the helper script:

$ ./test.sh

Metadata

Release files for layerz 0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for layerz 0.5
File Size Uploaded Provenance Actions
layerz-0.5.tar.gz 2.0 kB Without provenance Details for layerz-0.5.tar.gz

Release files / layerz-0.5.tar.gz

Download URL layerz-0.5.tar.gz
Size 2.0 kB
Tags Source
SHA-256 checksum
How to use checksums
cfc02e5d2519d3be5b6475c8d032aeac0dd69d98fda10eb9dd847d0ff2547a70
BLAKE2b-256 checksum
How to use checksums
a2d0334ce144224847c2fead1dc92b86eb4719dd81ff665fb3de47ff9733fe14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for layerz 0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.5 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page