Skip to content

Commit 23a913d

Browse files
Copilotnjzjzpre-commit-ci[bot]
authored
fix: fix pyrate compatibility and deprecate Python 3.8/3.9 (#89)
The import statement was changed to remove `RequestRate`, but line 35 still referenced it, causing a runtime `NameError`. Additionally, Python 3.8 and 3.9 support has been deprecated, with the minimum Python version now set to 3.10. **Changes:** - Added `Rate` to imports from `pyrate_limiter` - Updated arxiv adapter to use `Rate` instead of `RequestRate` - Removed Python 3.8 and 3.9 from package classifiers in `pyproject.toml` - Updated `requires-python` to `>=3.10` in `pyproject.toml` - Updated GitHub Actions test workflow to test with Python 3.10 and 3.13 - Updated README.md to reflect minimum Python version requirement of 3.10 ```python # Before (broken) from pyrate_limiter import Duration, Limiter adapter_arxiv = LimiterAdapter( limiter=Limiter(RequestRate(1, Duration.SECOND * 3)), ... # NameError ) # After from pyrate_limiter import Duration, Limiter, Rate adapter_arxiv = LimiterAdapter( limiter=Limiter(Rate(1, Duration.SECOND * 3)), ... ) ``` <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: Jinzhe Zeng <jinzhe.zeng@ustc.edu.cn> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: njzjz <9496702+njzjz@users.noreply.github.com>
1 parent 71ec7a6 commit 23a913d

4 files changed

Lines changed: 5 additions & 7 deletions

File tree

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
test:
1111
strategy:
1212
matrix:
13-
python: ["3.8", "3.13"]
13+
python: ["3.10", "3.13"]
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@v6

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Visit [wenxian.njzjz.win](https://wenxian.njzjz.win) to use wenxian in the brows
1818

1919
### Command line interface
2020

21-
`wenxian` requires Python 3.8. It's suggested to install [`uv`](https://github.com/astral-sh/uv) first:
21+
`wenxian` requires Python 3.10. It's suggested to install [`uv`](https://github.com/astral-sh/uv) first:
2222

2323
```sh
2424
pip install uv

pyproject.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ authors = [
1111
]
1212
license = { file = "LICENSE" }
1313
classifiers = [
14-
"Programming Language :: Python :: 3.8",
15-
"Programming Language :: Python :: 3.9",
1614
"Programming Language :: Python :: 3.10",
1715
"Programming Language :: Python :: 3.11",
1816
"Programming Language :: Python :: 3.12",
@@ -29,7 +27,7 @@ dependencies = [
2927
"requests-ratelimiter",
3028
"pyrate-limiter",
3129
]
32-
requires-python = ">=3.8"
30+
requires-python = ">=3.10"
3331
readme = "README.md"
3432
keywords = ["bib"]
3533

wenxian/feeder/session.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from pyrate_limiter import Duration, Limiter, RequestRate
5+
from pyrate_limiter import Duration, Limiter, Rate
66
from requests import Session
77
from requests.adapters import HTTPAdapter, Retry
88
from requests_ratelimiter import LimiterAdapter
@@ -32,7 +32,7 @@
3232
SESSION.mount("https://api.crossref.org/", adapter_crossref)
3333
# Arxiv: https://info.arxiv.org/help/api/tou.html
3434
adapter_arxiv = LimiterAdapter(
35-
limiter=Limiter(RequestRate(1, Duration.SECOND * 3)), burst=1, max_retries=retries
35+
limiter=Limiter(Rate(1, Duration.SECOND * 3)), burst=1, max_retries=retries
3636
)
3737
SESSION.mount("https://export.arxiv.org/api", adapter_arxiv)
3838
# https://www.semanticscholar.org/product/api

0 commit comments

Comments
 (0)