pdm-conda


Namepdm-conda JSON
Version 0.17.5 PyPI version JSON
download
home_pageNone
SummaryA PDM plugin to resolve/install/uninstall project dependencies with Conda
upload_time2024-05-08 04:02:18
maintainerNone
docs_urlNone
authorMarcos Pastorini
requires_python<3.13,>=3.10
licenseMIT
keywords pdm plugin conda
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pdm-conda

A PDM plugin to resolve/install/uninstall project dependencies with Conda.

## Configuration

| Config item                       | Description                                                                                          | Default value                                                                                       | Possible values                | Environment variable            |
|-----------------------------------|------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|--------------------------------|---------------------------------|
| `conda.runner`                    | Conda runner executable                                                                              | `conda`                                                                                             | `conda`, `mamba`, `micromamba` | `PDM_CONDA_RUNNER`              |
| `conda.solver`                    | Solver to use for Conda resolution                                                                   | `conda`                                                                                             | `conda`, `libmamba`            | `PDM_CONDA_SOLVER`              |
| `conda.channels`                  | Conda channels to use, order will be enforced                                                        | `[]`                                                                                                |                                |                                 |
| `conda.as-default-manager`        | Use Conda to install all possible requirements                                                       | `False`                                                                                             |                                | `PDM_CONDA_AS_DEFAULT_MANAGER`  |
| `conda.batched-commands`          | Execute batched install and remove Conda commands, when True the command is executed only at the end | `False`                                                                                             |                                | `PDM_CONDA_BATCHED_COMMANDS`    |
| `conda.excludes`                  | Array of dependencies to exclude from Conda resolution                                               | `[]`                                                                                                |                                |                                 |
| `conda.auto-excludes`             | If cannot find package with Conda, add it to excludes list                                           | `False`                                                                                             |                                | `PDM_CONDA_AUTO_EXCLUDES`       |
| `conda.installation-method`       | Installation method to use when installing dependencies with Conda                                   | `hard-link`                                                                                         | `hard-link`, `copy`            | `PDM_CONDA_INSTALLATION_METHOD` |
| `conda.dependencies`              | Array of dependencies to install with Conda, analogue to `project.dependencies`                      | `[]`                                                                                                |                                |                                 |
| `conda.optional-dependencies`     | Groups of optional dependencies to install with Conda, analogue to `project.optional-dependencies`   | `{}`                                                                                                |                                |                                 |
| `conda.dev-dependencies`          | Groups of development dependencies to install with Conda, analogue to `tool.pdm.dev-dependencies`    | `{}`                                                                                                |                                |                                 |
| `conda.pypi-mapping.download-dir` | PyPI-Conda mapping download directory                                                                | `$HOME/.pdm-conda/`                                                                                 |                                | `PDM_CONDA_PYPI_MAPPING_DIR`    |
| `conda.pypi-mapping.url`          | PyPI-Conda mapping url                                                                               | `https://github.com/regro/cf-graph-countyfair/raw/master/mappings/pypi/grayskull_pypi_mapping.yaml` |                                | `PDM_CONDA_PYPI_MAPPING_URL`    |

All configuration items use prefix `pdm.tool`, this is a viable configuration:

```toml
[tool.pdm.conda]
runner = "micromamba"
channels = ["conda-forge/noarch", "conda-forge", "anaconda"]
dependencies = ["pdm"]
as-default-manager = true
auto-excludes = true
solver = "libmamba"
excludes = ["pytest-cov"] # don't install with conda even if it's a dependency from other packages
installation-method = "copy"
batched-commands = true

[tool.pdm.conda.pypi-mapping]
download-dir = "/tmp"
url = "https://url/to/mapping.yaml"

[tool.pdm.conda.optional-dependencies]
extra = ["anaconda:ffmpeg"] # non python dependency, obtained from anaconda channel

[tool.pdm.conda.dev-dependencies]
dev = ["pytest"]
```

## Usage

This plugin adds capabilities to the default PDM commands.

### Working commands

The following commands were tested and work:

* `pdm init`:
    * To list/use Conda managed python you must specify the Conda runner with `-cr` or `--runner`.
    * You also can specify a default Conda channel with `-c` or `--channel`.
