Skip to main content

A build tool for multiple Python projects in a single repository

Project description

PBT

pbt — A build tool for multiple Python projects in a single repository

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 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 [-d] [-v] [-p <package>]
  • -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. 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

pbt-2.12.0.tar.gz (31.9 kB view details)

Uploaded Source

Built Distribution

pbt-2.12.0-py3-none-any.whl (40.1 kB view details)

Uploaded Python 3

File details

Details for the file pbt-2.12.0.tar.gz.

File metadata

  • Download URL: pbt-2.12.0.tar.gz
  • Upload date:
  • Size: 31.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.16

File hashes

Hashes for pbt-2.12.0.tar.gz
Algorithm Hash digest
SHA256 26a1728c7ba6867e1eae7a39026727db4d155eb547f2f145dfe297e04cec2365
MD5 11d605c229c65b11801775f478e82cb9
BLAKE2b-256 30d4532c929b5b64121fd86da054a19b4dac7a9a4071f8398ba4e853ab828191

See more details on using hashes here.

File details

Details for the file pbt-2.12.0-py3-none-any.whl.

File metadata

  • Download URL: pbt-2.12.0-py3-none-any.whl
  • Upload date:
  • Size: 40.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.16

File hashes

Hashes for pbt-2.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a5da77b09da95ba96608236dab08090bf9a10452fe4ea73e2ff3bb549d91d0bb
MD5 52246a79cd35eeddcd879ae3a5b68ff5
BLAKE2b-256 16c7315a9b6ee3930ca03eed05eaf88a607ceabd18be18d26fbf14e7f4363ba7

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