Skip to main content

rqmts

rqmts - Generate pip requirements.txt file for any project by analysing package imports

Click here to see the demo.
Click here for documentation.

About the project

rqmts is a fantastic stand-alone tool which generates pip requirements.txt file for any project by analysing package imports.

It does not requires any dependency (works out-of-the-box), not needs internet to work (is completely offline, upto this moment), nor uses regular expressions in such a violent way as existing projects do. Instead, it uses simple heuristic techniques and parse conditional trees, which is a better method for extracting imported names from statements, functions, etc.

Why this project

Questions

  • Why not just use pip’s freeze command to generate a requirements.txt file for my project ?
  • Why to re-invent the wheel when there are modules such as pipreqs, pigar already present ?
  • Why not manually ?

Answers

  • Why not just pip freeze?
    • pip freeze only saves the packages that are installed with pip install in your environment.
    • pip freeze saves all packages in the environment including those that you don't use in your current project. (if you don't have virtualenv)
  • Why re-invent the wheel ?
    • pipreqs fails on many occasions (see - pipreqs/issues)
    • I found this repository and thought, "Hmm.. I think I can simply this problem while trying to match pipreqs results"
    • pigar queries pypi servers, big no-no. Ideally, it should be local. (on fallback? then maybe ..)
    • Other than that, pigar recommends using Pipenv (pipenv has serious issues)
    • Sheer curiousity. "I wonder if I can create a project that has potential of thosands of stars and most importantly, hundreds of contributors under 24 hours"
  • Manually ?
    • Are you serious right now ?

Installation

pip install --user rqmts

Contribute

The major challenge of this project is to extract the required metadata from modules which are first extracted from the input script.

Challenges

  • Version numbers in python can be in very different places depending on the case
  • Package name in the package index is independent of the module name we import

and these quirks make this project interesting. There's a funny comment in the source which reflects the diversity between us and it goes like :

# module_name.__version__ sucks, because we suck (PEP 0396)

This project aims to combine the best existing strategies to cover the broadest possible set of cases (if not all). The project was built keeping in mind the modular programming paradigms and so other than being readable it's easily extensible making it possible to add new strategies/algorithms quickly.

If you have any issues or suggestions, please do not hesitate to open an issue or a pull request!

License

This software is licensed under BSD 3-Clause "New" or "Revised" License. To view a copy of this license, visit BSD 3-Clause.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rqmts-1.0.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

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

rqmts-1.0.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file rqmts-1.0.0.tar.gz.

File metadata

  • Download URL: rqmts-1.0.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for rqmts-1.0.0.tar.gz
Algorithm Hash digest
SHA256 30197552cf01d3d93b5bc6290bb4d2150deb3cb9ce7a5e38d828e0e37b347858
MD5 a5667c324ec0f9dff99cc148c54cee4d
BLAKE2b-256 aece53fc13ba28469ca6c003333d7a230d7a403eb049a7946bef3878bf6e60f6

See more details on using hashes here.

File details

Details for the file rqmts-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: rqmts-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for rqmts-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 28a6c7a3e2c3312e44893edef7b16e3ec197fdc1a5fcb8406b5732456a4670a3
MD5 0885167c8f0d4a9dfb28e075ab9fd269
BLAKE2b-256 198dd920fba1b4ee7895f9388faa018b3d20e2c490549268884d35624c6bcb22

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 Sentry Error logging StatusPage Status page