Hundreds of millions of Python packages are downloaded using Conda every month. That's why we are excited to announce the release of condastats, a conda statistics API with Python interface and Command Line interface. Now anyone can use this tool to conduct research on usage statistics for Conda packages. This project is inspired by pypistats, which is a Python client and CLI for retrieving PyPI package statistics.
Data source
Since May 2019, we have published hourly summarized download data for all Conda packages, conda-forge channel, and a few other channels. The dataset starts in January 2017 and is uploaded once a month. Condastats is built on top of this public Anaconda package data and returns monthly package download statistics.Installation
condastats
is released on conda-forge
. To install condastats, run this command in your terminal:conda install -c conda-forge condastats
Command-line interface
There are five sub-commands in the condastats command: overall, pkg_platform, data_source, pkg_version, and pkg_python. Runcondastats --help
in terminal or run !condastats --help
in Jupyter Notebook to see all sub-commands:In [1]:
!condastats --help
overall
condastats overall
returns overall download statistics for one or more packages for specific months and for specified package platform, python version, package version, and data source. Run condastats overall --help
in terminal or run !condastats overall --help
in Jupyter Notebook for details:details:
In [2]:
!condastats overall --help
The only required argument is
package
, which can be one or more packages. When only given package name(s), it will return the total package download number for all the available Anaconda public datasets, which is from 2017 through the end of last month. Here we show total package download statistics for one package (e.g., pandas), and for multiple packages (e.g., pandas, dask, and numpy).In [3]:!condastats overall pandas
In [4]:
!condastats overall pandas dask numpy
We can also get package download statistics for specified month, package platform, data source, package version, and python version:
In [5]:
!condastats overall pandas --month 2019-01 --pkg_platform linux-32 --data_source anaconda \
--pkg_version 0.10.0 --pkg_python 2.6
And finally, when we pass in the
monthly
argument, we will get monthly values.In [6]:
!condastats overall pandas --start_month 2019-01 --end_month 2019-03 --monthly
pkg_platform, data_source, pkg_version, and pkg_python
The other four subcommands have similar functions:condastats pkg_platform
returns package download counts by package platform.condastats data_source
returns package download counts by the data source.condastats pkg_version
returns package download counts by package version.condastats pkg_python
returns package download counts by python version.
condastats pkg_platform --help
and condastats data_source --help
:In [7]:
!condastats pkg_platform --help
In [8]:
!condastats data_source --help
Same as
condastats overall
, we can specify a month, or provide the start month and the end month of the time period we are interested in. For example, we can see package download counts for each python version for pandas for a specific month.In [9]:
!condastats pkg_python pandas --month 2019-01
And we can see the monthly counts for each python version with the
monthly
flag.In [10]:
!condastats pkg_python pandas --start_month 2019-01 --end_month 2019-02 --monthly
Python interface
To use the Python interface, we need to import the functions from thecondastats
package by running:In [11]:
from condastats.cli import overall, pkg_platform, pkg_version, pkg_python, data_source
Here are the function signatures for these five functions:
In [12]:
help (overall)
In [13]:
help(pkg_platform)
In [14]:
help(pkg_version)
In [15]:
help(pkg_python)
In [16]:
help(data_source)
Similar to command-line interface, we can get the total package download counts for all the available data since 2017, for a given month, or a given combination of specifications:
overall(['pandas','dask'])
Out[17]:
In [18]:
overall(['pandas','dask'], month='2019-01')
Out[18]:
In [19]:
overall('pandas',month='2019-01', pkg_platform='linux-32',data_source='anaconda',pkg_version='0.10.0',pkg_python=2.6)
Out[19]:
Similarly, pkg_platform, pkg_version, pkg_python, and data_source functions will give us package counts for each package platform, package version, python version, and data source for a given package. Here are two examples with pkg_python:
In [20]:
pkg_python('pandas', month='2019-01')
Out[20]:
In [21]:
pkg_python('pandas', start_month='2019-01', end_month='2019-02', monthly=True)
Out[21]:
We hope you find
condastats
useful! If you have any requests or issues, please open an issue or a pull request. If you have any questions regarding the Anaconda public dataset, please check out https://github.com/ContinuumIO/anaconda-package-data and open an issue there.