Skip to main content

A no-frills build script framework.

Introduction

This project provides a Python 3.3+ library/utility for creating build scripts. The main features of Ubuild are:

  • Streamlines the discoverability of build steps/tasks.

  • Build step/task details are captured in Python functions.

  • Provides a CLI menu to show available build steps/tasks.

  • Provides a CLI utility ubuild to locate and run build scripts.

Status

Currently, this project is in the development release stage. While this project is suitable for use, please note that there may be incompatibilities in new releases.

Release notes are maintained in the project changelog.

Requirements

Ubuild should run on any Python 3.3+ interpreter with some additional third-party libraries (installed automatically).

Installation

Ubuild is available on PyPI here and can be installed with pip using the following command: pip install ubuild

Additionally, Ubuild can be installed from source by running: python setup.py install

Usage

Create a _Build.py file. Import ubuild and use the menu decorator to add functions to the build menu. Use the main function to show the menu. For example:

from ubuild import menu, main

@menu
def build():
    ...

@menu
def clean():
    ...

main()

Running this script will show the following menu:

-- MENU --
  (b) Build
  (c) Clean
  (q) Quit
[!] Menu loops until quit.
[?] Enter menu selection:

By default, the menu entry names are based off the function name. For example:

  • something() = (s) Something

  • do_something() = (ds) Do Something

  • do_something_else() = (dse) Do Something Else

However the names will attempt to use the shortest available name, e.g. (ds) Do Something will be (d) Do Something if there is no existing (d) entry.

Because Ubuild is meant to be lightweight and capture build step details, often it might be useful to use Auxly to call other utilities. For example:

@menu
def build():
    return auxly.shell.call("make")

Note the return on the call. This allows the exit code from the make call to propagate up through to Ubuild, i.e. if the menu is quit after the call, the exit code for Ubuild will be the make exit code.

The ubuild command line utility can be used in two different ways:

  1. Calling ubuild without arguments in a directory with _Build.py or any of the child directories will show the Ubuild menu.

  2. Calling ubuild with arguments in a directory with _Build.py or any of the child directories will run that menu entry, e.g. ubuild b.

A few additional notes about the menu decorator:

@menu("x")  # (x) Build
def build():
    ...

@menu(name="x")  # (x) Build
def build():
    ...

@menu(desc="Something")  # (s) Something
def build():
    ...

@menu("x", desc="Something")  # (x) Something
def build():
    ...

@menu(desc="Flag Set", args=[True])     # (fs) Flag Set
@menu(desc="Flag Clear", args=[False])  # (fc) Flag Clear
def build(flag):
    ...

@menu(desc="Flag Clear", kwargs={'flag':False})  # (fc) Flag Clear
def build(flag=True):
    ...

Here are some real-world examples of Ubuild in action:

Alternative Script Names

The default Ubuild script name is _Build.py but occasionally it might make sense to have an alternative name. The script must match the following regex:

_[A-Z][A-z0-9_-]*\.py$

The script must also contain the following line exactly without any changes or trailing whitespace:

# -*- ubuild -*-

Similar

The following projects are similar and may be worth checking out:

FAQ

Why _Build.py for script names?

  • This project follows the naming guidelines provided by the Unified Style Guide for naming user scripts. The name is meant to distinguish this script as being intended for direct user interaction. For example, a name like build.py is not clear whether it is mean for a user or if it is called by something else.

Is Ubuild intended to replace other build tools?

  • No, not at all! In fact, Ubuild is intended to supplement other build tools by providing a simple abstraction layer for performing build tasks. For example, a project may start using make to organize builds but later move to scons. By using Ubuild to capture the build step details, a user need never be aware of the change. They just see the build entry in the Ubuild menu.

Metadata

Release files for ubuild 0.2.0

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

Source distribution (sdist)

Source distribution for ubuild 0.2.0
File Size Uploaded Provenance
ubuild-0.2.0.tar.gz 5.4 kB Without provenance Details

Release files / ubuild-0.2.0.tar.gz

Download URL ubuild-0.2.0.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
83a18a39eee1f9b399b736045d2ed460140343355f188c76e6e92787c2233716
BLAKE2b-256 checksum
How to use checksums
acbce5daa25a8435fadf2d63b34d89589a3badd0602116959747474cdc955612
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.6

Security for ubuild 0.2.0

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.

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