Skip to content

Drop versions earlier than Python 3.7 and update requirements #159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[bumpversion]
current_version = 2.3.1
current_version = 3.0.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to keep version bumping out of pull requests. The version2bump command already handles this change, and also tags the release, so to use version2bump the person handling the next release would actually need to undo this change locally before running the command, otherwise versin2bump major would set the version to 4.0.0 instead of 3.0.0.

commit = True
tag = True
tag_name = {new_version}

[bumpversion:file:scrapinghub/VERSION]

11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ release-major:
upload: clean
python setup.py sdist bdist_wheel upload

requirements: requirements-test.txt requirements-docs.txt

requirements-test.txt: requirements-test.in requirements.txt
pip-compile --quiet requirements-test.in

requirements.txt: setup.py
pip-compile --quiet setup.py

requirements-docs.txt: requirements.txt
pip-compile --quiet requirements-docs.in

test:
py.test tests/legacy

Expand Down
10 changes: 9 additions & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
[pytest]
addopts = --doctest-glob='scrapinghub/*.py'
addopts =
--doctest-glob='scrapinghub/*.py'
--ignore=tests/client/test_items.py
--ignore=tests/client/test_job.py
--ignore=tests/client/test_logs.py
--ignore=tests/client/test_requests.py
--ignore=tests/client/test_samples.py
--ignore=tests/client/test_spiders.py
--ignore=tests/hubstorage/test_retry.py
3 changes: 0 additions & 3 deletions requirements-base.txt

This file was deleted.

3 changes: 3 additions & 0 deletions requirements-docs.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-r requirements.txt
sphinx>=1.5.3
sphinx_rtd_theme>=0.2.4
58 changes: 56 additions & 2 deletions requirements-docs.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,57 @@
-r requirements.txt
#
# This file is autogenerated by pip-compile with python 3.10
# To update, run:
#
# pip-compile requirements-docs.in
#
alabaster==0.7.12
# via sphinx
babel==2.9.1
# via sphinx
certifi==2021.5.30
# via
# -r requirements.txt
# requests
charset-normalizer==2.0.4
# via
# -r requirements.txt
# requests
docutils==0.17.1
# via sphinx
idna==3.2
# via
# -r requirements.txt
# requests
imagesize==1.2.0
# via sphinx
jinja2==3.0.2
# via sphinx
markupsafe==2.0.1
# via jinja2
msgpack==1.0.2
# via -r requirements.txt
pygments==2.10.0
# via sphinx
pytz==2021.3
# via babel
requests==2.26.0
# via
# -r requirements.txt
# sphinx
retrying==1.3.3
# via -r requirements.txt
six==1.16.0
# via
# -r requirements.txt
# retrying
# sphinx
snowballstemmer==2.1.0
# via sphinx
sphinx==1.5.3
sphinx_rtd_theme==0.2.4
# via -r requirements-docs.in
sphinx-rtd-theme==0.2.4
# via -r requirements-docs.in
urllib3==1.26.6
# via
# -r requirements.txt
# requests
3 changes: 0 additions & 3 deletions requirements-pypy.txt

This file was deleted.

7 changes: 7 additions & 0 deletions requirements-test.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-r requirements.txt
mock>=4.0.3
vcrpy>=4.1.1
pytest==6.2.5
pytest-cov>=3.0.0
responses>=0.14.0
tox>=3.24.4
108 changes: 100 additions & 8 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,100 @@
mock
vcrpy==1.10.3
# FIXME remove the constraint after resolving
# https://github.com/pytest-dev/pytest/issues/2966
pytest<3.3.0
pytest-cov<2.6.0
pytest-catchlog
responses==0.10.6
#
# This file is autogenerated by pip-compile with python 3.10
# To update, run:
#
# pip-compile requirements-test.in
#
attrs==21.2.0
# via pytest
backports.entry-points-selectable==1.1.0
# via virtualenv
certifi==2021.5.30
# via
# -r requirements.txt
# requests
charset-normalizer==2.0.4
# via
# -r requirements.txt
# requests
coverage[toml]==6.0.2
# via pytest-cov
distlib==0.3.3
# via virtualenv
filelock==3.3.1
# via
# tox
# virtualenv
idna==3.2
# via
# -r requirements.txt
# requests
# yarl
iniconfig==1.1.1
# via pytest
mock==4.0.3
# via -r requirements-test.in
msgpack==1.0.2
# via -r requirements.txt
multidict==5.2.0
# via yarl
packaging==21.0
# via
# pytest
# tox
platformdirs==2.4.0
# via virtualenv
pluggy==1.0.0
# via
# pytest
# tox
py==1.10.0
# via
# pytest
# tox
pyparsing==2.4.7
# via packaging
pytest==6.2.5
# via
# -r requirements-test.in
# pytest-cov
pytest-cov==3.0.0
# via -r requirements-test.in
pyyaml==6.0
# via vcrpy
requests==2.26.0
# via
# -r requirements.txt
# responses
responses==0.14.0
# via -r requirements-test.in
retrying==1.3.3
# via -r requirements.txt
six==1.16.0
# via
# -r requirements.txt
# responses
# retrying
# tox
# vcrpy
# virtualenv
toml==0.10.2
# via
# pytest
# tox
tomli==1.2.1
# via coverage
tox==3.24.4
# via -r requirements-test.in
urllib3==1.26.6
# via
# -r requirements.txt
# requests
# responses
vcrpy==4.1.1
# via -r requirements-test.in
virtualenv==20.9.0
# via tox
wrapt==1.13.2
# via vcrpy
yarl==1.7.0
# via vcrpy
26 changes: 24 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,24 @@
-r requirements-base.txt
msgpack>=1.0.0
#
# This file is autogenerated by pip-compile with python 3.10
# To update, run:
#
# pip-compile setup.py
#
certifi==2021.5.30
# via requests
charset-normalizer==2.0.4
# via requests
idna==3.2
# via requests
msgpack==1.0.2
# via scrapinghub (setup.py)
requests==2.26.0
# via scrapinghub (setup.py)
retrying==1.3.3
# via scrapinghub (setup.py)
six==1.16.0
# via
# retrying
# scrapinghub (setup.py)
urllib3==1.26.6
# via requests
2 changes: 1 addition & 1 deletion scrapinghub/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.1
3.0.0
7 changes: 4 additions & 3 deletions scrapinghub/client/collections.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import absolute_import
import collections
import collections.abc

