conda environment file to ini file
Project description
env2ini
Developer Guide
Setup
# create conda environment
$ mamba env create -f env.yml
# update conda environment
$ mamba env update -n env2ini --file env.yml
# $ mamba env update -n env2ini --file env.mac.yml
Install
pip install -e .
# install from pypi
pip install env2ini
nbdev
# activate conda environment
$ conda activate env2ini
# make sure the env2ini package is installed in development mode
$ pip install -e .
# make changes under nbs/ directory
# ...
# compile to have changes apply to the ivanova package
$ nbdev_prepare
Publishing
# publish to pypi
$ nbdev_pypi
# publish to conda
$ nbdev_conda
Usage
Installation
Install latest from the GitHub repository:
$ pip install git+https://github.com/dsm-72/env2ini.git
or from conda
$ conda install -c dsm-72 env2ini
or from pypi
$ pip install env2ini
Documentation
Documentation can be found hosted on GitHub repository pages. Additionally you can find package manager specific guidelines on conda and pypi respectively.
$ env2ini --help
Option | Short Option | Type | Description | Default Value |
---|---|---|---|---|
--file |
-f |
TEXT | YAML file to extract the new requirements from. | env.yml |
--ini-file |
-i |
TEXT | The settings.ini file to update. |
settings.ini |
--mps |
-m |
Whether or not to use the mps env file ({os.path.basename(file)}.mps.yml ). |
||
--dryrun |
-d |
Whether to actually update the settings.ini file or just print the changes. |
||
--unchanged |
-u , -a |
Whether to print all packages, including the ones whose versions haven’t changed. | ||
--ignore |
-ig |
TEXT | List of dependencies to ignore. | None |
--alias |
-al |
TEXT | Dictionary of aliases for conda dependencies in the format: package1:alias1;package2:alias2 . |
None |
--confirm |
-c |
Ask for confirmation before writing to the ini file. |
True |
|
--install-completion |
Install completion for the current shell. | |||
--show-completion |
Show completion for the current shell, to copy it or customize the installation. | |||
--help |
Show this message and exit. |
You can also update the conda environment file to modify the behavior
under a key env2ini
:
dependencies:
# for conda plugins
- conda
# for publishing to pypi and conda
- twine
- anaconda-client
# env2ini specifications
env2ini:
# packages to ignore (not moved to settings.ini)
ignore:
- pip
- python
- twine
- anaconda-client
- notebook
- ipykernel
- ipywidgets
- jupyter_contrib_nbextensions
# mapping of the name of the package on conda to that of its name in pypi
aliases:
torch: pytorch
lightning: pytorch-lightning
Note: doing so will yield a warning which looks like this:
EnvironmentSectionNotValid: The following section on 'path/to/file/env.yml' is invalid and will be ignored:
- env2ini
Example Environment File
Here is the full environment file can be found under env.mps.yml
with
which this package was made:
name: env2ini
channels:
- conda-forge
- fastai
dependencies:
- python>=3.10
# Utilities
# -------------------------------------------------------------------------
- tqdm
- rich
- typer
# Jupyter Notebook
# -------------------------------------------------------------------------
- conda-forge::notebook
- conda-forge::ipykernel
- conda-forge::ipywidgets
- conda-forge::jupyter_contrib_nbextensions
# nbdev
# -------------------------------------------------------------------------
- fastai::nbdev>=2.3.12
- pyyaml
# for conda plugins
- conda
# for publishing to pypi and conda
- twine
- anaconda-client
env2ini:
ignore:
- pip
- python
- twine
- anaconda-client
- notebook
- ipykernel
- ipywidgets
- jupyter_contrib_nbextensions
aliases:
torch: pytorch
lightning: pytorch-lightning
Legacy
the deprecated original script env_to_ini.py
env_to_ini.py
This script is not a part of the package. It is however provided to show
where the project came from. It was designed so that if your env.yml
(or env.mac.yml
) file changes you can automatically update the
depedencies of the env2ini
package (under settings.ini
) to match.
$ python env_to_ini.py
# show packages that didnt change
$ python env_to_ini.py --unchanged
# specify a different environment file
$ python env_to_ini.py --unchanged --file=env.mac.yml
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file env2ini-0.0.2.tar.gz
.
File metadata
- Download URL: env2ini-0.0.2.tar.gz
- Upload date:
- Size: 21.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac95afd3598f4bcdd0e031e63082f7781ca2c60ca8e0bcd4b0fde03624798204 |
|
MD5 | d867f19bb2eeb9a04e857d3bd730dc02 |
|
BLAKE2b-256 | 4f28e9827766da2d2f171a149871371e7361d8dbe802f38219065d6e76ae5710 |
File details
Details for the file env2ini-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: env2ini-0.0.2-py3-none-any.whl
- Upload date:
- Size: 24.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad2cfac1a5586a6c4d44e98b5dbd9fdc53d99c0973658f23147045ce2e84dba1 |
|
MD5 | d829302a5605e4e5d668ec01758c708f |
|
BLAKE2b-256 | a3905954f44944020837850002ccadeb02f37c1219dbd6ca010b421377479f6d |