Skip to content

Commit

Permalink
Merge pull request #177 from scrapinghub/py3.12
Browse files Browse the repository at this point in the history
Add Python 3.12 support.
  • Loading branch information
wRAR authored Dec 11, 2023
2 parents 080019a + 96d2507 commit ea195a7
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 27 deletions.
42 changes: 28 additions & 14 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,34 @@ ignore =
C408,

# To be addressed:
D100, # Missing docstring in public module
D101, # Missing docstring in public class
D102, # Missing docstring in public method
D103, # Missing docstring in public function
D104, # Missing docstring in public package
D105, # Missing docstring in magic method
D107, # Missing docstring in __init__
D200, # One-line docstring should fit on one line with quotes
D202, # No blank lines allowed after function docstring
D205, # 1 blank line required between summary line and description
D209, # Multi-line docstring closing quotes should be on a separate line
D400, # First line should end with a period
D401, # First line should be in imperative mood
D402 # First line should not be the function's "signature"
# Missing docstring in public module
D100,
# Missing docstring in public class
D101,
# Missing docstring in public method
D102,
# Missing docstring in public function
D103,
# Missing docstring in public package
D104,
# Missing docstring in magic method
D105,
# Missing docstring in __init__
D107,
# One-line docstring should fit on one line with quotes
D200,
# No blank lines allowed after function docstring
D202,
# 1 blank line required between summary line and description
D205,
# Multi-line docstring closing quotes should be on a separate line
D209,
# First line should end with a period
D400,
# First line should be in imperative mood
D401,
# First line should not be the function's "signature"
D402

per-file-ignores =
# F401: Ignore "imported but unused" errors in __init__ files, as those
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.x'
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@ jobs:
- python-version: "3.9"
- python-version: "3.10"
- python-version: "3.11"
- python-version: "3.11"
- python-version: "3.12"
- python-version: "3.12"
toxenv: "asyncio"

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -53,7 +54,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.11']
python-version: ['3.12']
tox-job: ["mypy", "docs", "linters", "twinecheck"]

steps:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ repos:
- flake8-docstrings
- flake8-string-format
repo: https://github.com/pycqa/flake8
rev: 4.0.1
rev: 6.1.0
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sphinx:
build:
os: ubuntu-22.04
tools:
python: "3.11" # Keep in sync with .github/workflows/tests.yml
python: "3.12" # Keep in sync with .github/workflows/tests.yml

python:
install:
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
],
)
2 changes: 1 addition & 1 deletion tests/test_injection.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ def test_load_provider_classes():
injector = get_injector_for_testing(
{provider_as_string: 2, HttpResponseProvider: 1}
)
assert all(type(prov) == HttpResponseProvider for prov in injector.providers)
assert all(type(prov) is HttpResponseProvider for prov in injector.providers)
assert len(injector.providers) == 2


Expand Down
4 changes: 2 additions & 2 deletions tests/test_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ def parse(
@inlineCallbacks
def test_multi_args_callbacks(settings):
item, _, _ = yield crawl_single_item(MultiArgsCallbackSpider, ProductHtml, settings)
assert type(item["product"]) == ProductPage
assert type(item["provided"]) == ProvidedWithDeferred
assert type(item["product"]) is ProductPage
assert type(item["provided"]) is ProvidedWithDeferred
assert item["cb_arg"] == "arg!"
assert item["cb_arg2"] is False
assert item["non_cb_arg"] is None
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = min,py38,py39,py310,py311,asyncio,asyncio-min,mypy,docs
envlist = min,py38,py39,py310,py311,py312,asyncio,asyncio-min,mypy,docs

[testenv]
deps =
Expand Down

0 comments on commit ea195a7

Please sign in to comment.