cjm-nbdev-utils
Install
pip install cjm_nbdev_utils
Project Structure
nbs/
└── env_gen.ipynb # Generate an environment.yml from an nbdev-style settings.ini
Total: 1 notebook
Module Dependencies
graph LR
env_gen[env_gen<br/>env_gen]
No cross-module dependencies detected.
CLI Reference
gen_env_from_settings Command
usage: gen_env_from_settings [-h] [--settings SETTINGS] [--name NAME]
[--extras EXTRAS] [--no-editable]
[--include-pip-reqs] [--no-include-pip-reqs]
[--out OUT] [--stdout]
Generate environment.yml from nbdev settings.ini
options:
-h, --help show this help message and exit
--settings SETTINGS Path to settings.ini
--name NAME Environment name override
--extras EXTRAS Editable pip extras to install, e.g. 'dev' or
'dev,docs'. Use '' to install no extras.
--no-editable Do not include editable install (-e .).
--include-pip-reqs Also include 'requirements' and 'dev_requirements'
from settings.ini in pip section.
--no-include-pip-reqs
Do not include pip requirements from settings.ini
(default).
--out OUT Output file path.
--stdout Write YAML to stdout instead of a file.
For detailed help on any command, use
gen_env_from_settings <command> --help.
Module Overview
Detailed documentation for each module in the project:
env_gen (env_gen.ipynb)
Generate an environment.yml from an nbdev-style settings.ini
Import
from cjm_nbdev_utils.env_gen import (
DEFAULT_ENV_NAME,
DEFAULT_CHANNELS,
read_settings,
get_section,
split_list,
normalize_python_spec,
collect_values,
emit_yaml,
main
)
Functions
def read_settings(
path: str # Path to settings.ini file
) -> configparser.ConfigParser: # Configured ConfigParser object
"Read settings.ini file with percent-style interpolation."
def get_section(
cp: configparser.ConfigParser # ConfigParser object
)
"Get configuration section from ConfigParser. nbdev puts keys at top-level (DEFAULT). Falls back to first section if present."
def split_list(
val: str | None # String value to split (can be None)
) -> List[str]: # List of unique, non-empty strings preserving order
"Split space- and/or comma-separated lists while respecting quotes."
def normalize_python_spec(
min_py: str=None # Minimum Python version string
) -> str: # Normalized Python specification string or None
"Normalize Python version specification for conda. Accepts ">=3.10", "3.10", "3.9.*", etc. If bare like "3.10", makes it ">=3.10"."
def collect_values(
cfg # Configuration section dictionary - TODO: Add type hint
) -> Tuple[str, List[str], List[str], List[str], List[str]]: # Tuple of (env_name, channels, conda_reqs, pip_reqs, dev_pip_reqs)
"Collect configuration values from settings."
def emit_yaml(
name: str, # Environment name
channels: List[str], # List of conda channels
conda_deps: List[str], # List of conda dependencies
pip_lines: List[str], # List of pip packages
) -> str: # YAML formatted string
"Generate environment.yml content. Manual YAML emitter to avoid extra dependencies."
def main()
"""
Generate environment.yml from nbdev settings.ini.
Reads: lib_name, min_python, conda_channels, conda_requirements,
requirements, dev_requirements (all optional).
Writes: environment.yml (or stdout).
Adds an editable pip install (-e ".[EXTRAS]") by default.
Examples:
python gen_env_from_settings.py
python gen_env_from_settings.py --name myproj-dev --extras dev,docs --out env.yml
python gen_env_from_settings.py --no-editable --stdout
python gen_env_from_settings.py --no-include-pip-reqs
"""
Variables
DEFAULT_ENV_NAME = 'nbdev-env'
DEFAULT_CHANNELS = [1 items]
Metadata
Release files for cjm-nbdev-utils 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| cjm_nbdev_utils-0.0.5.tar.gz | 9.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cjm_nbdev_utils-0.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.4 kB
Release files / cjm_nbdev_utils-0.0.5.tar.gz
| Download URL | cjm_nbdev_utils-0.0.5.tar.gz |
|---|---|
| Size | 9.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7074be9eb003dd5e443e43643d94b6aae89239be0eba6adf0b2ed800ae860f3e
|
|
BLAKE2b-256 checksum How to use checksums |
3103f6ae162944665953e3a3b6c69a0149c77ec4c5360a34a30e3db627b5c558
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.13
|
Release files / cjm_nbdev_utils-0.0.5-py3-none-any.whl
| Download URL | cjm_nbdev_utils-0.0.5-py3-none-any.whl |
|---|---|
| Size | 11.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7e8495bd1918adb7797fd4939c4a61cab0c6af72bdd5fe0e971a94d7b268d849
|
|
BLAKE2b-256 checksum How to use checksums |
3e24afaf3649fb56dc3f002ddd779078d2a2f83418ebe07e7cc71bc9daa072e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.13
|
Security for cjm-nbdev-utils 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.