Skip to main content

A python framework for developing artifact linters

Project description

artifact-lint-py

artifact-lint-py

Test Sec Doc Build

A python framework for developing artifact linters

Docs: https://whatsacomputertho.github.io/artifact-lint-py/

Contributing: CONTRIBUTING.md

Quick Example

from lint.rule import LintRule
from lint.result import LintResult
from lint.status import LintStatus

class IntegerIsEven(LintRule[int]):
    def lint(self, artifact: int) -> LintResult:
        if artifact % 2 == 0:
            return LintResult(
                status=LintStatus.INFO,
                message=f"({self.name()}) Integer was even: {artifact}"
            )
        return LintResult(
            status=LintStatus.ERROR,
            message=f"({self.name()}) Integer was odd: {artifact}"
        )
integer_is_even = IntegerIsEven()

# Lint an even integer
even_result = integer_is_even.lint(2)
print(even_result)

# Lint an odd integer
odd_result = integer_is_even.lint(337)
print(odd_result)

To run this example, simply execute the following from the root of this repository

python3 examples/quick-example.py

Installation

Using Pip

Run the following command to install the latest version of this package

pip install artifact-lint-py

Local Install

  1. Clone this repository
  2. Build the project from source
  3. Locate the .whl (wheel) file in the dist folder
    • It should be named something like so: artifact_lint_py-1.0.0-py3-none-any.whl
  4. Run the following command from the root of the repository, replacing the name of the .whl file if necessary
    pip install dist/artifact_lint_py-1.0.0-py3-none-any.whl
    

Build

From the root of this repository, execute

make build

Under the hood, this will execute python3 -m build and produce a .whl (wheel) and .tgz (TAR-GZip archive) file in the dist subdirectory. For more on this project's make recipes, see CONTRIBUTING.md.

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

artifact_lint_py-1.0.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

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

artifact_lint_py-1.0.0-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file artifact_lint_py-1.0.0.tar.gz.

File metadata

  • Download URL: artifact_lint_py-1.0.0.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for artifact_lint_py-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0cb828bed9a733b3fe5aabd398dcff5a30dbd4faff893a0b8835da340e8db76c
MD5 a829bc7a8dd7a0586c4bf6aef75547f5
BLAKE2b-256 a05735905bc9554f3c23c3909eed9b0c70f433d6c8abd120f262bf2968ee8e95

See more details on using hashes here.

File details

Details for the file artifact_lint_py-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for artifact_lint_py-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 382c4d0f20a7b4fe90e64bb8e680c5a97c48c9340f5d6815e6944a40f16dae47
MD5 17fb32c271591b5c741199ebbbfde64d
BLAKE2b-256 48a8750ac3c7f8151dfc412a56f402b477062a1ee0c3a404ac060e8a598f7882

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