Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use plugin API for Solver instantiation #597

Merged
merged 6 commits into from Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/workflows/main.yml
Expand Up @@ -29,6 +29,8 @@ jobs:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
pyver: ["3.7", "3.8", "3.9", "3.10"]
env:
PYTHONUNBUFFERED: True
steps:
- name: Print github context
run: |
Expand Down Expand Up @@ -59,7 +61,6 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
PYTHONIOENCODING: utf-8
PYTHONUNBUFFERED: True
# Uncomment to run within conda build
# RUN_EXAMPLES: "1"
run: |
Expand Down Expand Up @@ -116,7 +117,14 @@ jobs:
source $CONDA/etc/profile.d/conda.sh
conda activate constructor
mkdir -p examples_artifacts/
python -u scripts/run_examples.py --keep-artifacts=examples_artifacts/
python scripts/run_examples.py --keep-artifacts=examples_artifacts/
- name: Test with conda-libmamba-solver
run: |
source $CONDA/etc/profile.d/conda.sh
conda activate constructor
conda install -yq conda-libmamba-solver
conda list
CONDA_SOLVER=libmamba CONDA_VERBOSITY=1 constructor examples/noconda/ --output-dir=examples_artifacts/
- name: Upload the example installers as artifacts
if: github.event_name == 'pull_request' && matrix.pyver == '3.9'
uses: actions/upload-artifact@v3
Expand Down
8 changes: 7 additions & 1 deletion CONSTRUCT.md
Expand Up @@ -73,6 +73,10 @@ included in a `conda create --file` command. Packages may also be specified
by an exact URL; e.g.,
`https://repo.anaconda.com/pkgs/main/osx-64/openssl-1.0.2o-h26aff7b_0.tar.bz2`.

The specs will be solved with the solver configured for your `base` conda installation,
if any. Starting with conda 22.11, this behavior can be overriden with the
`CONDA_SOLVER` environment variable.

## `user_requested_specs`

_required:_ no<br/>
Expand Down Expand Up @@ -137,13 +141,15 @@ that, and the temporary environment will be removed. This ensures that
constructor is using the precise local conda configuration to discover
and install the packages. The created environment MUST include `python`.

Read notes about the solver in the `specs` field.

## `transmute_file_type`

_required:_ no<br/>
_type:_ string<br/>
File type extension for the files to be transmuted into. Currently supports
only '.conda'. See conda-package-handling for supported extension names.
If left empty, no transumating is done.
If left empty, no transmuting is done.

## `conda_default_channels`

Expand Down
6 changes: 3 additions & 3 deletions constructor/conda_interface.py
Expand Up @@ -51,9 +51,9 @@
except ImportError:
from conda.models.package_cache_record import PackageCacheRecord as _PackageCacheRecord
try:
from conda.core.solve import _get_solver_class
_Solver = _get_solver_class()
except ImportError:
from conda.base.context import context
_Solver = context.plugin_manager.get_cached_solver_backend()
except (ImportError, AttributeError):
from conda.core.solve import Solver as _Solver

# used by fcp.py
Expand Down
8 changes: 7 additions & 1 deletion constructor/construct.py
Expand Up @@ -58,6 +58,10 @@
included in a `conda create --file` command. Packages may also be specified
by an exact URL; e.g.,
`https://repo.anaconda.com/pkgs/main/osx-64/openssl-1.0.2o-h26aff7b_0.tar.bz2`.

The specs will be solved with the solver configured for your `base` conda installation,
if any. Starting with conda 22.11, this behavior can be overriden with the
`CONDA_SOLVER` environment variable.
'''),

('user_requested_specs', False, (list, str), '''
Expand Down Expand Up @@ -108,12 +112,14 @@
that, and the temporary environment will be removed. This ensures that
constructor is using the precise local conda configuration to discover
and install the packages. The created environment MUST include `python`.

Read notes about the solver in the `specs` field.
'''),

('transmute_file_type', False, str, '''
File type extension for the files to be transmuted into. Currently supports
only '.conda'. See conda-package-handling for supported extension names.
If left empty, no transumating is done.
If left empty, no transmuting is done.
'''),

('conda_default_channels', False, list, '''
Expand Down
2 changes: 1 addition & 1 deletion news/531-enable-alternative-solvers
@@ -1,6 +1,6 @@
### Enhancements:

* Enable alternative solvers by obeying `CONDA_EXPERIMENTAL_SOLVER` if set and available. (#531)
* Enable alternative solvers by obeying `CONDA_SOLVER` if set and available. (#531, #597)

### Bug fixes:

Expand Down