Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
17912ca
fix: register as plugin properly
beckermr Apr 8, 2026
c33c7ef
fix: add conda entry point for conda-lock
beckermr Apr 8, 2026
7d834a3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 8, 2026
589987e
Refactor plugin to handle optional conda import
beckermr Apr 8, 2026
a989779
fix: typing issues
beckermr Apr 8, 2026
0dbc5d6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 8, 2026
5a3f923
fix: ignore typing errors?
beckermr Apr 8, 2026
10f270c
Apply suggestion from @beckermr
beckermr Apr 8, 2026
06dd585
Add basic logger configuration function
beckermr Apr 8, 2026
8917581
Replace basicConfig with configure_logger_basic
beckermr Apr 8, 2026
54af5cd
Replace basicConfig with configure_logger_basic
beckermr Apr 8, 2026
10b9e1b
Apply suggestion from @beckermr
beckermr Apr 8, 2026
7afefed
Apply suggestions from code review
beckermr Apr 8, 2026
0ed0ea2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 8, 2026
310a2e0
fix: pass args
beckermr Apr 8, 2026
c68609d
Apply suggestion from @beckermr
beckermr Apr 8, 2026
dd636ac
test: expand integration tests to test conda lock cli plugin
beckermr Apr 8, 2026
dc15ee6
fix: use proper shell in tests
beckermr Apr 8, 2026
131c2b0
fix: need hatchling
beckermr Apr 8, 2026
16ecdd4
fix: need hatch-vcs
beckermr Apr 8, 2026
9f893ba
fix: need editables
beckermr Apr 8, 2026
8cad0b3
fix: need conda too
beckermr Apr 8, 2026
76d1d6b
fix: exclude windows from 3.14 testing
beckermr Apr 8, 2026
84a0635
feat: use a simpler approach for the fix
beckermr Apr 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 56 additions & 6 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ jobs:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ "3.10", "3.14" ]
use_conda_cli: ["false", "true"]
exclude:
- os: windows-latest
python-version: "3.14"
use_conda_cli: "true"
steps:
- name: Set Conda platform
run: |
Expand All @@ -55,14 +60,17 @@ jobs:
with:
persist-credentials: false
- name: Set up Python
if: matrix.use_conda_cli == 'false'
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python-version }}
- name: install conda-lock
if: matrix.use_conda_cli == 'false'
run: |
pip install pipx
pipx install -e .
- name: run-test
if: matrix.use_conda_cli == 'false'
run: |
conda-lock --log-level=DEBUG --micromamba -f tests/gdal/environment.yml -p $CONDA_PLATFORM
conda-lock render -p $CONDA_PLATFORM
Expand All @@ -72,11 +80,37 @@ jobs:
cat conda-lock.yml
mkdir lockfiles
mv conda-$CONDA_PLATFORM.lock conda-$CONDA_PLATFORM.lock.yml conda-lock.yml lockfiles
- name: Set up Python
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- name: Set up Python
- name: Set up Conda

if: matrix.use_conda_cli == 'true'
uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167 # v3.3.0
with:
auto-activate-base: true
python-version: ${{ matrix.python-version }}
- name: install conda-lock
if: matrix.use_conda_cli == 'true'
shell: bash -leo pipefail {0}
run: |
conda install conda pip setuptools editables hatchling hatch-vcs conda-lock --yes
conda uninstall conda-lock --force --yes
pip install --no-deps --no-build-isolation -e .
- name: run-test
if: matrix.use_conda_cli == 'true'
shell: bash -leo pipefail {0}
run: |
python -m conda lock --log-level=DEBUG --micromamba -f tests/gdal/environment.yml -p $CONDA_PLATFORM
python -m conda lock render -p $CONDA_PLATFORM
python -m conda lock render -p $CONDA_PLATFORM --kind=env
cat conda-$CONDA_PLATFORM.lock
cat conda-$CONDA_PLATFORM.lock.yml
cat conda-lock.yml
mkdir lockfiles
mv conda-$CONDA_PLATFORM.lock conda-$CONDA_PLATFORM.lock.yml conda-lock.yml lockfiles
- name: Upload lockfiles
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: conda-lock-${{ matrix.os }}-${{ matrix.python-version }}
name: conda-lock-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.use_conda_cli }}
path: lockfiles

install-gdal-with-micromamba:
runs-on: ${{ matrix.os }}
needs: lock-gdal
Expand All @@ -87,7 +121,12 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ "3.10" ]
python-version: [ "3.10", "3.14" ]
use_conda_cli: ["false", "true"]
exclude:
- os: windows-latest
python-version: "3.14"
use_conda_cli: "true"
steps:
- name: Set Conda platform
run: |
Expand All @@ -110,7 +149,7 @@ jobs:
- name: Download lockfiles
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
name: conda-lock-${{ matrix.os }}-${{ matrix.python-version }}
name: conda-lock-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.use_conda_cli }}
path: lockfiles
- name: Install GDAL with Micromamba
run: |
Expand All @@ -125,6 +164,7 @@ jobs:
micromamba run -n gdal-test-mm-lock python -c 'import toolz; print(toolz.__version__)'
# Micromamba won't install pip dependencies from explicit lockfiles, so skip this test
micromamba run -n gdal-test-mm-env python -c 'import toolz; print(toolz.__version__)'

