All Projects → damnever → Pigar

damnever / Pigar

Licence: bsd-3-clause
☕️ A fantastic tool to generate requirements.txt for your Python project, and more than that. (IT IS NOT A PACKAGE MANAGEMENT TOOL)

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Pigar

Py webauthn
A WebAuthn Python module.
Stars: ✭ 270 (-74.72%)
Mutual labels:  pypi, pip
Bookmarklet Maker
Tool to create bookmarklet/ javascript apps to automate the web browser.
Stars: ✭ 52 (-95.13%)
Mutual labels:  automation, tool
Underscore.py
Python port of underscore.js
Stars: ✭ 277 (-74.06%)
Mutual labels:  pypi, pip
rfc-bibtex
A command line tool that creates bibtex entries for IETF RFCs and Internet Drafts.
Stars: ✭ 43 (-95.97%)
Mutual labels:  pypi, pip
Matrixprofile Ts
A Python library for detecting patterns and anomalies in massive datasets using the Matrix Profile
Stars: ✭ 621 (-41.85%)
Mutual labels:  pypi, pip
pipsalabim
An assistant to guess your pip dependencies from your code, without using a requirements file.
Stars: ✭ 15 (-98.6%)
Mutual labels:  pypi, pip
Pip Upgrader
An interactive pip requirements upgrader. It also updates the version in your requirements.txt file.
Stars: ✭ 340 (-68.16%)
Mutual labels:  pypi, pip
pipx
Install and Run Python Applications in Isolated Environments
Stars: ✭ 5,698 (+433.52%)
Mutual labels:  pypi, pip
Try
Dead simple CLI tool to try Python packages - It's never been easier! 📦
Stars: ✭ 588 (-44.94%)
Mutual labels:  pypi, pip
Release It
🚀 Automate versioning and package publishing
Stars: ✭ 4,773 (+346.91%)
Mutual labels:  automation, tool
poetry-setup
Generate setup.py (setuptools) from pyproject.toml (poetry)
Stars: ✭ 44 (-95.88%)
Mutual labels:  pypi, pip
Python Pixabay
Python 3 Pixabay's API wrapper.
Stars: ✭ 32 (-97%)
Mutual labels:  pypi, pip
pipyuan
pipyuan 内置了国内常用的 pip 源, 你可以快速设置想要的源
Stars: ✭ 30 (-97.19%)
Mutual labels:  pypi, pip
allalgorithms-python
The All ▲lgorithms Python Library.
Stars: ✭ 31 (-97.1%)
Mutual labels:  pypi, pip
pip-download
A wrapper for pip download in offline scenario.
Stars: ✭ 22 (-97.94%)
Mutual labels:  pypi, pip
Pipx
Install and Run Python Applications in Isolated Environments
Stars: ✭ 4,398 (+311.8%)
Mutual labels:  pypi, pip
pypi-simple
PyPI Simple Repository API client library
Stars: ✭ 21 (-98.03%)
Mutual labels:  pypi, pip
pystyle
The source of my Python library, pystyle.
Stars: ✭ 158 (-85.21%)
Mutual labels:  pypi, pip
Piprot
How rotten are your requirements?
Stars: ✭ 409 (-61.7%)
Mutual labels:  pypi, pip
Create Component App
Tool to generate different types of React components from the terminal. 💻
Stars: ✭ 879 (-17.7%)
Mutual labels:  automation, tool

pigar

  • Generating requirements.txt for Python project.
    • Handling the difference between different Python versions.
    • Jupyter notebook (*.ipynb) support.
    • Including the import statements from exec/eval, doctest of docstring, etc.
  • Searching packages by import name.
  • Checking the latest versions for Python project.

NOTE: Pipenv or other tools is recommended for improving your development flow.

Installation

pigar can run on Python 2.7.+ and 3.2+.

To install it with pip, use:

[sudo] pip install pigar

To install it with conda, use:

conda install -c conda-forge pigar

To get the newest code from GitHub:

pip install git+https://github.com/damnever/[email protected][master or other branch] --upgrade

Usage

  • pigar can consider all kinds of complicated situations. For example, this project has py2_requirements.txt and py3_requirements.txt for different Python versions(see the above GIF).

    # Generate requirements.txt for current directory.
    $ pigar
    
    # Generating requirements.txt for given directory in given file.
    $ pigar -p ../dev-requirements.txt -P ../
    

    pigar can list all files which referenced the package(the line numbers for Jupyter notebook may be a bit confusing), for example:

    # project/foo.py: 2,3
    # project/bar/baz.py: 2,7,8,9
    foobar == 3.3.3
    

    If the requirements.txt is overwritten, pigar will show the difference between the old and the new.

  • If you do not know the import name that belongs to a specific package (more generally, does Import Error: xxx drive you crazy?), such as bs4 which may come from beautifulsoup4 or MySQLdb which could come from MySQL_Python, try searching for it:

    $ pigar -s bs4 MySQLdb
    
  • Checking for the latest version:

    # Specify a requirements file.
    $ pigar -c ./requirements.txt
    
    # Or, you can let pigar searching all *requirements.txt in the current directory
    # level by itself. If not found, pigar will generate a new requirements.txt
    # for the current project, then check for the latest versions.
    $ pigar -c
    
  • More:

    pigar --help
    

FAQ

(1) Why `pigar` generates multiple packages for same import name?

(2) Why pigar generates different packages for same import name in different environment?

pigar can not handle it gracefully, you may need to remove the duplicate packages in requirements.txt manually. Install the required package(remove others) in local environment should fix it as well.

Related issues: #32, #68, #75.

More

pigar does not use regular expressions in such a violent way. Instead, it uses AST, which is a better method for extracting imported names from arguments of exec/eval, doctest of docstring, etc.

Also, pigar can detect the difference between different Python versions. For example, you can find concurrent.futures from the Python 3.2 standard library, but you will need install futures in earlier versions of Python to get concurrent.futures, this is not a hardcode.

If you have any issues or suggestions, please submit an issue on GitHub. All contributions are appreciated!

LICENSE

The BSD 3-Clause License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].