Name | pydeps2env JSON |
Version |
1.2.0
JSON |
| download |
home_page | None |
Summary | A python helper to generate conda environment files from project dependencies. |
upload_time | 2024-08-09 16:20:39 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | BSD 3-Clause License Copyright (c) 2022, Cagtay Fabry All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
keywords |
conda
pyproject
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# pydeps2env
An easy way to create conda environment files from you python project dependencies.
Creates a conda `environment.yml` file from python package dependencies listed in on or multiple different source formats like `pyproject.toml`, `setup.cfg`, `environment.yaml` or `requirements.txt` files.
The project contains
- GitHub action
- python package
- command line script
```mermaid
flowchart LR
pyproject.toml --> pydeps2env
setup.cfg --> pydeps2env
environment.yaml --> pydeps2env
requirements.txt --> pydeps2env
pydeps2env --> E2[environment.yaml]
pydeps2env --> R2[requirements.txt]
```
## basic usage (GitHub action)
By default, the action will parse a `pyproject.toml` file in your root directory into `environment.yml`. Here is an example
of a simple setup:
```yaml
steps:
- uses: CagtayFabry/pydeps2env@v1.0.0
```
```toml
[project]
requires-python = ">=3.8,<3.10"
dependencies = [
"numpy >=1.20",
"pandas >=1.0",
"IPython",
"boltons",
]
[project.optional-dependencies]
test = ["pytest"]
pip_only = ["bidict"]
```
The default parameters will output this sorted `environment.yml` (note that the `python` dependency specification will always be the first item on the list):
```yaml
channels:
- defaults
dependencies:
- python>=3.8,<3.10
- boltons
- IPython
- numpy>=1.20
- pandas>=1.0
```
A full output with options `--build_system include --extras test pip_only --pip bidict`
```yaml
channels:
- defaults
dependencies:
- python>=3.8,<3.10
- boltons
- IPython
- numpy>=1.20
- pandas>=1.0
- pytest
- setuptools>=40.9.0
- setuptools_scm
- wheel
- pip:
- bidict
```
## basic usage (python)
Create an `Environment` using Python and export it to an `environment.yaml` file.
```python
from pydeps2env import Environment
env = Environment("./test/pyproject.toml[doc]")
env.export("my_environment.yaml")
```
## basic usage (command line)
Combine multiple source files into a single environment file (including build dependencies).
Install pandas using `pip`.
```bash
pydeps2env ./test/setup.cfg ./test/pyproject.toml[doc] ./test/environment.yaml ./test/requirements.txt -o output.yaml -c defaults --extras test -b include --pip pandas
```
## advanced usage (definition file)
Users can store complex configurations in a single yaml file and create the desired output using `create_from_definition`.
Example definition file:
```yaml
# the target file to create
output: test-configuration.yaml
# default name of the environment
name: test-env
# conda channels to include
channels:
- conda-forge
- defaults
# list of source files that define sub environments
# these will be loaded as Environment()
sources:
- ./test/environment.yaml
- ./test/local.yaml
- ./test/pyproject.toml[doc]
- ./test/requirements.txt
- https://github.com/CagtayFabry/pydeps2env/blob/custom_deps/pyproject.toml
# extras to apply to all sources and packages
extras:
- test
# dependencies that should be removed after collection
remove:
- pyyaml
additional_requirements:
- urllib3
# include build system dependencies
# list of dependencies that must be pip installed (excluding auto-sorted depedencies like urls)
pip:
- urllib3
include_build_system: include
```
## configuration options (GitHub action)
To customize the output the input options are available to the action:
### files
Specify the location of the dependencies files to parse. (defaults to 'pyproject.toml')
Multiple files can be listed. This will result in a combined environment file.
### output:
Specify the location and name of the conda environment file to generate. (defaults to `'environment.yml'`)
### channels:
List the conda channels to include in the environment file. (defaults to `'conda-forge'`)
Separate a list of multiple channels by spaces (e.g. `'conda-forge defaults'`).
### extras:
Specify one or more optional `[extras_require]` sections to add to all the environments (e.g. `'test'` to include package that
you would normally install with `pip install pkg[test]`).
Note that for individual packages, the [extra]` syntax is also possible.
### build_system:
If set to `'include'` the dependencies listed under `[build-system]` (or `[options:setup_requires]` in `setup.cfg`) will be added to the environment (default
is `'omit'` so no setup dependencies will be installed).
### pip
List of packages to install via `pip` instead of `conda`.
The dependencies will be listed under the `pip:` section in the environment file.
If a dependency is listed with its URN, it will always be installed via pip (e.g. `pydeps2env @ git+https://github.com/CagtayFabry/pydeps2env`)
## example
```yaml
steps:
- uses: CagtayFabry/pydeps2env@v1.0.0
with:
files: ./test/pyproject.toml[doc] ./test/setup.cfg # comine both files, add [doc] only for pyproject.toml
output: 'environment_test.yml'
channels: 'conda-forge defaults'
extras: 'test'
build_system: 'include'
pip: 'bidict'
```
```toml
[project]
requires-python = ">=3.8,<3.10"
dependencies = [
"numpy >=1.20",
"pandas >=1.0",
"IPython",
"boltons",
]
[project.optional-dependencies]
test = ["pytest"]
pip_only = ["bidict"]
```
```yaml
channels:
- conda-forge
- defaults
dependencies:
- python>=3.8,<3.10
- boltons
- IPython
- numpy>=1.20
- pandas>=1.0
- pytest
- setuptools>=40.9.0
- setuptools_scm
- sphinx
- wheel
- pip:
- bidict
```
Raw data
{
"_id": null,
"home_page": null,
"name": "pydeps2env",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "conda, pyproject",
"author": null,
"author_email": "\u00c7a\u011ftay Fabry <cagtay.fabry@bam.de>",
"download_url": "https://files.pythonhosted.org/packages/84/37/ad2835e3c69a0f2b38851ff1a2d11e73b9658d217950256d543d51c78733/pydeps2env-1.2.0.tar.gz",
"platform": null,
"description": "# pydeps2env\r\n\r\nAn easy way to create conda environment files from you python project dependencies. \r\nCreates a conda `environment.yml` file from python package dependencies listed in on or multiple different source formats like `pyproject.toml`, `setup.cfg`, `environment.yaml` or `requirements.txt` files.\r\n\r\nThe project contains\r\n- GitHub action\r\n- python package\r\n- command line script\r\n\r\n```mermaid\r\nflowchart LR\r\n pyproject.toml --> pydeps2env\r\n setup.cfg --> pydeps2env\r\n environment.yaml --> pydeps2env\r\n requirements.txt --> pydeps2env\r\n pydeps2env --> E2[environment.yaml]\r\n pydeps2env --> R2[requirements.txt]\r\n```\r\n\r\n## basic usage (GitHub action)\r\n\r\nBy default, the action will parse a `pyproject.toml` file in your root directory into `environment.yml`. Here is an example\r\nof a simple setup:\r\n\r\n```yaml\r\nsteps:\r\n - uses: CagtayFabry/pydeps2env@v1.0.0\r\n```\r\n\r\n```toml\r\n[project]\r\nrequires-python = \">=3.8,<3.10\"\r\ndependencies = [\r\n \"numpy >=1.20\",\r\n \"pandas >=1.0\",\r\n \"IPython\",\r\n \"boltons\",\r\n]\r\n[project.optional-dependencies]\r\ntest = [\"pytest\"]\r\npip_only = [\"bidict\"]\r\n```\r\n\r\nThe default parameters will output this sorted `environment.yml` (note that the `python` dependency specification will always be the first item on the list):\r\n\r\n```yaml\r\nchannels:\r\n - defaults\r\ndependencies:\r\n - python>=3.8,<3.10\r\n - boltons\r\n - IPython\r\n - numpy>=1.20\r\n - pandas>=1.0\r\n```\r\n\r\nA full output with options `--build_system include --extras test pip_only --pip bidict`\r\n\r\n```yaml\r\nchannels:\r\n - defaults\r\ndependencies:\r\n - python>=3.8,<3.10\r\n - boltons\r\n - IPython\r\n - numpy>=1.20\r\n - pandas>=1.0\r\n - pytest\r\n - setuptools>=40.9.0\r\n - setuptools_scm\r\n - wheel\r\n - pip:\r\n - bidict\r\n```\r\n\r\n## basic usage (python)\r\n\r\nCreate an `Environment` using Python and export it to an `environment.yaml` file.\r\n\r\n```python\r\nfrom pydeps2env import Environment\r\n\r\nenv = Environment(\"./test/pyproject.toml[doc]\")\r\nenv.export(\"my_environment.yaml\")\r\n```\r\n\r\n## basic usage (command line)\r\n\r\nCombine multiple source files into a single environment file (including build dependencies).\r\nInstall pandas using `pip`.\r\n\r\n```bash\r\npydeps2env ./test/setup.cfg ./test/pyproject.toml[doc] ./test/environment.yaml ./test/requirements.txt -o output.yaml -c defaults --extras test -b include --pip pandas\r\n```\r\n\r\n## advanced usage (definition file)\r\n\r\nUsers can store complex configurations in a single yaml file and create the desired output using `create_from_definition`.\r\nExample definition file:\r\n\r\n```yaml\r\n# the target file to create\r\noutput: test-configuration.yaml\r\n# default name of the environment\r\nname: test-env\r\n# conda channels to include\r\nchannels:\r\n- conda-forge\r\n- defaults\r\n# list of source files that define sub environments\r\n# these will be loaded as Environment()\r\nsources:\r\n- ./test/environment.yaml\r\n- ./test/local.yaml\r\n- ./test/pyproject.toml[doc]\r\n- ./test/requirements.txt\r\n- https://github.com/CagtayFabry/pydeps2env/blob/custom_deps/pyproject.toml\r\n# extras to apply to all sources and packages\r\nextras:\r\n- test\r\n# dependencies that should be removed after collection\r\nremove:\r\n- pyyaml\r\nadditional_requirements:\r\n- urllib3\r\n# include build system dependencies\r\n# list of dependencies that must be pip installed (excluding auto-sorted depedencies like urls)\r\npip:\r\n- urllib3\r\ninclude_build_system: include\r\n\r\n```\r\n\r\n## configuration options (GitHub action)\r\n\r\nTo customize the output the input options are available to the action:\r\n\r\n### files\r\n\r\nSpecify the location of the dependencies files to parse. (defaults to 'pyproject.toml')\r\nMultiple files can be listed. This will result in a combined environment file.\r\n\r\n### output:\r\n\r\nSpecify the location and name of the conda environment file to generate. (defaults to `'environment.yml'`)\r\n\r\n### channels:\r\n\r\nList the conda channels to include in the environment file. (defaults to `'conda-forge'`)\r\nSeparate a list of multiple channels by spaces (e.g. `'conda-forge defaults'`).\r\n\r\n### extras:\r\n\r\nSpecify one or more optional `[extras_require]` sections to add to all the environments (e.g. `'test'` to include package that\r\nyou would normally install with `pip install pkg[test]`).\r\nNote that for individual packages, the [extra]` syntax is also possible.\r\n\r\n### build_system:\r\n\r\nIf set to `'include'` the dependencies listed under `[build-system]` (or `[options:setup_requires]` in `setup.cfg`) will be added to the environment (default\r\nis `'omit'` so no setup dependencies will be installed).\r\n\r\n### pip\r\nList of packages to install via `pip` instead of `conda`.\r\nThe dependencies will be listed under the `pip:` section in the environment file.\r\nIf a dependency is listed with its URN, it will always be installed via pip (e.g. `pydeps2env @ git+https://github.com/CagtayFabry/pydeps2env`)\r\n\r\n## example\r\n\r\n```yaml\r\nsteps:\r\n - uses: CagtayFabry/pydeps2env@v1.0.0\r\n with:\r\n files: ./test/pyproject.toml[doc] ./test/setup.cfg # comine both files, add [doc] only for pyproject.toml\r\n output: 'environment_test.yml'\r\n channels: 'conda-forge defaults'\r\n extras: 'test'\r\n build_system: 'include'\r\n pip: 'bidict'\r\n```\r\n\r\n```toml\r\n[project]\r\nrequires-python = \">=3.8,<3.10\"\r\ndependencies = [\r\n \"numpy >=1.20\",\r\n \"pandas >=1.0\",\r\n \"IPython\",\r\n \"boltons\",\r\n]\r\n[project.optional-dependencies]\r\ntest = [\"pytest\"]\r\npip_only = [\"bidict\"]\r\n```\r\n\r\n```yaml\r\nchannels:\r\n - conda-forge\r\n - defaults\r\ndependencies:\r\n - python>=3.8,<3.10\r\n - boltons\r\n - IPython\r\n - numpy>=1.20\r\n - pandas>=1.0\r\n - pytest\r\n - setuptools>=40.9.0\r\n - setuptools_scm\r\n - sphinx\r\n - wheel\r\n - pip:\r\n - bidict\r\n```\r\n",
"bugtrack_url": null,
"license": "BSD 3-Clause License Copyright (c) 2022, Cagtay Fabry All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ",
"summary": "A python helper to generate conda environment files from project dependencies.",
"version": "1.2.0",
"project_urls": {
"bug_tracker": "https://github.com/CagtayFabry/pydeps2env/-/issues",
"repository": "https://github.com/CagtayFabry/pydeps2env"
},
"split_keywords": [
"conda",
" pyproject"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "49092518896cc33cb9113f2e61be690b1a302664ab1e4bf91fe3236890533c97",
"md5": "4107672f22194af1ae4f456487c250ac",
"sha256": "86f37f49fb6d8de2912d0525644c6d612fccb2e4b3ec0055ca910d8499a949ea"
},
"downloads": -1,
"filename": "pydeps2env-1.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4107672f22194af1ae4f456487c250ac",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 11878,
"upload_time": "2024-08-09T16:20:37",
"upload_time_iso_8601": "2024-08-09T16:20:37.890966Z",
"url": "https://files.pythonhosted.org/packages/49/09/2518896cc33cb9113f2e61be690b1a302664ab1e4bf91fe3236890533c97/pydeps2env-1.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8437ad2835e3c69a0f2b38851ff1a2d11e73b9658d217950256d543d51c78733",
"md5": "d5b45788ce09d3929b2227b3fb3ee606",
"sha256": "3c3ce127d2ade4ce8751327b9edbdebb103f2bf738fb43ec6291d523e97799ea"
},
"downloads": -1,
"filename": "pydeps2env-1.2.0.tar.gz",
"has_sig": false,
"md5_digest": "d5b45788ce09d3929b2227b3fb3ee606",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 16768,
"upload_time": "2024-08-09T16:20:39",
"upload_time_iso_8601": "2024-08-09T16:20:39.368264Z",
"url": "https://files.pythonhosted.org/packages/84/37/ad2835e3c69a0f2b38851ff1a2d11e73b9658d217950256d543d51c78733/pydeps2env-1.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-09 16:20:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "CagtayFabry",
"github_project": "pydeps2env",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pydeps2env"
}