Skip to main content

PyPi download statistics for several packages or for all packages from a user

Project description

PyPi download statistics for several packages or for all packages from a user

pip install pipuserstats

Retrieves download statistics for a given user or package(s) from PyPI Stats API.

Args:
	username_or_packages (str | tuple | list): The username or package(s) to retrieve statistics for.
	If a string is passed,  username_or_packages will be treated as a username. If a list/tuple is passed,
	username_or_packages will be treated as packages.
	sleeptime (float | int, optional): The time to sleep between API requests. Defaults to 1.0.
	clear_cache (bool, optional): Whether to clear the PyPI Stats API cache before retrieving statistics.
		Defaults to False.

Returns:
	pd.DataFrame: A pandas DataFrame containing the download statistics for the given user or package(s).

Raises:
	Exception: If an error occurs while retrieving statistics for a package.





from pipuserstats import get_user_pip_stats

df = get_user_pip_stats(
    username_or_packages="hansalemao", sleeptime=1, clear_cache=False
)
print(df)
"""
# -1 means "no data available"
                             total  2023-04-20  ...  2022-10-23  2022-10-22
a-cv-imwrite-imread-plus      3593          31  ...          -1          -1
a-cv-sift-detection            244          -1  ...          -1          -1
a-cv2-calculate-difference     279           2  ...          -1          -1
a-cv2-calculate-simlilarity    339           2  ...          -1          -1
a-cv2-easy-resize             2223          24  ...          -1          -1
                            ...         ...  ...         ...         ...
"""

df = get_user_pip_stats(
    username_or_packages=["pandas", "numpy"], sleeptime=0.5, clear_cache=False
)

"""
df
Out[4]: 
            total  2023-04-20  2023-04-19  ...  2022-10-24  2022-10-23  2022-10-22
pandas  639313100     4258267     4265098  ...     3721798     2540678     2738365
numpy   843036266     5667169     5747109  ...     4882242     3261557     3556995
[2 rows x 181 columns]
"""
	
"""

Project details


Download files

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

Source Distribution

pipuserstats-0.10.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

pipuserstats-0.10-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file pipuserstats-0.10.tar.gz.

File metadata

  • Download URL: pipuserstats-0.10.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for pipuserstats-0.10.tar.gz
Algorithm Hash digest
SHA256 eb49cef2d3bc7008a22058b70c701904c1836c1d7847af66dfd0fc29f1967948
MD5 e6c8d9a0b9ce0d8a04c1db8ac9281de3
BLAKE2b-256 7512122b85f568b1e933df30ccda402ae995dddf72572d3b0a83a8acdaf1bf31

See more details on using hashes here.

File details

Details for the file pipuserstats-0.10-py3-none-any.whl.

File metadata

  • Download URL: pipuserstats-0.10-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for pipuserstats-0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 80ca8456cd3ba1d9ccd4b12c249ecde2e0ca834d65a3dcf953ea76e1e9e3a0d9
MD5 eb811d005314dea00644ccc2f585281c
BLAKE2b-256 7e97741ba2366e70c594c2c27850c83a8160d4abed92badc9ed5368f796a1372

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page