Skip to content

Commit

Permalink
[build,core,utils] Remove pyyaml, move storage.py to core
Browse files Browse the repository at this point in the history
  • Loading branch information
aschuh-hf committed Aug 4, 2023
1 parent b2ac443 commit 2064f3d
Show file tree
Hide file tree
Showing 21 changed files with 3,345 additions and 740 deletions.
29 changes: 11 additions & 18 deletions conda/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ NAME = deepali
# Relative path of repository root directory
ROOT = ..

# Commands
CONDA = mamba
CONDA_OPTS = --no-banner
CONDA_DEVENV = conda devenv
CONDA_LOCK = conda-lock
CONDA_LOCK_OPTS = --mamba

# Name of conda-devenv configuration file
DEVENV = environment.devenv.yml

Expand Down Expand Up @@ -66,20 +59,20 @@ clear:
@rm -f $(LOCKFILE) environment.devenv.{linux-64,osx-64,win-64}.yml environment.{linux-64,osx-64,win-64}.{lock,yml}

lock-linux:
@$(CONDA_DEVENV) --name $(NAME) --file $(DEVENV) --env-manager $(CONDA) --env-var PLATFORM=linux-64 --print > environment.devenv.linux-64.yml
@$(CONDA_LOCK) $(CONDA_LOCK_OPTS) --lockfile $(LOCKFILE) --platform linux-64 --file environment.devenv.linux-64.yml
conda devenv --name $(NAME) --file $(DEVENV) --env-manager conda --env-var PLATFORM=linux-64 --print > environment.devenv.linux-64.yml
conda lock --lockfile $(LOCKFILE) --platform linux-64 --file environment.devenv.linux-64.yml

lock-osx:
@$(CONDA_DEVENV) --name $(NAME) --file $(DEVENV) --env-manager $(CONDA) --env-var PLATFORM=osx-64 --print > environment.devenv.osx-64.yml
@$(CONDA_LOCK) $(CONDA_LOCK_OPTS) --lockfile $(LOCKFILE) --platform osx-64 --file environment.devenv.osx-64.yml
conda devenv --name $(NAME) --file $(DEVENV) --env-manager conda --env-var PLATFORM=osx-64 --print > environment.devenv.osx-64.yml
conda lock --lockfile $(LOCKFILE) --platform osx-64 --file environment.devenv.osx-64.yml

lock-win:
@$(CONDA_DEVENV) --name $(NAME) --file $(DEVENV) --env-manager $(CONDA) --env-var PLATFORM=win-64 --print > environment.devenv.win-64.yml
@$(CONDA_LOCK) $(CONDA_LOCK_OPTS) --lockfile $(LOCKFILE) --platform win-64 --file environment.devenv.win-64.yml
conda devenv --name $(NAME) --file $(DEVENV) --env-manager conda --env-var PLATFORM=win-64 --print > environment.devenv.win-64.yml
conda lock --lockfile $(LOCKFILE) --platform win-64 --file environment.devenv.win-64.yml

render:
@$(CONDA_LOCK) render $(LOCKFILE) --kind env --filename-template environment.{platform}
@$(CONDA_LOCK) render $(LOCKFILE) --kind explicit --filename-template environment.{platform}.lock
conda lock render $(LOCKFILE) --kind env --filename-template environment.{platform}
conda lock render $(LOCKFILE) --kind explicit --filename-template environment.{platform}.lock
@if ! grep -e 'pytorch.*cuda' environment.linux-64.lock > /dev/null 2> /dev/null; then \
echo "Expected PyTorch with CUDA support for PLATFORM=linux-64. Check conda configuration."; \
fi
Expand All @@ -88,10 +81,10 @@ render:
env: create-env install

create-env:
@$(CONDA) $(CONDA_OPTS) create --name $(NAME) --file environment.$(PLATFORM).lock
conda create --name $(NAME) --file environment.$(PLATFORM).lock

update-env:
@$(CONDA) $(CONDA_OPTS) update --name $(NAME) --file environment.$(PLATFORM).lock --prune
conda update --name $(NAME) --file environment.$(PLATFORM).lock --prune

install:
@$(CONDA) $(CONDA_OPTS) run --name $(NAME) pip install $(PIP_INSTALL_OPTS) ./$(ROOT)[utils]
conda run --name $(NAME) pip install $(PIP_INSTALL_OPTS) ./$(ROOT)[utils]
23 changes: 14 additions & 9 deletions conda/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Conda environment configurations for `deepali` libraries.

## Create environment

If not done before, install either [Miniconda](https://docs.conda.io/en/latest/miniconda.html) or [Anaconda](https://www.anaconda.com/).
If not done before, install either [Anaconda], [Miniconda], or [Mambaforge].

A conda environment for this project can be created using the `env` Makefile target, i.e.,

Expand All @@ -22,7 +22,7 @@ NAME=deepali
PLATFORM=linux-64
conda create --name $NAME --file environment.$PLATFORM.lock
conda run --name $NAME pip install [--editable] ..
conda run --name $NAME pip install ..[utils]
```

where `PLATFORM` is one of the following values.
Expand All @@ -38,16 +38,21 @@ where `PLATFORM` is one of the following values.

The following tools are required to update the generated dependency files.

1. Install [Miniconda](https://docs.conda.io/en/latest/miniconda.html): Package dependency management tool.
2. Install [mamba](https://mamba.readthedocs.io/en/latest/): Faster dependency resolution and more informative error messages.
- `conda install mamba=0.23 --name base --channel conda-forge`
3. Install [conda-devenv](https://conda-devenv.readthedocs.io/en/latest/): Advanced conda environment configuration such as conditional dependencies.
- `conda install conda-devenv=2.3 --name base --channel conda-forge`
4. Install [conda-lock](https://conda-incubator.github.io/conda-lock/): Lock versions of dependencies and generate explicit lockfiles.
- `conda install conda-lock=1.0 --name base --channel conda-forge`
1. Install [Mambaforge]: Package dependency management tool.
3. Install [conda-devenv]: Advanced conda environment configuration such as conditional dependencies.
- `mamba --no-banner install conda-devenv=2.3 --name base --channel conda-forge`
4. Install [conda-lock]: Lock versions of dependencies and generate explicit lockfiles.
- `mamba --no-banner install conda-lock=1.0 --name base --channel conda-forge`

After editing the `environment.devenv.yml` file to add, remove, or update required and optional dependencies, run the following command to re-generate the `environment.conda-lock.yml` and `environment.*.lock` files.

```
make all
```


[Anaconda]: https://www.anaconda.com/
[Mambaforge]: https://mamba.readthedocs.io/en/latest/installation.html
[Miniconda]: https://docs.conda.io/en/latest/miniconda.html
[conda-devenv]: https://conda-devenv.readthedocs.io/en/latest/
[conda-lock]: https://conda-incubator.github.io/conda-lock/
Loading

0 comments on commit 2064f3d

Please sign in to comment.