# `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 @ master (pushed package from master branch as `quara-poetry-core-next` on 2022/03/03)
## `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 of `project.yml` and the monorepo `pyproject.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](https://www.python.org/dev/peps/pep-0660/))
> Packages are **not installed using Poetry**. Instead, `pip` is used to install packages in editable mode. This is possible using the master branch of `poetry-core` (not released yet) which supports PEP 660 as `build 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:
```bash
k venv
```
- Update pip toolkit within a virtual environment
```bash
k venv update
```
- Run a command within the virtual environment
```bash
k run python -c "import sys; print(sys.executable)"
```
## Global actions
- Install all projects:
```bash
k install
```
- Install only two projects (and their dependencies)
```bash
k install pkg1 pkg2
```
- Build all projects
```bash
k build
```
- Build only two projects
```bash
k build pkg1 pkg2
```
## Projects actions
- Add a project dependency (run the command from the package directory)
```bash
k project add package@version # @version is optional
```
- Install the current project
```bash
k project install
```
- Show project dependencies
```bash
k project show [--latest] [--outdated] [--tree]
```
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
共40个文件
py:36个
toml:1个
typed:1个
资源分类:Python库 所属语言:Python 资源全名:kapla-cli-v2-0.8.0.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
资源推荐
资源详情
资源评论
收起资源包目录
kapla-cli-v2-0.8.0.tar.gz (40个子文件)
kapla-cli-v2-0.8.0
PKG-INFO 4KB
kapla
core
logger.py 1KB
io.py 2KB
timeout.py 1KB
errors.py 2KB
__init__.py 132B
finder.py 7KB
windows.py 40B
base.py 11KB
cmd.py 22KB
py.typed 0B
specs
common.py 2KB
repo.py 790B
lock.py 893B
kproject.py 733B
__init__.py 158B
base.py 4KB
pyproject.py 2KB
__main__.py 68B
__init__.py 0B
projects
kproject.py 31KB
__init__.py 0B
krepo.py 27KB
pyproject.py 12KB
wrappers
git.py 2KB
poetry.py 11KB
__init__.py 0B
cli
build.py 1KB
app.py 3KB
repair.py 525B
project.py 10KB
licenses.py 3KB
list.py 1KB
run.py 612B
__init__.py 40B
install.py 3KB
venv.py 815B
pyproject.toml 979B
setup.py 4KB
README.md 3KB
共 40 条
- 1
资源评论
挣扎的蓝藻
- 粉丝: 13w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功