diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 02b87e1..10fd19e 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @ferhatelmas +* @JimmyPettersson85 @xernobyl @yaziine diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c83a6af..d057329 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: strategy: max-parallel: 1 matrix: - python: ['3.7', '3.8', '3.9', '3.10'] + python: ['3.7', '3.8', '3.9', '3.10', '3.11'] steps: - uses: actions/checkout@v3 with: diff --git a/.gitignore b/.gitignore index 4c239ea..615fdd5 100644 --- a/.gitignore +++ b/.gitignore @@ -61,4 +61,9 @@ secrets.*sh .python-version .venv +.venv3.7 +.venv3.8 +.venv3.9 +.venv3.10 +.venv3.11 .envrc diff --git a/dotgit/hooks/pre-commit-format.sh b/dotgit/hooks/pre-commit-format.sh index a1758b8..bf0d444 100755 --- a/dotgit/hooks/pre-commit-format.sh +++ b/dotgit/hooks/pre-commit-format.sh @@ -10,7 +10,7 @@ if ! black stream --check -q; then exit 1 fi -if ! flake8 --ignore=E501,E225,W293,W503 stream; then +if ! flake8 --ignore=E501,E225,W293,W503,F401 stream; then echo echo "commit is aborted because there are some error prone issues in your changes as printed above" echo "your changes are still staged, you can accept formatting changes with git add or ignore them by adding --no-verify to git commit" diff --git a/setup.py b/setup.py index b404722..487ba99 100644 --- a/setup.py +++ b/setup.py @@ -5,10 +5,10 @@ from stream import __version__, __maintainer__, __email__, __license__ install_requires = [ - "requests>=2.3.0,<3", - "pyjwt>=2.0.0,<3", - "pytz>=2019.3", - "aiohttp>=3.6.0", + "requests>=2.28.0,<3", + "pyjwt>=2.6.0,<3", + "pytz>=2022.7.1", + "aiohttp>=3.8.4", ] tests_require = ["pytest", "pytest-cov", "python-dateutil", "pytest-asyncio"] ci_require = ["black", "flake8", "pytest-cov"] @@ -52,6 +52,7 @@ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Topic :: Software Development :: Libraries :: Python Modules", ], ) diff --git a/stream/client/client.py b/stream/client/client.py index eef7ee6..0345360 100644 --- a/stream/client/client.py +++ b/stream/client/client.py @@ -169,7 +169,6 @@ def activity_partial_update( return self.activities_partial_update(updates=[data]) def activities_partial_update(self, updates=None): - auth_token = self.create_jwt_token("activities", "*", feed_id="*") data = {"changes": updates or []} @@ -195,7 +194,6 @@ def create_redirect_url(self, target_url, user_id, events): return prepared_request.url def track_engagements(self, engagements): - auth_token = self.create_jwt_token("*", "*", feed_id="*") self.post( "engagement/", @@ -205,7 +203,6 @@ def track_engagements(self, engagements): ) def track_impressions(self, impressions): - auth_token = self.create_jwt_token("*", "*", feed_id="*") self.post("impression/", auth_token, data=impressions, service_name="analytics") diff --git a/stream/collections/base.py b/stream/collections/base.py index 44e091b..10c0805 100644 --- a/stream/collections/base.py +++ b/stream/collections/base.py @@ -72,7 +72,6 @@ def delete(self, collection_name, id): class BaseCollection(AbstractCollection, ABC): - URL = "collections/" SERVICE_NAME = "api" diff --git a/stream/personalization/base.py b/stream/personalization/base.py index 730d78f..04f823f 100644 --- a/stream/personalization/base.py +++ b/stream/personalization/base.py @@ -16,7 +16,6 @@ def delete(self, resource, **params): class BasePersonalization(AbstractPersonalization, ABC): - SERVICE_NAME = "personalization" def __init__(self, client, token): diff --git a/stream/reactions/base.py b/stream/reactions/base.py index b83794e..31078d0 100644 --- a/stream/reactions/base.py +++ b/stream/reactions/base.py @@ -44,7 +44,6 @@ def filter(self, **params): class BaseReactions(AbstractReactions, ABC): - API_ENDPOINT = "reaction/" SERVICE_NAME = "api" diff --git a/stream/tests/conftest.py b/stream/tests/conftest.py index ac5df29..c700997 100644 --- a/stream/tests/conftest.py +++ b/stream/tests/conftest.py @@ -1,9 +1,9 @@ import asyncio import os import sys +import pytest_asyncio from uuid import uuid4 -import pytest from stream import connect @@ -17,7 +17,7 @@ async def _parse_response(*args, **kwargs): return _parse_response -@pytest.fixture(scope="module") +@pytest_asyncio.fixture(scope="module") def event_loop(): """Create an instance of the default event loop for each test case.""" loop = asyncio.get_event_loop_policy().new_event_loop() @@ -25,7 +25,7 @@ def event_loop(): loop.close() -@pytest.fixture +@pytest_asyncio.fixture async def async_client(): key = os.getenv("STREAM_KEY") secret = os.getenv("STREAM_SECRET") @@ -44,31 +44,31 @@ async def async_client(): yield client -@pytest.fixture +@pytest_asyncio.fixture def user1(async_client): return async_client.feed("user", f"1-{uuid4()}") -@pytest.fixture +@pytest_asyncio.fixture def user2(async_client): return async_client.feed("user", f"2-{uuid4()}") -@pytest.fixture +@pytest_asyncio.fixture def aggregated2(async_client): return async_client.feed("aggregated", f"2-{uuid4()}") -@pytest.fixture +@pytest_asyncio.fixture def aggregated3(async_client): return async_client.feed("aggregated", f"3-{uuid4()}") -@pytest.fixture +@pytest_asyncio.fixture def topic(async_client): return async_client.feed("topic", f"1-{uuid4()}") -@pytest.fixture +@pytest_asyncio.fixture def flat3(async_client): return async_client.feed("flat", f"3-{uuid4()}") diff --git a/stream/tests/test_client.py b/stream/tests/test_client.py index 33dfe17..aced337 100644 --- a/stream/tests/test_client.py +++ b/stream/tests/test_client.py @@ -1294,7 +1294,6 @@ def test_activity_partial_update(self): self.assertEqual(updated, expected) def test_activities_partial_update(self): - feed = self.c.feed("user", uuid4()) feed.add_activities( [ diff --git a/stream/users/base.py b/stream/users/base.py index b17dead..21d3d8d 100644 --- a/stream/users/base.py +++ b/stream/users/base.py @@ -24,7 +24,6 @@ def delete(self, user_id): class BaseUsers(AbstractUsers, ABC): - API_ENDPOINT = "user/" SERVICE_NAME = "api"