A tool to generate requirements files from Python projects
Project description
Requmancer
Requmancer is a powerful Python library and command-line tool that analyzes your Python project and generates a comprehensive requirements file. It automatically detects imported packages, determines their versions, and creates either a pip-compatible requirements.txt or a Poetry-style pyproject.toml section.
With Requmancer, managing your project's dependencies becomes a breeze, ensuring reproducibility and easier setup for other developers.
Features
- Automatically detects third-party imports in your Python project.
- Determines the installed versions of the imported packages.
- Generates a
requirements.txtfile for pip or apyproject.tomlsection for Poetry. - Handles both absolute and relative imports.
- Excludes standard library modules from the requirements file.
Installation
You can install Requmancer using pip:
pip install requmancer
Usage
Requmancer can be used both as a command-line tool and as a Python library.
Command-Line Usage
To generate a requirements.txt file for your project, navigate to the root directory of your project and run:
requmancer .
You can specify the output file name and format using the -o and -f options:
requmancer . -o requirements.txt -f pip
requmancer . -o pyproject.toml -f poetry
Python Library Usage
You can also use Requmancer as a Python library in your own scripts:
from requmancer.main import RequirementsGenerator
generator = RequirementsGenerator(directory='path/to/your/project', output_file='requirements.txt', format='pip')
generator.generate()
Example
Suppose you have a Python project with the following structure:
my_project/
├── main.py
├── module/
│ └── submodule.py
└── requirements.txt
And the main.py file contains:
import requests
import numpy as np
Running requmancer . in the my_project directory will generate a requirements.txt file with the following content:
requests==2.25.1
numpy==1.19.5
Development
To contribute to Requmancer, follow these steps:
- Clone the repository:
git clone https://github.com/ParisNeo/requmancer.git
cd requmancer
- Create a virtual environment and activate it:
python -m venv venv
source venv/bin/activate # On Windows, use `venv\Scripts\activate`
- Install the development dependencies:
pip install -r requirements_dev.txt
- Run the tests:
pytest
License
Requmancer is licensed under the MIT License. See the LICENSE file for more information.
Author
Requmancer is developed and maintained by ParisNeo.
Acknowledgements
Special thanks to the open-source community for providing the tools and libraries that made this project possible.
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 requmancer-0.1.0.tar.gz.
File metadata
- Download URL: requmancer-0.1.0.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88fad994c340878d04f33c4aa35b8fea531a1c43f87294ed382f5571c8a5c74a
|
|
| MD5 |
bfa5ad8545136160f17a3879ff06d826
|
|
| BLAKE2b-256 |
6ac87499aca6ec0256d6cd06a30a42c66c2af0eff544953ba5ebf3db8ebc61d8
|
File details
Details for the file requmancer-0.1.0-py3-none-any.whl.
File metadata
- Download URL: requmancer-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5cc4fe8b364d12415f6b473322f6921dea50053c4928850654c6e3ff0cc2bb2
|
|
| MD5 |
a9a185c2cd62c2b319a4886f2e7f8bde
|
|
| BLAKE2b-256 |
5990fd4fc2d6f52fae892ac2b1d8498b66060537ae2c6a301295ee660da7d417
|