Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rdsq/pypi-js
PyPI API wrapper for JavaScript
https://github.com/rdsq/pypi-js
javascript pypi typescript
Last synced: 1 day ago
JSON representation
PyPI API wrapper for JavaScript
- Host: GitHub
- URL: https://github.com/rdsq/pypi-js
- Owner: rdsq
- License: mit
- Created: 2024-08-12T12:09:15.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-09-30T11:39:12.000Z (3 months ago)
- Last Synced: 2024-11-05T19:47:45.353Z (about 2 months ago)
- Topics: javascript, pypi, typescript
- Language: TypeScript
- Homepage: https://jsr.io/@rdsq/pypi
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PyPI JS Package
This is an API wrapper for the [PyPI API](https://warehouse.pypa.io/index.html)
## Iterate
`iterate` is a method to iterate all packages in the PyPI registry
```ts
import * as pypi from '@rdsq/pypi';for (const packageName of await pypi.iterate()) {
console.log(packageName); // a lot
}
```## All
`all` method returns all packages in the PyPI registry as a list of strings. It
is often more efficient to use the `iterate` method```ts
import * as pypi from '@rdsq/pypi';const packages = await pypi.all();
console.log(packages[0]);
// should be "0"
```## Get Package
`getPackage` is a method to get data about any package in the PyPI registry
```ts
import * as pypi from '@rdsq/pypi';console.log(await pypi.getPackage('django'));
```## Stats
`stats` is a method for getting stats of the PyPI registry. Has only two fields:
`top_packages` and `total_packages_size````ts
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);
```## Types
This package also features two types:
- `PypiPackage` for the `getPackage` method
- `PypiStats` for the `stats` method