Skip to content

Commit de3890e

Browse files
authored
Modernize (#165)
1 parent 84ce691 commit de3890e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+2039
-2221
lines changed

.github/workflows/main.yml

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
name: CI
2-
32
on:
4-
# Triggers the workflow on push or pull request events but only for the master branch
53
push:
6-
branches: [ master ]
4+
branches:
5+
- master
76
pull_request:
8-
branches: [ master ]
9-
107
jobs:
11-
build:
12-
8+
tox:
139
runs-on: ubuntu-latest
1410
strategy:
11+
fail-fast: false
1512
matrix:
16-
python-version: ["3.8", "3.9", "3.10", "3.11"]
17-
scrapy-version: ["2.11", "2.10"]
18-
13+
include:
14+
- python-version: "3.13"
15+
tox: "pre-commit"
16+
- python-version: "3.9"
17+
tox: "mypy"
18+
- python-version: "3.13"
19+
tox: "pylint"
20+
- python-version: "3.9"
21+
tox: "min"
22+
- python-version: "3.10"
23+
- python-version: "3.11"
24+
- python-version: "3.12"
25+
- python-version: "3.13"
26+
- python-version: "3.13" # Keep in sync with .readthedocs.yml
27+
tox: "docs"
28+
- python-version: "3.13"
29+
tox: "twinecheck"
1930
steps:
20-
- uses: actions/checkout@v2
31+
- uses: actions/checkout@v4
2132
- name: Set up Python ${{ matrix.python-version }}
22-
uses: actions/setup-python@v2
33+
uses: actions/setup-python@v5
2334
with:
2435
python-version: ${{ matrix.python-version }}
25-
scrapy-version: ${{ matrix.scrapy-version }}
26-
- name: Install dependencies
36+
- name: Run tox
2737
run: |
28-
python -m pip install --upgrade pip
29-
pip install scrapy==${{ matrix.scrapy-version}}
30-
pip install -r requirements-dev.txt
31-
# - name: Lint with flake8
32-
# run: |
33-
# # stop the build if there are Python syntax errors or undefined names
34-
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
35-
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
36-
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
37-
- name: Test with pytest
38-
run: |
39-
pytest
38+
pip install -U tox
39+
tox -e ${{ matrix.tox || 'py' }}

.github/workflows/publish.yml

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
11
name: Publish
2-
on:
3-
release:
4-
types: [published]
5-
2+
on:
3+
push:
4+
tags:
5+
- 'v[0-9]+.[0-9]+.[0-9]+'
66
jobs:
77
publish:
88
runs-on: ubuntu-latest
9-
9+
environment:
10+
name: pypi
11+
url: https://pypi.org/p/${{ github.event.repository.name }}
12+
permissions:
13+
id-token: write
1014
steps:
11-
- uses: actions/checkout@v2
12-
13-
- name: Set up Python 3
14-
uses: actions/setup-python@v2
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-python@v5
1517
with:
16-
python-version: 3
17-
18-
- name: Build distribution
19-
run: |
20-
pip install -U setuptools wheel
21-
python setup.py sdist bdist_wheel
22-
18+
python-version: 3.13
19+
- run: |
20+
python -m pip install --upgrade build
21+
python -m build
2322
- name: Publish to PyPI
2423
uses: pypa/gh-action-pypi-publish@release/v1
2524
with:
26-
password: ${{ secrets.PYPI_TOKEN }}
25+
password: ${{ secrets.PYPI_TOKEN }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
/build/
44
/dist/
55
/*.egg-info/
6+
/venv/
7+
/.venv/
68

79
# twisted
810
dropin.cache
@@ -22,6 +24,7 @@ _trial_temp
2224
/test_urls*
2325
testing_scripts*
2426
coverage.xml
27+
/.coverage.*
2528
.python-version
2629

2730
# IDE

.pre-commit-config.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.12.5
4+
hooks:
5+
- id: ruff-check
6+
args: [ --fix ]
7+
- id: ruff-format
8+
- repo: https://github.com/adamchainz/blacken-docs
9+
rev: 1.19.1
10+
hooks:
11+
- id: blacken-docs
12+
additional_dependencies:
13+
- black==25.1.0
14+
- repo: https://github.com/pre-commit/pre-commit-hooks
15+
rev: v5.0.0
16+
hooks:
17+
- id: end-of-file-fixer
18+
- id: trailing-whitespace
19+
- repo: https://github.com/sphinx-contrib/sphinx-lint
20+
rev: v1.0.0
21+
hooks:
22+
- id: sphinx-lint

.readthedocs.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: 2
2+
formats: all
3+
sphinx:
4+
configuration: docs/conf.py
5+
fail_on_warning: true
6+
build:
7+
os: ubuntu-24.04
8+
tools:
9+
# For available versions, see:
10+
# https://docs.readthedocs.io/en/stable/config-file/v2.html#build-tools-python
11+
python: "3.13" # Keep in sync with .github/workflows/main.yml
12+
python:
13+
install:
14+
- requirements: docs/requirements.txt
15+
- path: .

CHANGES.rst

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Changes
2+
=======
3+
4+
ScrapyRT 0.17.0 (unreleased)
5+
----------------------------
6+
7+
- Added support for Scrapy 2.13+.
8+
9+
- Lowered the minimum required Scrapy version from 2.10 to 2.7.
10+
11+
- The ``start_requests`` API parameter is deprecated in favor of a new
12+
``spider_start`` API parameter.
13+
14+
Same with the corresponding ``__init__`` parameter and attribute of the
15+
``CrawlManager`` class.
16+
17+
18+
ScrapyRT 0.16 (2023-02-14)
19+
--------------------------
20+
21+
- errback method for spider made configurable, errback for spiders will default
22+
to None instead of parse
23+
24+
25+
ScrapyRT 0.12 (2021-03-08)
26+
--------------------------
27+
28+
- added crawl arguments for API
29+
- removed Python 2 support
30+
- added Python 3.9 support
31+
- docs clean up
32+
- removed superfluous requirements (demjson, six)
33+
- fixed API crash when spider returns bytes in items output
34+
- updated unit tests
35+
- development improvements, moved from Travis to Github Workflows

LICENSE

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ All rights reserved.
55
Redistribution and use in source and binary forms, with or without modification,
66
are permitted provided that the following conditions are met:
77

8-
1. Redistributions of source code must retain the above copyright notice,
8+
1. Redistributions of source code must retain the above copyright notice,
99
this list of conditions and the following disclaimer.
10-
11-
2. Redistributions in binary form must reproduce the above copyright
10+
11+
2. Redistributions in binary form must reproduce the above copyright
1212
notice, this list of conditions and the following disclaimer in the
1313
documentation and/or other materials provided with the distribution.
1414

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ ScrapyRT (Scrapy realtime)
2828
Add HTTP API for your `Scrapy <https://scrapy.org/>`_ project in minutes.
2929

3030
You send a request to ScrapyRT with spider name and URL, and in response, you get items collected by a spider
31-
visiting this URL.
31+
visiting this URL.
3232

3333
* All Scrapy project components (e.g. middleware, pipelines, extensions) are supported
3434
* You run Scrapyrt in Scrapy project directory. It starts HTTP server allowing you to schedule spiders and get spider output in JSON.

0 commit comments

Comments
 (0)