conda / conda-lock

Lightweight lockfile for conda environments
https://conda.github.io/conda-lock/
Other
457 stars 102 forks source link

New Feature: lock only `conda-lock` dependencies in `pyproject.toml` #527

Closed pep-sanwer closed 8 months ago

pep-sanwer commented 8 months ago

This introduces a new flag for pyproject.toml-based specification (affecting all flavors of pyproject.toml) that skips locking / solving for all dependencies not found under [tool.conda-lock].

This allows use-cases where a user wants conda-lock locking for only conda dependencies, while bringing their own locker for other dependencies. (My preferred workflow is conda-lock for venv management / management of any non-pip-able deps, followed by poetry for pip-able deps).

The flag is exposed as:

[tool.conda-lock]
skip-non-conda-lock = true

The below example pyproject.toml:

[tool.poetry]
name = "conda-lock-test-poetry"
version = "0.0.1"
description = ""
authors = ["conda-lock"]

[tool.poetry.dependencies]
python = "^3.7"
pandas = "*"
numpy = "*"

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

[tool.conda-lock]
channels = [
    'defaults'
]
skip-non-conda-lock = true

[tool.conda-lock.dependencies]
python = "3.11"
sqlite = "<3.34"
certifi = ">=2019.11.28"

would result in conda-lock only producing a lockfile for python, sqlite, and certifi, skipping pandas and numpy.

Again, deeply appreciative of this incredible tool, and for your time in reviewing this PR. Very open to suggestions / refinements.

netlify[bot] commented 8 months ago

Deploy Preview for conda-lock ready!

Name Link
Latest commit 3d2c384405a07cb7cd00f09aa82f3d4b232f1ee4
Latest deploy log https://app.netlify.com/sites/conda-lock/deploys/65299e626cee23000894b0a1
Deploy Preview https://deploy-preview-527--conda-lock.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

pep-sanwer commented 8 months ago

@maresb, great catch! Completely forgot tests for the other flavors! Yes you are right, this does apply across all flavors of pyproject.toml. Requested changes amended into commit! (Requested changes in above force push, typo fixes in below force push). Additionally added missing requires-python in flit test pyproject.tomls.

Appreciate the incredibly speedy feedback!