# flitenv
Manage [venvs](https://docs.python.org/3/library/venv.html) and dependencies for [flit](https://flit.pypa.io/en/latest/) projects.
Features:
+ Supports the most modern metadata format described in [PEP 621](https://peps.python.org/pep-0621/).
+ Locks dependencies using [pip-tools](https://github.com/jazzband/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
```bash
python3 -m pip install flitenv
```
## Usage
Basics:
1. The project stores metadata in a [flit](https://flit.pypa.io/en/latest/)-compatible format, [as described in the flit documentation](https://flit.pypa.io/en/latest/pyproject_toml.html). The recommended ways is to us the new `[project]` section introduced in [PEP 621](https://peps.python.org/pep-0621/).
1. Direct required production dependencies of the project are described in `dependencies` list. This environment is called `main`.
1. Development environments are described in the `[project.optional-dependencies]` section. Good examples of such environments are `test`, `lint`, and `doc`.
1. For each environment, flitenv will create a separate [venv](https://docs.python.org/3/library/venv.html) in `.venvs` to ensure a good isolation.
1. "Lock file" is a file with exact versions of all dependencies of the project in the given environment, including the transitive ones.
1. Flitenv uses [requirements.txt](https://pip.pypa.io/en/stable/user_guide/#requirements-files) files generated by [pip-tools](https://github.com/jazzband/pip-tools) as lock files.
1. It is recommend to generate a lock file for (and only for) the `main` environment.
1. 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 install lint`: 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 run lint flake8`: run a command. If the venv doesn't exist, it will be created, and the dependencies will be installed.
+ `flitenv lock lint`: generate lock file (`requirements-lint.txt`) for the env.
+ `flitenv main lock`: generate lock file (`requirements.txt`) for the `main` 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 install lint`: 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.
Raw data
{
"_id": null,
"home_page": "https://github.com/orsinium-labs/flitenv",
"name": "flitenv",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "flit,venv",
"author": "Gram",
"author_email": "gram@orsinium.dev",
"download_url": "https://files.pythonhosted.org/packages/62/ef/7084d1601ac972a2bd63e48c6b29dbd222ac68c70b65257336128ba99a4e/flitenv-0.4.0.tar.gz",
"platform": null,
"description": "# flitenv\n\nManage [venvs](https://docs.python.org/3/library/venv.html) and dependencies for [flit](https://flit.pypa.io/en/latest/) projects.\n\nFeatures:\n\n+ Supports the most modern metadata format described in [PEP 621](https://peps.python.org/pep-0621/).\n+ Locks dependencies using [pip-tools](https://github.com/jazzband/pip-tools).\n+ Multiple venvs per project to ensure a better isolation of environments.\n+ No vendor lock, under-the-hood uses popular and well-maintained technologies and tool-agnostic formats.\n+ Cross-platform.\n+ Battle-tested.\n\n## Installation\n\n```bash\npython3 -m pip install flitenv\n```\n\n## Usage\n\nBasics:\n\n1. The project stores metadata in a [flit](https://flit.pypa.io/en/latest/)-compatible format, [as described in the flit documentation](https://flit.pypa.io/en/latest/pyproject_toml.html). The recommended ways is to us the new `[project]` section introduced in [PEP 621](https://peps.python.org/pep-0621/).\n1. Direct required production dependencies of the project are described in `dependencies` list. This environment is called `main`.\n1. Development environments are described in the `[project.optional-dependencies]` section. Good examples of such environments are `test`, `lint`, and `doc`.\n1. For each environment, flitenv will create a separate [venv](https://docs.python.org/3/library/venv.html) in `.venvs` to ensure a good isolation.\n1. \"Lock file\" is a file with exact versions of all dependencies of the project in the given environment, including the transitive ones.\n1. Flitenv uses [requirements.txt](https://pip.pypa.io/en/stable/user_guide/#requirements-files) files generated by [pip-tools](https://github.com/jazzband/pip-tools) as lock files.\n1. It is recommend to generate a lock file for (and only for) the `main` environment.\n1. 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.\n\nBelow are usage examples. Each example uses `lint` as the target environment and `flake8` as a command we want to run in this environment.\n\n+ `flitenv install lint`: 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.\n+ `flitenv run lint flake8`: run a command. If the venv doesn't exist, it will be created, and the dependencies will be installed.\n+ `flitenv lock lint`: generate lock file (`requirements-lint.txt`) for the env.\n+ `flitenv main lock`: generate lock file (`requirements.txt`) for the `main` env. If there is no env-specific lock file, this one will be used instead.\n+ `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.\n+ `rm requirements.txt && flitenv main lock`: upgrade all dependencies in the lock file.\n+ `rm -rf .venvs/lint && flitenv install lint`: re-create the venv. It is usefult to ensure that all old dependencies.\n+ `flit build`: build a distribution for the project.\n+ `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.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Manage venvs for a flit project",
"version": "0.4.0",
"project_urls": {
"Homepage": "https://github.com/orsinium-labs/flitenv"
},
"split_keywords": [
"flit",
"venv"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "f04029af88c32930ddf237dcb837d6b6a480ef43725a0822b6ae92713c451b56",
"md5": "96b83e7072b7eeba20503781d32c3629",
"sha256": "6a6ded123ca3545851a045cdffc7e82f6a46640fd0488f88df7b751d0b2bd6f6"
},
"downloads": -1,
"filename": "flitenv-0.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "96b83e7072b7eeba20503781d32c3629",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 11811,
"upload_time": "2023-07-10T12:12:52",
"upload_time_iso_8601": "2023-07-10T12:12:52.519579Z",
"url": "https://files.pythonhosted.org/packages/f0/40/29af88c32930ddf237dcb837d6b6a480ef43725a0822b6ae92713c451b56/flitenv-0.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "62ef7084d1601ac972a2bd63e48c6b29dbd222ac68c70b65257336128ba99a4e",
"md5": "b1bb2b0c74f33960e7bcd73e9dcbb308",
"sha256": "737f07f3e58e453ad0b46db59b4a4ade02a5016ddbbb62f8fd414d54b8379da1"
},
"downloads": -1,
"filename": "flitenv-0.4.0.tar.gz",
"has_sig": false,
"md5_digest": "b1bb2b0c74f33960e7bcd73e9dcbb308",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 10533,
"upload_time": "2023-07-10T12:12:54",
"upload_time_iso_8601": "2023-07-10T12:12:54.428758Z",
"url": "https://files.pythonhosted.org/packages/62/ef/7084d1601ac972a2bd63e48c6b29dbd222ac68c70b65257336128ba99a4e/flitenv-0.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-10 12:12:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "orsinium-labs",
"github_project": "flitenv",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "flitenv"
}