lukasschwab / arxiv.py

Python wrapper for the arXiv API
MIT License
1.07k stars 120 forks source link

Provide type hint information for users #126

Closed eggplants closed 10 months ago

eggplants commented 11 months ago

Description

I have introduced mypy and fixed some errors. And then I have added py.typed file to package_data to mark this package is typed. (See PEP561)

Breaking changes

List any changes that break the API usage supported on master.

The annotation of Search.max_results changes from float into int. If the instance variable is float like 10.0, the Arxiv API raises max_results must be an integer. https://export.arxiv.org/api/query?search_query=all:electron&max_results=10.0

import arxiv

client = arxiv.Client(page_size=10, delay_seconds=0)
search = arxiv.Search(query="testing", max_results=2.0)
client.results(search)
# arxiv.arxiv.HTTPError: Page request resulted in HTTP 400: max_results must be an integer (http://export.arxiv.org/api/query?search_query=testing&id_list=&sortBy=relevance&sortOrder=descending&start=0&max_results=2.0)

Relevant issues

Not found.

Checklist

...

lukasschwab commented 11 months ago

@eggplants thanks for submitting this. I'm running a bit behind on reviews — this interacts with #124, which is also in my review queue. Thanks for your patience 🙇