Skip to main content

A lightweight tool to generate requirements.txt by analyzing import statements

Project description

ShowMeReqs

A lightweight command-line tool that generates requirements.txt by analyzing import statements in your Python projects.

Features

  • Intelligent third-party import detection
  • Automatic requirements.txt generation with versions in current env
  • Display missing packages in current environment
  • Display import names that differ from PyPI package names for manual review
  • Generate a clean requirements.txt file or a detail one

Installation

Install via pip:

pip install showmereqs

Usage

Generate requirements.txt for current directory:

showmereqs .

Or specify a project path:

showmereqs path/to/your/project

Examples

  • Detail Output

# generated by showmereqs
# python version: 3.11.7

# package with version in environment
# [package]         [import name]
Requests==2.32.3  # requests
click==8.1.7
pytest==8.3.4

# package without version
# [package]         [import name]
Pillow            # PIL
Theano            # theano
aiohttp
numpy
pandas
scipy
tensorflow
torch
typing-extensions # typing_extensions

# can not get package name and version
# [package]         [import name]
# None              # guidoooo
  • Normal Output

# generated by showmereqs
# python version: 3.11.7

Requests==2.32.3
click==8.1.7
pytest==8.3.4

Pillow
Theano
aiohttp
numpy
pandas
scipy
tensorflow
torch
typing-extensions

# can not get package name and version
# [package]         [import name]
# None              # guidoooo

Command Line Options

$ showmereqs --help
Usage: showmereqs [OPTIONS] [PATH]

Analyze Python project dependencies and generate requirements.txt

Options:
  -f, --force        Force overwrite output file if it exists
  -nd, --no-detail   Generate cleaner requirements.txt with less comments
  -o, --outdir TEXT  Path to output directory, default is the path you give

  -h, --help        Show this message and exit

Examples:

# Generate requirements.txt in current directory
showmereqs .
# Generate in specific output directory
showmereqs . -o /path/to/output
# Force overwrite existing requirements.txt
showmereqs . -f
# Generate clean requirements.txt without comments
showmereqs . --nd

Why ShowMeReqs?

Traditional approaches like pip freeze capture all environment dependencies, while modern tools like Poetry can be overly complex for simple needs. ShowMeReqs bridges this gap by offering a streamlined solution that identifies only the dependencies your project actually uses.

Additionally, once ShowMeReqs generates the initial requirements.txt, you can easily migrate to modern package management tools for more comprehensive dependency management.

Acknowledgments & License

This project is licensed under the Apache License, Version 2.0 - see the LICENSE file for details.

ShowMeReqs uses package mapping and stdlib data from pipreqs under the Apache 2.0 license. As pipreqs development has slowed, ShowMeReqs aims to provide an actively maintained alternative for the Python community.

Roadmap

Future releases will include:

  • Additional CLI options for customization
  • Support for excluding specific packages or directories
  • Analyze dependencies between missing packages to determine their versions
  • Version range specifications
  • Integration with other package management tools

Feel free to open issues for feature requests or bug reports.

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

showmereqs-0.1.4.tar.gz (29.1 kB view details)

Uploaded Source

Built Distribution

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

showmereqs-0.1.4-py3-none-any.whl (28.1 kB view details)

Uploaded Python 3

File details

Details for the file showmereqs-0.1.4.tar.gz.

File metadata

  • Download URL: showmereqs-0.1.4.tar.gz
  • Upload date:
  • Size: 29.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.7

File hashes

Hashes for showmereqs-0.1.4.tar.gz
Algorithm Hash digest
SHA256 07082eb2b49209c6805f441507b149aa6ba9f149b202b0fb0aebb4561d80a951
MD5 7335a80acd75ee9c1674cdd977a4fd15
BLAKE2b-256 44427eda2df3bffc4ad4c213412978fb2b4d4a58f87339797d2ccc9c1da9156b

See more details on using hashes here.

File details

Details for the file showmereqs-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: showmereqs-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 28.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.7

File hashes

Hashes for showmereqs-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f0bdd2dbacf7205116b70c7ef7357d8f8fc2a82be6933b9b4c442834ba28ff1f
MD5 117b55da06bfa152719a2cd43e037302
BLAKE2b-256 445f5e3249e04d1234493dea8990b9b62e6710df631d025e4cb443ea8f0897f9

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