Python monorepo package manager
Project description
kapla
project manager
kapla-cli
is a packaging and build system for Python codebases. It can be used to develop several python packages in a single repository, and easily manage shared dependencies accross the packages.
It relies on:
- venv
- pip
- poetry
- poetry-core
poetry
and pip
usage
poetry
is used in order to manage packages dependencies:
- A pyproject.toml must exist at the root of the monorepo.
- This pyproject.toml file use dependency groups to keep track of each package dependencies.
- A single lock file is thus used to pin dependency versions accross all packages. It avoids resolving dependency lock for each package, and shorten time required to update dependencies accross all packages.
- Each package in the monorepo must have a valid
project.yml
file. project.yml
files are written according to a well known schema (KProjectSpec
).- At build or install time,
pyproject.toml
files are generated in each package directory from both the content ofproject.yml
and the monorepopyproject.toml
file. - Packages are either built using
poetry build
. - Or installed using
pip install -e /path/to/package
(aka editable install). (See PEP 660 -- Editable installs for pyproject.toml based builds)
Packages are not installed using Poetry. Instead,
pip
is used to install packages in editable mode. This is possible using the master branch ofpoetry-core
(not released yet) which supports PEP 660 asbuild system
for the editable install.
Why poetry
?
Poetry is really powerful when it comes to declaring and resolving dependencies in a consistent manner. Without it, it would be difficult to ensure that all dependencies versions are compatible together.
Why pip
and editable
install ?
Even though poetry
provides an install feature out of the box, things can become quite slow when working with dozens of project.
Moreover, poetry
provide some support for local dependencies, the experience is far from optimal.
By using pip
to install packages, it's possible to install several local dependencies in parallel without messing with .venv/lib/pythonX.X/site-packages/
directory.
Quick Start
Virtual environment
- Ensure a virtual environment exists at the root of a monorepo:
k venv
- Update pip toolkit within a virtual environment
k venv update
- Run a command within the virtual environment
k run python -c "import sys; print(sys.executable)"
Global actions
- Install all projects:
k install
- Install only two projects (and their dependencies)
k install pkg1 pkg2
- Build all projects
k build
- Build only two projects
k build pkg1 pkg2
Projects actions
- Add a project dependency (run the command from the package directory)
k project add package@version # @version is optional
- Install the current project
k project install
- Show project dependencies
k project show [--latest] [--outdated] [--tree]
Configuration
Respects the use of venv environment variable VIRTUAL_ENV
for the location of
the virtual env should it be different from <project_roo>/.venv
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
File details
Details for the file kapla-cli-v2-0.32.0.tar.gz
.
File metadata
- Download URL: kapla-cli-v2-0.32.0.tar.gz
- Upload date:
- Size: 39.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 434af294d5c65d11cdf21e336f64db4b5f26145c6a5f8a073c52a90dbd0c5202 |
|
MD5 | 4a94bcf7de5713b1a2c57f256d38ce89 |
|
BLAKE2b-256 | 039bf88e5a82fbe11384e605dcefd8411f38455f4b0782978ad8b2bd261db9f3 |
File details
Details for the file kapla_cli_v2-0.32.0-py3-none-any.whl
.
File metadata
- Download URL: kapla_cli_v2-0.32.0-py3-none-any.whl
- Upload date:
- Size: 49.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | de421a09e770d792da1be821805bcb3c90c81e97c767756dfc7f1abb128184ac |
|
MD5 | f22db254440578366f074a149d336f58 |
|
BLAKE2b-256 | 5fcaacf303c1dcd06b272cd98458813ca72e6c36c89098dd0789356bee17a58d |