Giter Club home page Giter Club logo

requmancer's Introduction

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.txt file for pip or a pyproject.toml section 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:

  1. Clone the repository:
git clone https://github.com/ParisNeo/requmancer.git
cd requmancer
  1. Create a virtual environment and activate it:
python -m venv venv
source venv/bin/activate  # On Windows, use `venv\Scripts\activate`
  1. Install the development dependencies:
pip install -r requirements_dev.txt
  1. 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.

requmancer's People

Contributors

parisneo avatar

Stargazers

Stefan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.