Skip to main content

CLI tool to look for the best conda environment which satisfies certain requirements

Project description

condascan

CLI tool to scan through existing conda environments. It helps you manage your conda environments by:

  • Finding environments that satisfy a requirements.txt or environment.yml file. You can then clone them, instead of creating a new environment from scratch.
  • Checking if a command is available in some environments, as well as getting the result of executing the command.
  • Compare different environments to see which packages are unique or shared. Then, you can delete environments that are not needed anymore.

Installation

You can install condascan using pip:

pip install condascan

Additionally, conda has to be installed on your system, either using miniconda, anaconda, miniforge, mambaforge, etc. Make sure that you can execute the following command:

conda --version

Usage

Search by Requirements

Using the have command, you can scan through your conda environments and find those that satisfy a given requirement. The bash command is as follows:

condascan have <requirement>

<requirement> can be one of the following:

  • A string enclosed in quotes, specifying space-separated package names in PEP 440 format, e.g., "numpy pandas", "numpy==1.2.* pandas>=2.1.0".
  • A path to a requirements.txt file, generated by pip freeze
  • A path to a environment.yml file, generated by conda env export

Check Command Availability

To see if a command is available in any of your conda environments, use the can-execute command:

condascan can-execute <command>

<command> can be one of the following:

  • A string enclosed in quotes, specifying the command to run, e.g., "nvcc --version".
  • A path to .txt file containing list of commands, one per line.

Note: To determine if a command can be executed in a given environment, condascan will actually run the command inside each environment. This means any side effects (e.g., creating files, modifying state, or triggering installations) will occur if the command succeeds. Make sure the commands you're testing are safe and have predictable behavior across environments.

Compare Environments

TBA

Caching

To speed up execution, condascan caches the results of previous runs. The cache is stored in ~/.cache/condascan. If in-between executing condascan you modify your conda environments, you can update the cache by adding --no-cache flag. For example:

condascan have "numpy pandas" --no-cache

Formatting Output

To get the detailed output of condascan, you can add --verbose flag. For example:

condascan can-execute "nvcc --version" --verbose

To limit the number of environments displayed in the output, you can use the --limit flag. For example:

condascan have "numpy pandas" --limit 5

To find the first environment that satisfies the requirement, you can use the --first flag. Note that in this case, condascan will only scan the environments until it finds the first one that satisfies the requirement, and then it will stop scanning further. This can significantly speed up the search if you only need one environment that meets the requirement. For example:

condascan have "numpy pandas" --first

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

condascan-0.7.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

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

condascan-0.7.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file condascan-0.7.0.tar.gz.

File metadata

  • Download URL: condascan-0.7.0.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for condascan-0.7.0.tar.gz
Algorithm Hash digest
SHA256 2071e45852d42db855a29ae6c804629707fc3a661e49add9f5bd25bcf5f0af2f
MD5 81085d3f02895a1fac8dea9d5de0f74c
BLAKE2b-256 302fef6ab06ae4c8b5f8a151ad4fb7d3a4bb2b007cb12f7c7d439ece1abacb3e

See more details on using hashes here.

File details

Details for the file condascan-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: condascan-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for condascan-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7969de8be4c7f24e7a2a8606e5de2b57379519897f9330868d6ef9b6cfdd344a
MD5 5f85faa085c703df8391afc062cbf0a8
BLAKE2b-256 d94f91914f1f62d276bcb439ebb9c7076106c85f099b3a1e11c7879e8c5ace3c

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