* `pdm lock`
* `pdm install`
* `pdm add`:
    * To add a Conda managed package `--conda` flag can be used multiple times followed a package (analogue
      to `--editable`).
    * You can specify per package Conda channel using conda notation `channel::package`.
    * You also can specify a default Conda channel with `-c` or `--channel`.
    * With flag `-r` or `--runner` you can specify the Conda runner to use.
    * With flag `-ce` or `--conda-excludes` you can add PyPi packages to the excluded from Conda resolution.
    * With flag `--conda-as-default-manager` you can set `conda.as-default-manager` to `True`.
* `pdm remove`
* `pdm update`
* `pdm list`
* `pdm info`
* `pdm venv`:
    * `create`:
        * To list/use Conda managed python you must specify the Conda runner with `-w` or `--with`.
        * You can completely override the Conda environment name with `-cn` or `--conda-name`, the resulting environment
          won't follow PDM environment naming conventions.
    * `list`

### How it works

#### Using conda/libmamba solver

PDM invokes Conda solver to resolve conda packages each time a PDM candidate makes a change in the last Conda
resolution.

If only Conda packages are used (i.e. setting `conda.as-default-manager` to `true` and no `conda.excludes`) then Conda
solver is invoked only once.

### Settings overridden

In order to use Conda to install packages some settings were overriden:

* `python.use_venv` if conda settings detected in `pyproject.toml` this setting is set to `True`.
* `python.in_project` if conda settings detected in `pyproject.toml` and this setting was not previously set then is set
  to `False`.
* `python.use_pyenv` if conda settings detected in `pyproject.toml` this setting is set to `False`.
* `venv.backend` if conda settings detected in `pyproject.toml` this setting is set to `conda.runner`.
* `venv.location` if conda settings detected in `pyproject.toml`, `VIRTUAL_ENV` or `CONDA_PREFIX` environment
  variables are set and this setting was not previously set then is set to the value of the environment variable.
* `install.parallel` if some Conda managed packages are to be uninstalled or updated this option is disabled
  momentarily.

Some environment variables were overridden too:

* `PDM_IGNORE_ACTIVE_VENV` if conda settings detected in `pyproject.toml` and `VIRTUAL_ENV` or `CONDA_PREFIX`
  environment variables are set then this variable is set to `False`.

#### Lock strategy

* Lock strategy `no_cross_platform` for `pdm lock` is always forced as Conda doesn't produce cross-platform locks.
* Lock strategy `static_urls` for Conda managed packages is always forced, independently of the lock strategy used for
  PyPi packages.
* Lock strategy `direct_minimal_versions` for Conda managed packages will partially work as Conda doesn't have an option
  to force this mode on a resolution.

## Development

For development `docker-compose` files exist in `deploy` directory, helper script `deploy/docker-compose.sh` can be used
for executing docker.

For running dev environment:

```bash
bash deploy/docker-compose.sh -d up
```

And for productive environment:

