Skip to main content

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

Metadata

Release files for env2ini 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for env2ini 0.0.2
File Size Uploaded
env2ini-0.0.2.tar.gz 21.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for env2ini 0.0.2
File Interpreter ABI Platform
env2ini-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 45.3 kB

Release files / env2ini-0.0.2.tar.gz

Download URL env2ini-0.0.2.tar.gz
Size 21.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ac95afd3598f4bcdd0e031e63082f7781ca2c60ca8e0bcd4b0fde03624798204
BLAKE2b-256 checksum
How to use checksums
4f28e9827766da2d2f171a149871371e7361d8dbe802f38219065d6e76ae5710
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.11

Release files / env2ini-0.0.2-py3-none-any.whl

Download URL env2ini-0.0.2-py3-none-any.whl
Size 24.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ad2cfac1a5586a6c4d44e98b5dbd9fdc53d99c0973658f23147045ce2e84dba1
BLAKE2b-256 checksum
How to use checksums
a3905954f44944020837850002ccadeb02f37c1219dbd6ca010b421377479f6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.11

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page