Skip to main content

oak-build

A make-like build system written on python

How to use

Create oak_build.py file in your project directory. Every method marked with @task decorator can be called from CLI.

from pathlib import Path

from oak_build import task


@task
def create_file():
    with open(Path("result.txt"), "w") as txt:
        txt.write("test content\n")

To execute create_file task call oak create_file from console.

Task dependencies

You can link dependent tasks with depends_on parameter.

from oak_build import task, run


@task
def unit_tests():
    run("poetry run pytest tests")


@task
def integration_tests():
    run("poetry run pytest integration_tests")


@task(
    depends_on=[
        unit_tests,
        integration_tests,
    ]
)
def tests():
    pass

When oak tests is called oak build will execute unit_tests and integration_tests tasks as well.

CLI params

You can pass parameters to tasks with --param key=value parameter of command line. Oak will try to parse all task function params regarding its annotation type.

Example:

from enum import Enum, auto
from oak_build import task


class TaskEnum(Enum):
    VALUE = auto()


@task
def enum_param(param: TaskEnum):
    pass

Task results

Exit code

All int return value from task will be treated as return code. If return is integer and not zero task will be marked as failed and further execution will be stopped.

from oak_build import task

@task
def exit_code_task():
    return 0

Result dict

All dict return value will be treated as result. Those results can be used in another tasks with tas name prefix (see example below).

from oak_build import task

@task
def source():
    return {
        "result": 123,
    }

@task(depends_on=[source])
def result_consumer(source_result):
    pass

Please note that CLI params have greater priority than arguments deducted from task results.

Code and result

You can return Tuple[int, Dict[str, Any]] from task, and it will be treated as return code and result dict. If code is not zero task is considered failed. The result dict processing is the same as in dict result

Exceptions

If task throws exception it is considered faled and further execution will be stopped.

Examples

For examples see integration tests files and self build oak_file.py.

Metadata

Release files for oak-build 0.1.2.post2

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

Source distribution (sdist)

Source distribution for oak-build 0.1.2.post2
File Size Uploaded Provenance Actions
oak_build-0.1.2.post2.tar.gz 8.7 kB Without provenance Details for oak_build-0.1.2.post2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for oak-build 0.1.2.post2
File Interpreter ABI Platform Actions
oak_build-0.1.2.post2-py3-none-any.whl Python 3 none any Details for oak_build-0.1.2.post2-py3-none-any.whl

Total release size: 18.8 kB

Release files / oak_build-0.1.2.post2.tar.gz

Download URL oak_build-0.1.2.post2.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c1f216005fc55a17af975106b1ad6422167bab881d3a8265976c3f580de5ae10
BLAKE2b-256 checksum
How to use checksums
d493c36d8d71702018f571772d14178742044271145e55b8ac4b7ebbeaf92b73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / oak_build-0.1.2.post2-py3-none-any.whl

Download URL oak_build-0.1.2.post2-py3-none-any.whl
Size 10.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae5ef2dbb3b505061988e9bf8bcfc3da7d6eb281752b3a28dbbdbbcf8bd1202f
BLAKE2b-256 checksum
How to use checksums
279430c61274b23659bb810bc24d6723f7c6461400cbca16d9922fe1b6e36e8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Security for oak-build 0.1.2.post2

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.

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