Generate notebook_requirements.txt files for Jupyter Notebooks (.ipynb files).
Project description
nbreqs
nbreqs
is a lightweight Python tool designed to extract the external library dependencies from Jupyter notebooks.
I made this tool because I manage repositories containing several notebooks with poetry
, whereas users will only use single notebooks and copy them to other directories not themselves managed by poetry
. They thus need requirement files specific to each notebook instead of the repository's total requirements.
nbreqs
generates a <notebook>_requirements.txt
file for each notebook in the same directory as each notebook.
Features
- Finds notebooks recursively starting at the provided
PATH
. - Extracts only external dependencies found on PyPI (ignores standard library modules and sources other than PyPI).
- Works on Jupyter notebooks.
- Generates minimal
<notebook>_requirements.txt
files (one per notebook).
Installation
The preferred way of installing this tool is through pipx
:
pipx install nbreqs
It can also be installed as a library through pip
; check the tests for examples.
Usage
Once installed, the utility is used on the command line; see --help
for details:
The
--pin
option has been disabled until issue #7 is fixed!
Development
Contributions are welcome; please:
- Activate
pre-commit
and useblack
. - Ensure
pytest
runs without failures. - Be nice.
License
nbreqs
is licensed under the MIT License. See LICENSE file for details.
Project details
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 nbreqs-0.2.1.tar.gz
.
File metadata
- Download URL: nbreqs-0.2.1.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.5 Linux/6.9.12-3-MANJARO
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7e7cff74d6549a818ae1cef012a961f1bf3ad87050fce0bca8a62cdc1526756 |
|
MD5 | de9496e8cf02f81d571df54cf79c7f28 |
|
BLAKE2b-256 | 44f042710baf118a15375e3ffdb7ff162da1415c7f15ea0ca2478bcc09f1e426 |
File details
Details for the file nbreqs-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: nbreqs-0.2.1-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.5 Linux/6.9.12-3-MANJARO
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd2a306cf471c9ffe4e79e5057eb3cb0604aa2d18c8ec371dae72ae626a3beaa |
|
MD5 | 385ef0cddcd85d68e7b138db69b8a9dd |
|
BLAKE2b-256 | 27be62a7579311190c7296ee2adce898003de94601e787275d66bd9b2b121b65 |