Another build tool
Project description
Installation
Using Pip
pip install parts
Or using the self-contained executable
./parts
Introduction
Parts is a build dependency and execution tool heavily inspired by SCons, bitbake, GitLab-CI among others.
The motivation for parts was the scale of a particular project being managed which had components larger and more independent than a typical SCons or Makefile targets; but not requireing the external package and configuration management provided by bitbake. These existing solution either felt awkward or overkill.
Parts intends to provide a simple, lightweight dependency tree API and runtime to build these medium sized projects. The command line interface and interation will feel very familiar.
Example
Assuming a folder structure
./parts.def
./module/parts.def
# parts.def
mod = include('module')
default(mod['library']) # use the instance of Module created in module/parts.def
# module/parts.def
import asyncio
from parts import BuildStep
class Module(BuildStep):
async def do_step(self):
self.update_progress(total=100, phase='running')
self.log.info(f'Running Module: {self.name}')
for i in range(100):
self.update_progress(advance=1, phase=f'loop {i:d}')
await asyncio.sleep(0.1) # do some work
self.log.info(f'Completed Module: {self.name}')
Module('library') # automatically registers target with name 'library'
Running
parts --no-cache
will result in
[11:29:56] INFO Building ['default']... parts
INFO Running Module: library library
[11:30:06] INFO Completed Module: library library
╭──────────────────────────────────────────────────────╮
│ 0:00:10 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/1 │
╰──────────────────────────────────────────────────────╯
INFO Complete parts
Design Goals
- parts.def use Python syntax with some shortcuts
- File paths are relative to the parts.def that references them
- BuildStep is the unit of work used by parts
- (sub)projects define all their BuildStep objects in a parts.def
- Build objects are useable by include()'ing another parts.def
- Build objects can be reproduced out of context if their input/output artefacts match (to enable distribution over multiple hosts)
- One parts.def can reference object instances created from an included parts.def
- BuildSteps can be used to communicate configuration options to depenent steps
Running parts
From within the toplevel of a project directory, next to a parts.def
parts [targets]
or by specifying the parts.def using --path
parts --path path/to/parts.def
Multiple targets can be specified simultaneously. If no target is provided then
'default' will be run, assuming it was provided by a call the default().
Listing available targets
parts --list
Graphing project dependencies
If graphviz is installed, parts can produce a graph for specific build targets to help visualize project dependencies.
parts --graph target
parts.def Reference
include()
# TODO
source()
# TODO
alias()
# TODO
copy()
# TODO
link()
# TODO
publish()
This will create a BuildStep that copies the given dependencies to the global ouput folder.
publish('a', 'b', BuildStep('c'))
will copy the outputs of task 'a', 'b' and the newly created 'c' to ./output.
alias('all', publish('a', 'b', 'c')
Will create a build target 'all' that publishes the outputs of 'a', 'b' and 'c'.
publish('a', dest='module_a')
Will publish ouputs of 'a' to the ./output/module_a folder.
arg()
# TODO
default()
# TODO
BuildStep
A unit of work in parts is represented by the abstract BuildStep which provides dependency linking with other BuildSteps as well as informative scheduling and execution of each task.
# TODO
Dependencies
# TODO
ProcessStep
# TODO
Elaborate vs Execution
Parts will elaborate all included config files to resolve their dependecies before beginning any execution.
This implies the inputs and outputs for each step must be defined during elaboration and will not change during execution.
While the execution of each step is parallelised (co-routines, though steps will likely produce their own processes), elaboration is serialized and not thread-safe.
Logging and Progress Bars
# TODO
ParseNodes
# TODO
State tracking
# TODO
phony targets
# TODO
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pymoku_parts-0.11.tar.gz.
File metadata
- Download URL: pymoku_parts-0.11.tar.gz
- Upload date:
- Size: 18.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af52411f36636f2a9a4e5e01196d48d0c63051e08c115d45984ccbb9daae7848
|
|
| MD5 |
45ab5fbd8f6c4fbac502e8a25efe23c8
|
|
| BLAKE2b-256 |
e2d4c956d8643d5f787c9b53ac0cf13a882737d3f8f818d2abf501b1505007b2
|
File details
Details for the file pymoku_parts-0.11-py3-none-any.whl.
File metadata
- Download URL: pymoku_parts-0.11-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
168a3e897615483775112c34251ee8f2a4123d8a57ac9276e4b5d0ac457fbc67
|
|
| MD5 |
867966743036a6ad4b4822350d11805d
|
|
| BLAKE2b-256 |
88e42305c42977a55340c3a0219e9589cc84d838773f1e349087a318dd8704df
|