Skip to main content

A module to extract Python dependencies packages from .py and .ipynb

Project description

PyReqify

Python
License GitHub Badge

A lightweight Python module for requirements.txt generation. It efficiently extracts imported modules and generates a requirements.txt file with module versions for .py and .ipynb files in a given directory. Simplify dependency management for your projects!

Features

  • 📦 Automatic Module Extraction: Scans .py and .ipynb files in a directory to find all imported modules.
  • 🔍 Version Detection: Fetches installed versions of imported modules (maps common aliases to official package names). It also gives the option to includes fetch source python version too.
  • 📝 Requirements Generation: Creates a requirements.txt file with all extracted dependencies and the current Python version.

Installation

Clone this repository and install the requirements.

pip install pyreqify

ExtractPackages

Usage

To use the pyreqify function and automatically create a requirements.txt file:

  1. Place all .py and .ipynb files in a folder (e.g., project).
  2. Run the function to generate a requirements.txt in the current directory with all extracted dependencies.
pyreqify <source_folder> <destination folder> --include-source-pyversion
generated requirement.txt file

scikit-learn==1.5.1
keras==3.6.0
numpy==2.0.1
pandas==2.2.2
open3d==0.16.1
webcolors==24.8.0
nbformat==5.10.4
matplotlib==3.9.1
typing==3.7.4.3
torch==2.2.2
python==3.10.14

Examples

Example 1: Generate requirements.txt in the current working folder without the Python version.

pyreqify ~/Workspace/project .

Example 2: Generate requirements.txt in the deploy folder, including the Python module versions and Python version in the file.

pyreqify ~/Workspace/project ~/Workspace/project/deploy --include-module-version --include-source-pyversion

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

pyreqify-0.0.10.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyreqify-0.0.10-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file pyreqify-0.0.10.tar.gz.

File metadata

  • Download URL: pyreqify-0.0.10.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for pyreqify-0.0.10.tar.gz
Algorithm Hash digest
SHA256 e9879b7b9c98441d27cc074d14c8b3907db31083c3fa33f9adf4244772488a86
MD5 a24cfac18a10b2b3a0a8a8933b2c47bf
BLAKE2b-256 c283963e582269083ba3ad88e144f60981bec6bd2e3a0ce69c8f498ce07b6c43

See more details on using hashes here.

File details

Details for the file pyreqify-0.0.10-py3-none-any.whl.

File metadata

  • Download URL: pyreqify-0.0.10-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for pyreqify-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 df7216b3413e85d09f7ef501f4c74651ecf4986959278e9c8670e145e50cf00e
MD5 ab6f1738532f0b361d5f4beb32809a8e
BLAKE2b-256 396e4d4e76e6c2530cfc33bfbdf2fcdc98cc9916a43f7d6e0ce3dbd834318641

See more details on using hashes here.

Supported by

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