Skip to main content

Make conda and poetry communicate

Project description

conda_poetry_liaison

Do not use another package manager in a conda environment.

Many are given this advice, but we do this anyway. We want our conda-only packages with the awesome features of poetry. conda_poetry_liaison is a small collection of scripts to make this as painless and reproducible as possible.

Scripts

cpl-deps

The primary issue of using other package managers like pip and poetry inside a conda environment is that they will not communicate. If you install a package with conda, then install a different one in pip, conda will have no idea what has changed. So once you start using pip or poetry, you cannot use conda to install a package in that same environment.

This script will add all Python packages installed in the conda environment into the pyproject.toml file. Now, poetry will be aware of these packages during dependency solving.

usage: cpl-deps [-h] [--env_name [ENV_NAME]] [--env_path [ENV_PATH]] [--group_name [GROUP_NAME]] [toml_path]

Notify poetry of conda Python packages

positional arguments:
  toml_path             Path to TOML file

options:
  -h, --help            show this help message and exit
  --env_name [ENV_NAME]
                        Name of conda environment to probe
  --env_path [ENV_PATH]
                        Path of conda environment to probe
  --group_name [GROUP_NAME]
                        Name of poetry dependency group

cpl-clean

There seems to be a remnant of direct_url.json files from conda package installations that break poetry (as discussed here). One workaround is to delete these files in the conda environment directory before using poetry.

usage: cpl-clean [-h] [env_path]

Notify poetry of conda Python packages

positional arguments:
  env_path    Path of conda environment to clean

options:
  -h, --help  show this help message and exit

Development

Install poetry if you do not have it.

make poetry-download

If you already have poetry installed, make sure you have poetry-dynamic-versioning.

poetry self add "poetry-dynamic-versioning[plugin]"

Install the package.

make install

Install all pre-commits.

make pre-commit-install

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

conda_poetry_liaison-0.0.0.post14.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

conda_poetry_liaison-0.0.0.post14-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file conda_poetry_liaison-0.0.0.post14.tar.gz.

File metadata

File hashes

Hashes for conda_poetry_liaison-0.0.0.post14.tar.gz
Algorithm Hash digest
SHA256 f77492acc330b7ba2c433c5e191619c0bc1f3814e6a4ffc973fe720493a30857
MD5 829acd9e476b50089bf62416cef562c6
BLAKE2b-256 7efe6eb7d13733b53e5bc7d559f8de652ff450315697788c519662f73ec41ed0

See more details on using hashes here.

File details

Details for the file conda_poetry_liaison-0.0.0.post14-py3-none-any.whl.

File metadata

File hashes

Hashes for conda_poetry_liaison-0.0.0.post14-py3-none-any.whl
Algorithm Hash digest
SHA256 a4ccb40c551bb6248473cf07d5ba9a5c023900998d3556a7a40696912616565d
MD5 705e7c486afabef4359f5f63d2f0faed
BLAKE2b-256 706b0f5d6879474760557c10a428ef7539b3e190cafb08b1fa23bd7092407f7b

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