```bash
bash deploy/docker-compose.sh up
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pdm-conda",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.13,>=3.10",
    "maintainer_email": null,
    "keywords": "pdm, plugin, conda",
    "author": "Marcos Pastorini",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/c6/71/54cdd58b718a0e211efa4e148c4631ccb250e1cdce875926df562795e2e0/pdm_conda-0.17.5.tar.gz",
    "platform": null,
    "description": "# pdm-conda\n\nA PDM plugin to resolve/install/uninstall project dependencies with Conda.\n\n## Configuration\n\n| Config item                       | Description                                                                                          | Default value                                                                                       | Possible values                | Environment variable            |\n|-----------------------------------|------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|--------------------------------|---------------------------------|\n| `conda.runner`                    | Conda runner executable                                                                              | `conda`                                                                                             | `conda`, `mamba`, `micromamba` | `PDM_CONDA_RUNNER`              |\n| `conda.solver`                    | Solver to use for Conda resolution                                                                   | `conda`                                                                                             | `conda`, `libmamba`            | `PDM_CONDA_SOLVER`              |\n| `conda.channels`                  | Conda channels to use, order will be enforced                                                        | `[]`                                                                                                |                                |                                 |\n| `conda.as-default-manager`        | Use Conda to install all possible requirements                                                       | `False`                                                                                             |                                | `PDM_CONDA_AS_DEFAULT_MANAGER`  |\n| `conda.batched-commands`          | Execute batched install and remove Conda commands, when True the command is executed only at the end | `False`                                                                                             |                                | `PDM_CONDA_BATCHED_COMMANDS`    |\n| `conda.excludes`                  | Array of dependencies to exclude from Conda resolution                                               | `[]`                                                                                                |                                |                                 |\n| `conda.auto-excludes`             | If cannot find package with Conda, add it to excludes list                                           | `False`                                                                                             |                                | `PDM_CONDA_AUTO_EXCLUDES`       |\n| `conda.installation-method`       | Installation method to use when installing dependencies with Conda                                   | `hard-link`                                                                                         | `hard-link`, `copy`            | `PDM_CONDA_INSTALLATION_METHOD` |\n| `conda.dependencies`              | Array of dependencies to install with Conda, analogue to `project.dependencies`                      | `[]`                                                                                                |                                |                                 |\n| `conda.optional-dependencies`     | Groups of optional dependencies to install with Conda, analogue to `project.optional-dependencies`   | `{}`                                                                                                |                                |                                 |\n| `conda.dev-dependencies`          | Groups of development dependencies to install with Conda, analogue to `tool.pdm.dev-dependencies`    | `{}`                                                                                                |                                |                                 |\n| `conda.pypi-mapping.download-dir` | PyPI-Conda mapping download directory                                                                | `$HOME/.pdm-conda/`                                                                                 |                                | `PDM_CONDA_PYPI_MAPPING_DIR`    |\n| `conda.pypi-mapping.url`          | PyPI-Conda mapping url                                                                               | `https://github.com/regro/cf-graph-countyfair/raw/master/mappings/pypi/grayskull_pypi_mapping.yaml` |                                | `PDM_CONDA_PYPI_MAPPING_URL`    |\n\nAll configuration items use prefix `pdm.tool`, this is a viable configuration:\n\n```toml\n[tool.pdm.conda]\nrunner = \"micromamba\"\nchannels = [\"conda-forge/noarch\", \"conda-forge\", \"anaconda\"]\ndependencies = [\"pdm\"]\nas-default-manager = true\nauto-excludes = true\nsolver = \"libmamba\"\nexcludes = [\"pytest-cov\"] # don't install with conda even if it's a dependency from other packages\ninstallation-method = \"copy\"\nbatched-commands = true\n\n[tool.pdm.conda.pypi-mapping]\ndownload-dir = \"/tmp\"\nurl = \"https://url/to/mapping.yaml\"\n\n[tool.pdm.conda.optional-dependencies]\nextra = [\"anaconda:ffmpeg\"] # non python dependency, obtained from anaconda channel\n\n[tool.pdm.conda.dev-dependencies]\ndev = [\"pytest\"]\n```\n\n## Usage\n\nThis plugin adds capabilities to the default PDM commands.\n\n### Working commands\n\nThe following commands were tested and work:\n\n* `pdm init`:\n    * To list/use Conda managed python you must specify the Conda runner with `-cr` or `--runner`.\n    * You also can specify a default Conda channel with `-c` or `--channel`.\n* `pdm lock`\n* `pdm install`\n* `pdm add`:\n    * To add a Conda managed package `--conda` flag can be used multiple times followed a package (analogue\n      to `--editable`).\n    * You can specify per package Conda channel using conda notation `channel::package`.\n    * You also can specify a default Conda channel with `-c` or `--channel`.\n    * With flag `-r` or `--runner` you can specify the Conda runner to use.\n    * With flag `-ce` or `--conda-excludes` you can add PyPi packages to the excluded from Conda resolution.\n    * With flag `--conda-as-default-manager` you can set `conda.as-default-manager` to `True`.\n* `pdm remove`\n* `pdm update`\n* `pdm list`\n* `pdm info`\n* `pdm venv`:\n    * `create`:\n        * To list/use Conda managed python you must specify the Conda runner with `-w` or `--with`.\n        * You can completely override the Conda environment name with `-cn` or `--conda-name`, the resulting environment\n          won't follow PDM environment naming conventions.\n    * `list`\n\n### How it works\n\n#### Using conda/libmamba solver\n\nPDM invokes Conda solver to resolve conda packages each time a PDM candidate makes a change in the last Conda\nresolution.\n\nIf only Conda packages are used (i.e. setting `conda.as-default-manager` to `true` and no `conda.excludes`) then Conda\nsolver is invoked only once.\n\n### Settings overridden\n\nIn order to use Conda to install packages some settings were overriden:\n\n* `python.use_venv` if conda settings detected in `pyproject.toml` this setting is set to `True`.\n* `python.in_project` if conda settings detected in `pyproject.toml` and this setting was not previously set then is set\n  to `False`.\n* `python.use_pyenv` if conda settings detected in `pyproject.toml` this setting is set to `False`.\n* `venv.backend` if conda settings detected in `pyproject.toml` this setting is set to `conda.runner`.\n* `venv.location` if conda settings detected in `pyproject.toml`, `VIRTUAL_ENV` or `CONDA_PREFIX` environment\n  variables are set and this setting was not previously set then is set to the value of the environment variable.\n* `install.parallel` if some Conda managed packages are to be uninstalled or updated this option is disabled\n  momentarily.\n\nSome environment variables were overridden too:\n\n* `PDM_IGNORE_ACTIVE_VENV` if conda settings detected in `pyproject.toml` and `VIRTUAL_ENV` or `CONDA_PREFIX`\n  environment variables are set then this variable is set to `False`.\n\n#### Lock strategy\n\n* Lock strategy `no_cross_platform` for `pdm lock` is always forced as Conda doesn't produce cross-platform locks.\n* Lock strategy `static_urls` for Conda managed packages is always forced, independently of the lock strategy used for\n  PyPi packages.\n* Lock strategy `direct_minimal_versions` for Conda managed packages will partially work as Conda doesn't have an option\n  to force this mode on a resolution.\n\n## Development\n\nFor development `docker-compose` files exist in `deploy` directory, helper script `deploy/docker-compose.sh` can be used\nfor executing docker.\n\nFor running dev environment:\n\n```bash\nbash deploy/docker-compose.sh -d up\n```\n\nAnd for productive environment:\n\n```bash\nbash deploy/docker-compose.sh up\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A PDM plugin to resolve/install/uninstall project dependencies with Conda",
    "version": "0.17.5",
    "project_urls": {
        "Changelog": "https://github.com/macro128/pdm-conda/blob/main/CHANGELOG.md",
        "Homepage": "https://github.com/macro128/pdm-conda"
    },
    "split_keywords": [
        "pdm",
        " plugin",
        " conda"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "383ea7bd180cb4132a2c6e6f26e72ddf64f718a018d0a3e530c078942fb9ef80",
                "md5": "2b558ebd7219dbdf733e6b58e168b136",
                "sha256": "6e0a110601be49b1ab2a60cf5d504c63c8136ac567f3f8b4bd1a712f550017e0"
            },
            "downloads": -1,
            "filename": "pdm_conda-0.17.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2b558ebd7219dbdf733e6b58e168b136",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.13,>=3.10",
            "size": 54944,
            "upload_time": "2024-05-08T04:02:15",
            "upload_time_iso_8601": "2024-05-08T04:02:15.635473Z",
            "url": "https://files.pythonhosted.org/packages/38/3e/a7bd180cb4132a2c6e6f26e72ddf64f718a018d0a3e530c078942fb9ef80/pdm_conda-0.17.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c67154cdd58b718a0e211efa4e148c4631ccb250e1cdce875926df562795e2e0",
                "md5": "f53107c19a5ed61c2bd259047be22292",
                "sha256": "b578f330041c4b9bc552f2d49ecbbdb7a098e57051f27937556514504d98b69c"
            },
            "downloads": -1,
            "filename": "pdm_conda-0.17.5.tar.gz",
            "has_sig": false,
            "md5_digest": "f53107c19a5ed61c2bd259047be22292",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.13,>=3.10",
            "size": 42398,
            "upload_time": "2024-05-08T04:02:18",
            "upload_time_iso_8601": "2024-05-08T04:02:18.254677Z",
            "url": "https://files.pythonhosted.org/packages/c6/71/54cdd58b718a0e211efa4e148c4631ccb250e1cdce875926df562795e2e0/pdm_conda-0.17.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-08 04:02:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "macro128",
    "github_project": "pdm-conda",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pdm-conda"
}
        
Elapsed time: 0.27757s