Skip to main content

A build tool for multi-projects that leverages package registries (pypi, npmjs, etc.)

Project description

PBT

pbt — a build tool for multi-packages that leverages package registries (pypi, npmjs, etc.).

PyPI Python GitHub Issues Contributions welcome License

Introduction

Having all packages in the same repository make it much easier to develop, share, reuse, and refactor code. Building and publishing the packages should not be done manually because it is time-consuming and may be frustrated if the projects are depending on each other. pbt is a tool designed to help make the process easier and faster. It supports building, installing, and updating versions of your packages and their dependencies consistently. It also provides utility commands to help you work with your packages in multi-repositories as if you are working with a monorepo.

Installation

pip install -U pab  # not pbt

Usage

Note: currently, pbt supports Python packages configured with Poetry (an awesome dependency management that you should consider using).

Assuming that you organized your packages to different sub-folders, each has their own project configuration file (e.g., pyproject.toml). You can run the following commands in the root directory (containing your projects). Note: pbt will discover the project based on the project name in its configuration file not the folder name.

You can also discover the list of commands by running pbt --help. Many commands have an option --cwd to override the current working directory.

  1. List all packages in the current project, and their dependencies if required
pbt list [-d]
  • -d, --dev: Whether to print to the local (inter-) dependencies
  1. Create virtual environment of a package and install its dependencies
pbt install [-e] [-d] [-v] [-p <package>]
  • -e: install the package, and its local (inter-) dependencies in editable mode
  • -d: also install dev-dependencies of the package
  • -v: verbose
  • -p: specify the package we want to build, if empty build all packages.

If you have encounter some errors during the installation, you can checkout the pyproject.failed.toml file that is generated by pbt in ./cache/<package> folder (relative to your current working directory). For example, on M1 chip, if your python version is ^3.8, you can't use the newer scipy (e.g., >1.8 as it requires python <3.11), poetry lock chooses to use an old version 1.6.0, which typically can't build on M1 due to no pre-built numpy for it.

  1. Update all package inter-dependencies
pbt update
  1. Clean packages' build & lock files
pbt clean [-p <package>]
  • -p: specify the package we want to build, if empty build all packages.
  1. Create setup.py

Generate a setup.py file that can be used to manually install in editable mode as poetry does not provide it out of the box at the time of writing. This is usually used for debugging. Note that if you install pip install -e ., you need to rename the file pyproject.toml temporary so that pip will use setup.py instead of pyproject.toml.

pbt create-setuppy -p <project>
  1. Git clone a multi-repository project
pbt git clone --repo <repo_url>

Clone a repository and check out all of its submodules to their correct branches that we were using last time.

  1. Git update a multi-repository project
pbt git update

Pull latest changes from the repository, and check out all of its submodules to their correct branches.

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

pab-2.4.0.tar.gz (28.5 kB view details)

Uploaded Source

Built Distribution

pab-2.4.0-py3-none-any.whl (35.7 kB view details)

Uploaded Python 3

File details

Details for the file pab-2.4.0.tar.gz.

File metadata

  • Download URL: pab-2.4.0.tar.gz
  • Upload date:
  • Size: 28.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.12

File hashes

Hashes for pab-2.4.0.tar.gz
Algorithm Hash digest
SHA256 daac49d1c0b6f13d55c9ee2bc3cabc5b2b6d3716a496b691331b35253540097b
MD5 5c4da813c6ce4ec7e48950d56b974172
BLAKE2b-256 c2934b864b6ff53ad4dc04b9a26ce1e65cd2b07c44d2f23b697a83e699dc1ba7

See more details on using hashes here.

File details

Details for the file pab-2.4.0-py3-none-any.whl.

File metadata

  • Download URL: pab-2.4.0-py3-none-any.whl
  • Upload date:
  • Size: 35.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.12

File hashes

Hashes for pab-2.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 55fdc4803c3cfcd9636c2e679400178703eb7691001b6538b5468311aa8e0418
MD5 656c893629905dd941fca7cccd52520c
BLAKE2b-256 54350a5d1023dfeadde5e78db0155023c040f9b2964cfe5ff91c90a138f8023c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page