Skip to main content

A PDM plugin to install project dependencies with Conda

Project description

pdm-conda

A PDM plugin to install project dependencies with Conda.

Configuration

Config item Description Default value Possible values Environment variable
conda.runner Conda runner executable conda conda, mamba, micromamba CONDA_RUNNER
conda.channels Conda channels to use, order will be enforced []
conda.as-default-manager Use Conda to install all possible requirements False CONDA_AS_DEFAULT_MANAGER
conda.use-batched Execute batched install and remove Conda commands, when True the command is executed only at the end False CONDA_BATCHED_COMMANDS
conda.excludes Array of dependencies to exclude from Conda resolution []
conda.installation-method Installation method to use when installing dependencies with Conda hard-link hard-link, copy 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/ PYPI_MAPPING_DIR

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

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

[tool.pdm.conda.pypi-mapping]
download-dir = "/tmp"

[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 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.
  • pdm remove
  • pdm list
  • pdm info

How it works

When PDM detects a Conda managed package, it gets candidates with Conda and then tries to resolve the environment as with any other requirement.

To keep the resolution consistent with Conda, PDM follows resolution rules from Conda as good as possible.

Settings overriden

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

  • install.parallel if some Conda managed packages are to be uninstalled or updated this option is disabled momentarily.

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 deploy/docker-compose.sh -d up

And for productive environment:

bash deploy/docker-compose.sh up

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

pdm_conda-0.8.0b0.tar.gz (23.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pdm_conda-0.8.0b0-py3-none-any.whl (29.5 kB view details)

Uploaded Python 3

File details

Details for the file pdm_conda-0.8.0b0.tar.gz.

File metadata

  • Download URL: pdm_conda-0.8.0b0.tar.gz
  • Upload date:
  • Size: 23.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.4.5 CPython/3.10.10

File hashes

Hashes for pdm_conda-0.8.0b0.tar.gz
Algorithm Hash digest
SHA256 042903364fd95507ad24fc6eef9a5328058cc4bf12e176ae14fc46917279a505
MD5 3899156259c67046e7c6e9ab26017630
BLAKE2b-256 d7dbb92811c455f0a647abdf54e3c68045bcc7e33c5e4f63e8c2f043875971b0

See more details on using hashes here.

File details

Details for the file pdm_conda-0.8.0b0-py3-none-any.whl.

File metadata

  • Download URL: pdm_conda-0.8.0b0-py3-none-any.whl
  • Upload date:
  • Size: 29.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.4.5 CPython/3.10.10

File hashes

Hashes for pdm_conda-0.8.0b0-py3-none-any.whl
Algorithm Hash digest
SHA256 91d889747ceb9da900b01ffe0e7fc1d2403858f41deda3211695a6a4d922801f
MD5 6415d9a7b4e063de22ee789993a0ae42
BLAKE2b-256 b357bfb37ab5ab8091b29951fc63960227ca560130f2fb91affb396b30a681d6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page