Nbdev Extensions

Extensions on the nbdev library for conda yml creation and nightly build support
cat > test_settings.ini << EndOfMessage
[DEFAULT]
lib_name = fastrl_test
user = josiahls
branch = master
version = 0.0.1
min_python = 3.6
requirements = fastai>=2.0.0 moviepy
pip_requirements = pytest nvidia-ml-py3 dataclasses pandas pyyaml
conda_requirements = jupyter notebook setuptools
dev_requirements = jupyterlab nbdev ipywidgets moviepy pygifsicle aquirdturtle_collapsible_headings
EndOfMessage

mkdir testing
cp test_settings.ini testing/test_settings.ini

dependencies

 dependencies (dev:bool=False, cfg_name='settings.ini')

Gets a list of dependencies in a cfg_name for conda compatability.

test_eq(dependencies(cfg_name='test_settings.ini'),
        ['python=3.6', 'pip', 'setuptools', 'fastai>=2.0.0', 'moviepy', 
         'jupyter', 'notebook', 'setuptools', 
         {'pip': ['pytest', 'nvidia-ml-py3', 'dataclasses', 'pandas', 'pyyaml']}])
test_eq(dependencies(dev=True,cfg_name='test_settings.ini'),
        ['python=3.6', 'pip', 'setuptools', 'fastai>=2.0.0', 'moviepy', 'jupyter', 
         'notebook', 'setuptools', 'jupyterlab', 'nbdev', 'ipywidgets', 'moviepy', 
         'pygifsicle', 'aquirdturtle_collapsible_headings', 
         {'pip': ['pytest', 'nvidia-ml-py3', 'dataclasses', 'pandas', 'pyyaml']}])

create_conda_yaml

 create_conda_yaml (channels:str='conda-forge,pytorch,fastai',
                    cfg_name='settings.ini', dev:bool=False)

Creates a conda dictionary of the format of an env file.

test_eq(create_conda_yaml(cfg_name='test_settings.ini'),
       {'name': 'fastrl_test', 'channels': ['conda-forge', 'pytorch', 'fastai'], 
        'dependencies': ['python=3.6', 'pip', 'setuptools', 'fastai>=2.0.0', 
                         'moviepy', 'jupyter', 'notebook', 'setuptools', 
                         {'pip': ['pytest', 'nvidia-ml-py3', 'dataclasses', 'pandas', 'pyyaml']}]})
test_eq(create_conda_yaml(cfg_name='test_settings.ini',dev=True),
       {'name': 'fastrl_test_dev', 'channels': ['conda-forge', 'pytorch', 'fastai'], 
        'dependencies': ['python=3.6', 'pip', 'setuptools', 'fastai>=2.0.0', 
                         'moviepy', 'jupyter', 'notebook', 'setuptools', 'jupyterlab', 
                         'nbdev', 'ipywidgets', 'moviepy', 'pygifsicle', 'aquirdturtle_collapsible_headings', 
                         {'pip': ['pytest', 'nvidia-ml-py3', 'dataclasses', 'pandas', 'pyyaml']}]})

create_conda_yamls

 create_conda_yamls (also_dev:bool=True, cfg_name='settings.ini',
                     sub_dir='')

Creates conda env for normal and development environments.

create_conda_yamls(cfg_name='test_settings.ini',sub_dir='testing')
Object `testing/fastrl_test_env.yaml` not found.
channels:
- conda-forge
- pytorch
- fastai
dependencies:
- python=3.6
- pip
- setuptools
- fastai>=2.0.0
- moviepy
- jupyter
- notebook
- setuptools
- pip:
  - pytest
  - nvidia-ml-py3
  - dataclasses
  - pandas
  - pyyaml
name: fastrl_test
create_conda_yamls(sub_dir='extra')
rm test_settings.ini