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.1-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.1-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.1.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.1-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: artifact_lint_py-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 73617627887706839915f1aa8450f9217aa375e6367047761603c22e1fd40089
MD5 2cbaf53222b40481e7b627937a09aefc
BLAKE2b-256 54ed77aef477bf3e990957ef42c6c4e272c8331bf5713110f5378c1c184f7ac8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for artifact_lint_py-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f774e12b8199ec8858b3799de5e6f72102b701ef0fa3882c67638c04ebb8e415
MD5 489b90edd35962b0d9528790ade228ed
BLAKE2b-256 7913647dfc67570c78ba74b8c8995c5af9ca3013a45d11ec02b255c3cc3f2c9d

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