rdsq/pypi-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is an API wrapper for the PyPI API

iterate is a method to iterate all packages in the PyPI registry

import * as pypi from '@rdsq/pypi';

for (const packageName of await pypi.iterate()) {
    console.log(packageName); // a lot
}

all method returns all packages in the PyPI registry as a list of strings. It is often more efficient to use the iterate method

import * as pypi from '@rdsq/pypi';

const packages = await pypi.all();

console.log(packages[0]);
// should be "0"

getPackage is a method to get data about any package in the PyPI registry

import * as pypi from '@rdsq/pypi';

console.log(await pypi.getPackage('django'));

stats is a method for getting stats of the PyPI registry. Has only two fields: top_packages and total_packages_size

import * as pypi from '@rdsq/pypi';

const stats = await pypi.stats();

console.log('Total packages size in bytes:', stats.total_packages_size);

const top1 = Object.keys(stats.top_packages)[0];

console.log('Top 1 package:', top1);
console.log('Its size:', stats.top_packages[top1].size);

This package also features two types:

  • PypiPackage for the getPackage method
  • PypiStats for the stats method

About

PyPI API wrapper for JavaScript

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published