conda-incubator / conda-project

Tool for encapsulating, running, and reproducing projects with Conda environments
https://conda-incubator.github.io/conda-project/
BSD 3-Clause "New" or "Revised" License
28 stars 11 forks source link

Experimental features: run with external-environment and project archive download/extract #106

Closed AlbertDeFusco closed 1 year ago

AlbertDeFusco commented 1 year ago

Two experimental features are added here

External environment

You can run commands using conda environments not managed by the project itself.

conda project run --external-environment=<env> [command] [args ...]

Where <env> can be a relative or absolute path to a conda environment, or the name of a global environment stored in one of envs_dirs directories.

If there is a collision between a local environment directory and named environment, the local environment directory is preferred.

If no local environment directory found it will check through the conda config "envs_dirs" in order and return the first matching named environment.

~In this PR a defined environment is not required.~

Download and extract a project archive

Two new flags are added --project-archive and --archive-storage-options

--project-archive PROJECT_ARCHIVE_FILE_OR_URL
                        EXPERIMENTAL: Extract and run directly from a project archive. The archive can be a local file or a
                        fsspec compatible URL. You may need to install appropriate driver packages to work with remote
                        archives. Optionally, use --directory to set the destination directory of the extracted project.
--archive-storage-options ARCHIVE_STORAGE_OPTIONS
                        EXPERIMENTAL: Comma separated list of fsspec storage_options for accessing a remote archive For example
                        --archive-storage-options username=<user>,password=<pass>

These flags are enabled for

TODO:

AlbertDeFusco commented 1 year ago

Added support for the currently activated env if a) the project has no defined environment and b) --external-environment is not supplied

AlbertDeFusco commented 1 year ago

Added support for the currently activated env if a) the project has no defined environment and b) --external-environment is not supplied

AlbertDeFusco commented 1 year ago

Updates:

for example

conda install defusco/label/dev::conda-project=0.2.0.dev2 aiohttp requests
conda-project run --project-archive https://anaconda.org/defusco/project/windturbines/download jupyter notebook wind-turbines.ipynb
codecov[bot] commented 1 year ago

Codecov Report

Merging #106 (e2c10b3) into main (a3e84f1) will increase coverage by 1.04%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #106      +/-   ##
==========================================
+ Coverage   96.63%   97.67%   +1.04%     
==========================================
  Files           9        9              
  Lines         742      818      +76     
==========================================
+ Hits          717      799      +82     
+ Misses         25       19       -6     
Impacted Files Coverage Δ
src/conda_project/cli/commands.py 100.00% <100.00%> (ø)
src/conda_project/cli/main.py 100.00% <100.00%> (ø)
src/conda_project/conda.py 82.10% <100.00%> (+7.94%) :arrow_up:
src/conda_project/project.py 100.00% <100.00%> (ø)
src/conda_project/utils.py 100.00% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more