DEV Community

Алексей Спинов
Алексей Спинов

Posted on

PyPI API: Discover Python Packages in Any Domain (Free, Instant)

PyPI (Python Package Index) has a JSON API that lets you search 500K+ packages. No auth needed.

Get Package Info

curl 'https://pypi.org/pypi/scrapy/json'
Enter fullscreen mode Exit fullscreen mode

Returns: name, version, summary, author, license, downloads, dependencies.

Search via Simple API

PyPI doesn't have a traditional search endpoint, but you can use the simple index:

async function searchPyPI(query) {
  // Use PyPI search via xmlrpc
  const url = `https://pypi.org/search/?q=${encodeURIComponent(query)}&o=`;
  const res = await fetch(url);
  const html = await res.text();

  // Parse search results
  const matches = [...html.matchAll(/class="package-snippet__name">([^<]+)<.*?class="package-snippet__description">([^<]*)</gs)];
  return matches.map(m => ({ name: m[1].trim(), description: m[2].trim() }));
}
Enter fullscreen mode Exit fullscreen mode

Or get specific package details:

async function getPackage(name) {
  const res = await fetch(`https://pypi.org/pypi/${name}/json`);
  const data = await res.json();
  return {
    name: data.info.name,
    version: data.info.version,
    summary: data.info.summary,
    author: data.info.author,
    license: data.info.license,
    url: data.info.project_url
  };
}

const scrapy = await getPackage('scrapy');
console.log(scrapy);
Enter fullscreen mode Exit fullscreen mode

Why PyPI Data Matters

  • Package count in a niche = Python developer interest
  • Download stats = actual adoption (not just GitHub stars)
  • Dependencies = technology stack analysis
  • New packages = emerging tools and trends

Use Cases

  1. Market research — how big is the Python ecosystem for X?
  2. Technology scouting — what new tools are being published?
  3. Build vs buy — does a library already exist for your use case?
  4. Developer hiring — what packages do candidates need to know?

The Full Set

PyPI is one of 9 free APIs I use for automated market research:

# API Data
1 Wikipedia Market overviews
2 Google News Latest articles
3 GitHub Tech landscape
4 HN Algolia Community sentiment
5 Stack Overflow Developer questions
6 arXiv Academic research
7 npm JS ecosystem
8 Reddit Community discussion
9 PyPI Python ecosystem

All free. No keys. No rate limit hassles.


Need Python ecosystem analysis or data extraction? $20 flat rate. Email: Spinov001@gmail.com | Hire me

Top comments (0)