Manage venvs for a flit project
Project description
flitenv
Manage venvs and dependencies for flit projects.
Features:
- Supports the most modern metadata format described in PEP 621.
- Locks dependencies using pip-tools.
- Multiple venvs per project to ensure a better isolation of environments.
- No vendor lock, under-the-hood uses popular and well-maintained technologies and tool-agnostic formats.
- Cross-platform.
- Battle-tested.
Installation
python3 -m pip install flitenv
Usage
Basics:
- The project stores metadata in a flit-compatible format, as described in the flit documentation. The recommended ways is to us the new
[project]
section introduced in PEP 621. - Direct required production dependencies of the project are described in
dependencies
list. This environment is calledmain
. - Development environments are described in the
[project.optional-dependencies]
section. Good examples of such environments aretest
,lint
, anddoc
. - For each environment, flitenv will create a separate venv in
.venvs
to ensure a good isolation. - "Lock file" is a file with exact versions of all dependencies of the project in the given environment, including the transitive ones.
- Flitenv uses requirements.txt files generated by pip-tools as lock files.
- It is recommend to generate a lock file for (and only for) the
main
environment. - flitenv follows the flit philosophy. It provides only the most helpful and flexible commands, and you can do anything you ever need by combining them with each other and with other tools.
Below are usage examples. Each example uses lint
as the target environment and flake8
as a command we want to run in this environment.
flitenv lint install
: install dependencies. If the venv doesn't exist, it will be created. Can also be used to upgrade dependencies when the lock file has been changed.flitenv lint run flake8
: run a command. If the venv doesn't exist, it will be created, and the dependencies will be installed.flitenv lint lock
: generate lock file (requirements-lint.txt
) for the env.flitenv main lock
: generate lock file (requirements.txt
) for themain
env. If there is no env-specific lock file, this one will be used instead.flitenv main lock -c ../other-project/requirements.txt
: generate lock file using lock file from another project as a reference. It allows to ensure compatibility of lock files accross multiple projects.rm requirements.txt && flitenv main lock
: upgrade all dependencies in the lock file.rm -rf .venvs/lint && flitenv lint install
: re-create the venv. It is usefult to ensure that all old dependencies.flit build
: build a distribution for the project.flit install --symlink --python $(which python3.9) --deps=none
: symlink the project into the given Python interpreter without installing dependencies. It is helpful if you want to have nice go-to-definition in vscode across multiple projects.
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
flitenv-0.3.4.tar.gz
(7.8 kB
view details)
Built Distribution
File details
Details for the file flitenv-0.3.4.tar.gz
.
File metadata
- Download URL: flitenv-0.3.4.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.28.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c008aae6aa014756d71a987d1615ec956a6f5fb7f94786ab537814c5c285792 |
|
MD5 | 5be7bfb54b20e27a39fa0c347a182b62 |
|
BLAKE2b-256 | 20ab3185fe5532a2a7dbf9d50e8dbada47b5dec52ceb4751fc52b5f6e7ce4726 |
File details
Details for the file flitenv-0.3.4-py3-none-any.whl
.
File metadata
- Download URL: flitenv-0.3.4-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6954d5a3e50c6a394673c82b0f5dabb677cd2ac013daa829e35ce5b4f305db13 |
|
MD5 | 81df8c45d2ed3f66a2bfa2104bb43931 |
|
BLAKE2b-256 | 5bf97b2fefa53a780eefcea71051d75d85b51857b4fb49d94ef1cb9a8f00f8c7 |