install-gdal-with-conda-lock:
runs-on: ${{ matrix.os }}
needs: lock-gdal
Expand All @@ -136,6 +176,11 @@ jobs:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ "3.10", "3.14" ]
use_conda_cli: ["false", "true"]
exclude:
- os: windows-latest
python-version: "3.14"
use_conda_cli: "true"
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
Expand All @@ -151,7 +196,7 @@ jobs:
- name: Download lockfiles
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
name: conda-lock-${{ matrix.os }}-${{ matrix.python-version }}
name: conda-lock-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.use_conda_cli }}
path: lockfiles
- name: Install GDAL with conda-lock
run: |
Expand Down Expand Up @@ -182,7 +227,12 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ "3.10" ]
python-version: [ "3.10", "3.14" ]
use_conda_cli: ["false", "true"]
exclude:
- os: windows-latest
python-version: "3.14"
use_conda_cli: "true"
Comment on lines +232 to +235
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this exclude? Does setup-miniconda not work yet with python 3.14? Could we add a comment explaining why?

steps:
- uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167 # v3.3.0
with:
Expand All @@ -191,7 +241,7 @@ jobs:
- name: Download lockfiles
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
name: conda-lock-${{ matrix.os }}-${{ matrix.python-version }}
name: conda-lock-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.use_conda_cli }}
path: lockfiles
- name: Install GDAL with conda
run: |
Expand Down
8 changes: 4 additions & 4 deletions conda_lock/conda_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -1430,7 +1430,7 @@ def lock(
version: The version of conda-lock used to generate this lock file.
timestamp: The approximate timestamp of the output file in ISO8601 basic format.
"""
logging.basicConfig(level=log_level)
logging.basicConfig(level=log_level, force=True)

# Set the flag for deleting temporary paths (files/dirs)
tempdir_manager.state.delete_temp_paths = not preserve_temp_dirs
Expand Down Expand Up @@ -1605,7 +1605,7 @@ def click_install(
sys.exit(1)

"""Perform a conda install"""
logging.basicConfig(level=log_level)
logging.basicConfig(level=log_level, force=True)

# Set the flag for deleting temporary paths
tempdir_manager.state.delete_temp_paths = not preserve_temp_dirs
Expand Down Expand Up @@ -1729,7 +1729,7 @@ def render(
platform: Sequence[str],
) -> None:
"""Render multi-platform lockfile into single-platform env or explicit file"""
logging.basicConfig(level=log_level)
logging.basicConfig(level=log_level, force=True)

if pdb:
sys.excepthook = _handle_exception_post_mortem
Expand Down Expand Up @@ -2035,7 +2035,7 @@ def render_lock_spec( # noqa: C901
)
editables.append(EditableDependency(name=name, path=path))

logging.basicConfig(level=log_level)
logging.basicConfig(level=log_level, force=True)

# Set Pypi <--> Conda lookup file location
mapping_url = (
Expand Down
37 changes: 37 additions & 0 deletions conda_lock/plugin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"""Conda plugin hooks for conda-lock.

Registers ``conda lock`` so the feedstock tooling is available as a conda
subcommand when this package is installed in the same environment as conda.
"""

from __future__ import annotations


try:
from conda.plugins import hookimpl # type: ignore[unused-ignore]
from conda.plugins.types import CondaSubcommand # type: ignore[unused-ignore]

HAVE_CONDA = True
except ImportError:
HAVE_CONDA = False


if HAVE_CONDA:

def _execute(args: tuple[str, ...]) -> int | None:
"""Dispatch plugin arguments to the lock CLI.

Lazy import to avoid import-time side effects when not using conda-lock.
"""
# code below suggested by AI and appears to work
from conda_lock.conda_lock import main

return main(args, standalone_mode=False)

@hookimpl
def conda_subcommands() -> CondaSubcommand:
yield CondaSubcommand(
name="lock",
summary=("enerate fully reproducible lock files for conda environments."),
action=_execute,
)
2 changes: 1 addition & 1 deletion conda_lock/virtual_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def virtual_package_repo_from_specification(


if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG)
logging.basicConfig(level=logging.DEBUG, force=True)
fil = (
pathlib.Path(__file__).parent.parent
/ "tests"
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ dependencies = [
[project.scripts]
conda-lock = "conda_lock:main"

[project.entry-points.conda]
conda-lock = "conda_lock.plugin"

[project.urls]
Homepage = "https://github.com/conda/conda-lock"
Repository = "https://github.com/conda/conda-lock"
Expand Down
Loading