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
# pypi server: https://pypi.org/pypi

# 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
# pypi server: https://pypi.org/pypi

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
  -p, --pypi-server TEXT  the custom PyPI server URL

  -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
# Specify custom PyPI mirror server (useful for slow or blocked networks)
showmereqs . -p https://mirrors.aliyun.com/pypi/simple/

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.8.tar.gz (61.4 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.8-py3-none-any.whl (28.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: showmereqs-0.1.8.tar.gz
  • Upload date:
  • Size: 61.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for showmereqs-0.1.8.tar.gz
Algorithm Hash digest
SHA256 f5097ee5fee9ef1f15729945dd9e93b34f9b216d5f1980c70c82278621fd74d5
MD5 19ce281cea2e70054355dab6244fc279
BLAKE2b-256 2bc363d5b83cbea2126ad84dca5e3ab58d6b2db753dcf114027c6ab80bb661ef

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for showmereqs-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 ec2e0d29ed490e81a23a545975ccedbf3b5ea119955ff268ca952e2c2c1908c5
MD5 8fcc818efecc3d491a84aa672add3f8a
BLAKE2b-256 2f09cf7dd0eed673ad3abcd45440df4d8ab478505f54b94b445db3852bbe960e

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