CLI tool to get package info from PyPI and add to requirements.
Project description
whatsonpypi
CLI tool to get package info from PyPI and/or manipulate requirements.
Installation
$ pip install -U whatsonpypi
Requirements
Python 3.7+
Features
Find information on a package on PyPI
Examples:
$ whatsonpypi django NAME Django LATEST VERSION 2.1.5 SUMMARY A high-level Python Web framework that encourages rapid development and clean, pragmatic design. PACKAGE URL https://pypi.org/project/Django/ AUTHOR Django Software Foundation LATEST RELEASES 2.2a1, 2.1rc1, 2.1b1, 2.1a1, 2.1.5
For more information..
Examples:
$ whatsonpypi django --more ...
Version specific information..
Examples:
$ whatsonpypi django==2.1.4 --more ...
Launch documentation URL of project in a browser tab
Examples:
$ whatsonpypi django --docs
Add packages to your requirements files.
Examples:
$ whatsonpypi django --add
By default, it searches for files with names matching requirements*.txt in the current working directory and adds the dependency to the end of the file.
You can change the filename pattern to search for. The pattern may contain simple shell-style wildcards.
$ whatsonpypi django --add --req-pattern "*.txt"
If there’s more than one file, you will see a prompt allowing you to select the files that should be modified.
If you want the dependency to be added to a specific line, mention a comment #wopp on its own line, which will be replaced with the dependency:
Example:
Do this in your requirements.txt:
# Django django==2.1.5 # testing pytest==4.1.1 #wopp
Then running this:
$ whatsonpypi pytest-runner --add
will produce this:
# Django django==2.1.5 # testing pytest==4.1.1 pytest-runner==4.2
Use requirements specifications as needed. ==, >=, <= or ~= using --ee, --ge, --le or --te. Default is --ee:
$ whatsonpypi pytest-runner --add --ge
will produce this:
# Django django==2.1.5 # testing pytest==4.1.1 pytest-runner>=4.2
Existing dependencies will be replaced with newer versions. Dependency version by default is the latest unless specified explicitly like:
$ whatsonpypi pytest-runner==4.1 --add
Optionally, directory to search for requirement files can be specified with --req-dir. Both absolute and relative paths are allowed. Must be a directory.
$ whatsonpypi pytest-runner==4.1 --add --req-dir /Users/Me/Documents/GitHub/project/requirements
Default value (if not provided) is the directory where the command is run (cwd).
Also, optionally, you can specify comments to add before a dependency. Note that the comment will not be added if the dependency already exists in the file.
For example, running this:
$ whatsonpypi pytest-runner --add --comment 'testing'
will add this:
# testing pytest-runner==4.2
See all options with:
$ whatsonpypi --help
Credits
Cookiecutter and the audreyr/cookiecutter-pypackage project template for getting me started.
History
0.3.0 (2023-01-15)
dropped Python2 support. Requires 3.7+ now.
0.2.8 (2019-02-13)
more py2 fixes
use utf-8 while opening files
0.2.7 (2019-02-12)
fix for py2 ImportError
0.2.6 (2019-02-06)
fix absence of new lines
0.2.5 (2019-02-05)
fix requirements file format check
0.2.4 (2019-01-29)
add –comment to allow mentioning comments with –add
0.2.3 (2019-01-26)
add –req-pattern to allow specifying search pattern for requirements files
raise Error when no requirements files are found
0.2.2 (2019-01-23)
Fix empty dependencies display
0.2.1 (2019-01-23)
Small fixes
0.2.0 (2019-01-22)
Add -a/–add to enable adding packages to requirement files.
Added -d/–docs to launch docs URL in browser
Allow version specific querying
0.1.2 (2019-01-20)
Display more package info
added –more/-m for even more info
0.1.1 (2019-01-02)
First release on PyPI.
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 whatsonpypi-0.3.1-py3-none-any.whl
.
File metadata
- Download URL: whatsonpypi-0.3.1-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9ca43e2a7c2aff1c02a5f265e43320a03b61ee2a4232069e476acd96a3f5726 |
|
MD5 | 0a62158815563d8d970d49f8b1d1d934 |
|
BLAKE2b-256 | 96498ae3792084352844a8cd3987f2779990d8a4bfd7c1d86bb879c60b5b7e17 |