from six import string_types
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove this as part of this pull request, or will we handle the post-Python-2 cleanup separately?


Expand Down Expand Up @@ -130,9 +131,9 @@ class Collection(object):
>>> for elem in foo_store.iter(count=1)):
... print(elem)
[{'_key': '002d050ee3ff6192dcbecc4e4b4457d7', 'value': '1447221694537'}]

- get generator over item keys::

>>> keys = foo_store.iter(nodata=True, meta=["_key"]))
>>> next(keys)
{'_key': '002d050ee3ff6192dcbecc4e4b4457d7'}
Expand Down Expand Up @@ -185,7 +186,7 @@ def delete(self, keys):
The method returns ``None`` (original method returns an empty generator).
"""
if (not isinstance(keys, string_types) and
not isinstance(keys, collections.Iterable)):
not isinstance(keys, collections.abc.Iterable)):
raise ValueError("You should provide string key or iterable "
"object providing string keys")
self._origin.delete(keys)
Expand Down
2 changes: 1 addition & 1 deletion scrapinghub/hubstorage/resourcetype.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import json
import socket
import logging
from collections import MutableMapping
from collections.abc import MutableMapping

import six
from six.moves import range
Expand Down
21 changes: 10 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
with open(join(dirname(__file__), 'scrapinghub/VERSION'), 'rb') as f:
version = f.read().decode('ascii').strip()

# keeping this as it might be useful at some point
is_pypy = '__pypy__' in sys.builtin_module_names
mpack_required = ['msgpack>=1.0.0']
if is_pypy:
mpack_required.append('msgpack-pypy>=0.0.2')

setup(
name='scrapinghub',
Expand All @@ -26,20 +24,21 @@
platforms=['Any'],
packages=['scrapinghub', 'scrapinghub.client', 'scrapinghub.hubstorage'],
package_data={'scrapinghub': ['VERSION']},
install_requires=['requests>=1.0', 'retrying>=1.3.3', 'six>=1.10.0'],
extras_require={'msgpack': mpack_required},
install_requires= [
'msgpack>=1.0.0',
'requests>=1.0',
'retrying>=1.3.3',
'six>=1.10.0'
],
classifiers=[
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Internet :: WWW/HTTP',
Expand Down
2 changes: 1 addition & 1 deletion tests/client/test_frontiers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import time
from types import GeneratorType
from collections import Iterable
from collections.abc import Iterable

from six import string_types

Expand Down
3 changes: 1 addition & 2 deletions tests/client/test_job.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from collections import Iterator
from collections.abc import Iterator

import pytest

Expand All @@ -8,7 +8,6 @@
from scrapinghub.client.logs import Logs
from scrapinghub.client.requests import Requests
from scrapinghub.client.samples import Samples
from scrapinghub.client.exceptions import BadRequest

from ..conftest import TEST_PROJECT_ID
from ..conftest import TEST_SPIDER_NAME
Expand Down
3 changes: 2 additions & 1 deletion tests/client/test_projects.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import types
from collections import defaultdict, Iterator
from collections import defaultdict
from collections.abc import Iterator

import pytest
import responses
Expand Down
2 changes: 0 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import re
import zlib

from scrapinghub.hubstorage.serialization import MSGPACK_AVAILABLE
from scrapinghub import HubstorageClient
from scrapinghub.legacy import Connection

Expand All @@ -22,7 +21,6 @@
TEST_SPIDER_NAME = 'hs-test-spider'
TEST_FRONTIER_SLOT = 'site.com'
TEST_BOTGROUP = 'python-hubstorage-test'
TEST_COLLECTION_NAME = "test_collection_123"
TEST_AUTH = os.getenv('HS_AUTH', DEFAULT_ADMIN_AUTH)
TEST_ENDPOINT = os.getenv('HS_ENDPOINT', DEFAULT_ENDPOINT)
TEST_COLLECTION_NAME = "test_collection_123"
Expand Down
2 changes: 2 additions & 0 deletions tests/hubstorage/test_jobq.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ def test_summary_countstart(hsproject):
[o['key'] for o in s2['summary'][-6:-3]])


@pytest.mark.skip(reason='Servers not running')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate? What do we need to do to get these tests working?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To run those tests we need a devbox.

Kumo has one or more of those, so they can help with the testing (access to an internal dev machine?) when the time is right.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that having tests that require a live box means that we couldn't run the tests in Github actions.

def test_summaries_and_state_changes(hsproject, hsspiderid):
jobq = hsproject.jobq
j1 = jobq.push(TEST_SPIDER_NAME)
Expand Down Expand Up @@ -269,6 +270,7 @@ def test_list_with_startts_endts(hsproject):
assert _keys(jobs) == _keys([j3, j2])


@pytest.mark.skip(reason='Servers not running')
def test_spider_updates(hsproject, hsspiderid):
jobq = hsproject.jobq
spiderkey = '%s/%s' % (TEST_PROJECT_ID, hsspiderid)
Expand Down
Loading