Skip to main content

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:

asciicast

The --pin option was removed in version 0.2.2. See issue #7 for details.

Development

Contributions are welcome; please:

  • Activate pre-commit and use black.
  • 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

nbreqs-0.2.2.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

nbreqs-0.2.2-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file nbreqs-0.2.2.tar.gz.

File metadata

  • Download URL: nbreqs-0.2.2.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Windows/11

File hashes

Hashes for nbreqs-0.2.2.tar.gz
Algorithm Hash digest
SHA256 49017c0270f7504da0db9ce48cddc6a226b0bf5b1191cc28cbcca27cd44a79e0
MD5 5a2443eb5da738fd00269f8fee0007e7
BLAKE2b-256 eaefde75af7307e42882ce3f7a34707263e06ee76c0fa160f82e3086e5a98269

See more details on using hashes here.

File details

Details for the file nbreqs-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: nbreqs-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Windows/11

File hashes

Hashes for nbreqs-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 36f2e85ad74c8776d763973460c929cf750df32de64c725262698b3033378277
MD5 2a9e5a0d24e59b5d63beb15e1773d237
BLAKE2b-256 eba294221748961a54188f667448e6be2a50994089339fe9e8cfc1fbcff0eac8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page