Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/uranusjr/packaging-repositories
pip package finder extraction prototype.
https://github.com/uranusjr/packaging-repositories
Last synced: about 1 month ago
JSON representation
pip package finder extraction prototype.
- Host: GitHub
- URL: https://github.com/uranusjr/packaging-repositories
- Owner: uranusjr
- License: isc
- Created: 2018-09-23T18:18:25.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-07-25T21:05:04.000Z (over 1 year ago)
- Last Synced: 2024-11-22T15:44:44.292Z (about 1 month ago)
- Language: Python
- Size: 140 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.rst
- License: LICENSE
Awesome Lists containing this project
README
# packaging-repositories: pip package finder extraction prototype.
Discussion: https://github.com/pypa/pip/issues/5800
Proposed API:
```python
from packaging_repositories import (
Fetcher, VersionFilter,
SimpleRepository, FlatHTMLRepository, LocalDirectoryRepository,
)class RequestsFetcher(Fetcher):
"""Fetch implementation using requests to perform remote requests.
"""class AIOHTTPFetcher(Fetcher):
"""Fetch implementation using AIOHTTP to perform remote requests.
"""# This does not check if the endpoint is actually available (done lazily when
# the repos is actually accessed), but LocalDirectoryRepository does check
# whether the path/URL is actually local. FlatHTMLRepository automatically
# converts file: URLs to paths, so the fetcher implementation does not need
# to worry about special-casing them.
repos = [
SimpleRepository('https://pypi.org/simple'),
FlatHTMLRepository('https://pypackages.mydomain.com/find-links.html'),
FlatHTMLRepository('/path/to/find-links.html'),
LocalDirectoryRepository('/path/to/local/directory'),
]version_filter = VersionFilter('>=10,<18')
for repo in repos:
fetcher = RequestsFetcher(repo, 'pip')
for entry in version_filter(fetcher):
print(entry)# Maybe it is a good idea to separate base classes for fetchers?
# SynchronousFetcher implements ``__next__``, and AsynchronousFetcher
# implements ``__anext__``.
fetcher = AIOHTTPFetcher(repo, 'pip')
async for entry in version_filter(fetcher):
print(entry)
```