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
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file showmereqs-0.1.6.tar.gz.
File metadata
- Download URL: showmereqs-0.1.6.tar.gz
- Upload date:
- Size: 60.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a47e1f167eb2b1d4eb7be2b61aa801cb1b3a77dfbf77ec8330cefadc209b69e5
|
|
| MD5 |
554b0d3f31532234b2b637d48861c9e4
|
|
| BLAKE2b-256 |
7931d7fd3a7ec396bf024b2905ebc097bc8e7bc9398a206e3aca32611c335698
|
File details
Details for the file showmereqs-0.1.6-py3-none-any.whl.
File metadata
- Download URL: showmereqs-0.1.6-py3-none-any.whl
- Upload date:
- Size: 27.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5844f3cab254fa44d01e2422be16abdf35f5c1089f4e940f3e9f4100c035f9c
|
|
| MD5 |
79c1e0b7c2b608074ede3946a7d1627f
|
|
| BLAKE2b-256 |
1b49a08c44a7aad7c05f639e8bde7de6325bac85148bc2f14f6597a1b2e5d8bb
|