Python requirements tool -- pigar
Project description
What pigar can do?
Generate requirements for project, pigar can consider all kinds of complicated situations. In this project, py2_requirements.txt and py3_requirements.txt for different python versions
# Generate requirements.txt for current directory. $ pigar # Generate requirements for given directory in given file. $ pigar -p ../dev-requirements.txt -P ../
If you do not know the import name belong to which package (more generally, are you crazy for Import Error: xxx?), such as bs4 may come from beautifulsoup4, MySQLdb may come from MySQL_Python, search it:
$ pigar -s bs4 MySQLdb
Check requirements latest version, just do:
# Specific a requirements file. $ pigar -c ./requirements.txt # Or, you can leave pigar search *requirements.txt in current directory # level by itself, if not found, pigar will generate requirements.txt # for current project then check latest version. $ pigar -c
Installation
Available in Python: 2.7.x, 3.x
[sudo] pip install pigar
Usage
usage: pigar [-h] [-v] [-u] [-s NAME [NAME ...]] [-c [PATH]] [-l LOG_LEVEL] [-p SAVE_PATH] [-P PROJECT_PATH] Python requirements tool -- pigar, it will do only one thing at each time. Default action is generate requirements.txt in current directory. optional arguments: -h, --help show this help message and exit -v, --version show pigar version information and exit -u, --update update database, use it when pigar failed you, exit when action done -s NAME [NAME ...] search package name by import name, use it if you do not know import name come from which package, exit when action done -c [PATH] check requirements latest version. If file path not given, search *requirements.txt in current directory, if not found, generate file requirements.txt, exit when action done -l LOG_LEVEL Show given level log messages, argument can be (ERROR, WARNING, INFO, DEBUG), case-insensitive -p SAVE_PATH save requirements in given file path, *used for* default action -P PROJECT_PATH project path, which is directory, *used for* default action
More
pigar do not use regular expression such a violence way, it use AST, that is a better method to extracting imported names from arguments of exec/eval, doctest of docstring, etc.
Also, pigar can consider difference between differen Python versions. For example, you can find concurrent.futures from Python 3.2 standart library, but you will need install futures before 3.2 version in Python to get concurrent.futures.
Finally, you already saw What pigar can do?. You can learn more from source code.
Hope pigar is useful to you.
LISENSE
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 Distributions
Built Distribution
File details
Details for the file pigar-0.5.3-py2.py3-none-any.whl
.
File metadata
- Download URL: pigar-0.5.3-py2.py3-none-any.whl
- Upload date:
- Size: 1.9 MB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bdd92f8acaa898fdfdcfb2b69d235a47036c12d1e2620081e3fa80e70586aecb |
|
MD5 | 4a236386b7323656349936ffb214bdf3 |
|
BLAKE2b-256 | 056f01568e26be4797e31eb55762ce8d9bffaa603a9cfb75906bd3496b460b9e |