# PyPI Package Stats Scraper (`rainminer/pypi-package-stats-scraper`) Actor

Look up Python packages on PyPI and get latest version, license, Python requirement, dependencies, release history and daily, weekly and monthly download counts. Paste names or a PyPI URL. No API key.

- **URL**: https://apify.com/rainminer/pypi-package-stats-scraper.md
- **Developed by:** [rainminer](https://apify.com/rainminer) (community)
- **Categories:** Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.49 / 1,000 packages

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## PyPI Package Stats Scraper

Look up Python packages on PyPI and get **latest version, license, Python requirement, dependencies, release history and download counts** in one row per package.

No API key and no login. It reads the public PyPI JSON API and public pypistats.org download counts.

### What can this PyPI scraper do?

- Look up one package or a few hundred per run.
- Accept `requests`, `Typing_Extensions`, or a `pypi.org/project/...` URL, and normalise names the way PyPI does (PEP 503).
- Add daily, weekly and monthly download counts.
- Count published releases and give the first and latest upload date.
- List dependencies, classifiers and project links.
- Report an unknown project in the run summary instead of failing the run.
- Export JSON, CSV or Excel, and schedule a repeat through Apify.

### What data can you extract?

| Field | Meaning |
| --- | --- |
| name | Project name as PyPI spells it |
| version | Current version |
| summary | One-line summary |
| description | Long description, trimmed to 2000 characters |
| author / authorEmail | Maintainer fields when published |
| license | License string from the metadata |
| requiresPython | `Requires-Python` value |
| keywords | Free-text keywords |
| classifiers | Trove classifiers |
| homePage | Home page or project URL |
| projectUrls | Named project links such as Source, Documentation |
| requiresDist | Declared dependencies |
| releaseCount | Number of published releases |
| firstUploadAt | Upload time of the earliest release with files |
| latestUploadAt | Upload time of the newest release file |
| latestFileTypes | File kinds in the current release, for example `sdist`, `bdist_wheel` |
| dailyDownloads / weeklyDownloads / monthlyDownloads | Download counts from pypistats.org |
| yanked | True when the current release is yanked |
| packageUrl | PyPI project page |
| scrapedAt | When this row was collected |

Fields PyPI does not publish are `null`, not guessed. A missing dependency list means zero declared dependencies.

### How to use it

1. Put project names in **Packages**, one per line. The default input is `requests` and `pandas`.
2. Leave **Include download counts** on unless you only need metadata: it costs one extra request per package.
3. Run it and download the dataset. The run summary lands in the key-value store record `SUMMARY`.

`maxItems` caps the whole run, not each package.

### Notes

- Download counts come from pypistats.org, a third-party mirror of PyPI download logs. If it is unavailable the row is still saved, with `null` download fields.
- Release history uses the release list of the current project document, so it covers all versions PyPI still lists, not only the current one.

# Actor input Schema

## `packages` (type: `array`):

PyPI project names, for example requests or pandas, or full pypi.org project URLs.

## `maxItems` (type: `integer`):

Maximum number of dataset rows for the whole run.

## `includeDownloads` (type: `boolean`):

Fetch daily, weekly and monthly downloads from pypistats.org. One extra request per package.

## `includeReleaseHistory` (type: `boolean`):

Keep the number of published releases plus the first and latest upload date.

## Actor input object example

```json
{
  "packages": [
    "requests",
    "pandas"
  ],
  "maxItems": 50,
  "includeDownloads": true,
  "includeReleaseHistory": true
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

## `summary` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "packages": [
        "requests",
        "pandas"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("rainminer/pypi-package-stats-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "packages": [
        "requests",
        "pandas",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("rainminer/pypi-package-stats-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "packages": [
    "requests",
    "pandas"
  ]
}' |
apify call rainminer/pypi-package-stats-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,rainminer/pypi-package-stats-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/UqIKDipEA6JMbyPux/builds/6avzrs9KtW7LPmPBj/openapi.json
