Skip to content

Commit

Permalink
Update Python version and dependencies across the project
Browse files Browse the repository at this point in the history
  • Loading branch information
gabino committed Jan 2, 2025
1 parent d2c6fb4 commit e2cdfa8
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 41 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python 3.8
- name: Set up Python 3.13
uses: actions/[email protected]
with:
python-version: 3.8
python-version: 3.13
- name: Install dependencies
run: pip install -qU setuptools wheel twine
- name: Generating distribution archives
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- name: Set up Python
uses: actions/[email protected]
with:
python-version: 3.8
python-version: 3.13
- name: Install dependencies
run: make install-test
- name: Lint
Expand All @@ -20,7 +20,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -39,7 +39,7 @@ jobs:
- name: Setup Python
uses: actions/[email protected]
with:
python-version: 3.8
python-version: 3.13
- name: Install dependencies
run: make install-test
- name: Generate coverage report
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
SHELL := bash
PATH := ./venv/bin:${PATH}
PYTHON = python3.8
PYTHON = python3.13
PROJECT = fast_agave
isort = isort $(PROJECT) tests setup.py
black = black -S -l 79 --target-version py38 $(PROJECT) tests setup.py examples
black = black -S -l 79 --target-version py313 $(PROJECT) tests setup.py examples


.PHONY: all
Expand Down
2 changes: 1 addition & 1 deletion examples/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
app.include_router(resources)

app.add_middleware(AuthedMiddleware)
app.add_middleware(FastAgaveErrorHandler)
app.add_middleware(FastAgaveErrorHandler) # type: ignore


@app.get('/')
Expand Down
3 changes: 1 addition & 2 deletions examples/tasks/retry_task_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
QUEUE_URL = 'http://127.0.0.1:4000/123456789012/core.fifo'


class YouCanTryAgain(Exception):
...
class YouCanTryAgain(Exception): ...


def test_your_luck(message):
Expand Down
8 changes: 4 additions & 4 deletions fast_agave/blueprints/rest_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ async def retrieve(id: str, request: Request):
file,
media_type=mimetype,
headers={
'Content-Disposition': f'attachment; filename={filename}'
'Content-Disposition': f'attachment; filename={filename}' # noqa: E702
},
)
elif hasattr(cls, 'retrieve'):
Expand All @@ -254,9 +254,9 @@ async def retrieve(id: str, request: Request):
return cls

query_description = (
f'Make queries in resource {cls.__name__} and filter the result using query parameters. \n'
f'The items are paginated, to iterate over them use the `next_page_uri` included in response. \n'
f'If you need only a counter not the data send value `true` in `count` param.'
f"Make queries in resource {cls.__name__} and filter the result using query parameters. \n"
f"The items are paginated, to iterate over them use the 'next_page_uri' included in response. \n"
f"If you need only a counter not the data send value 'true' in 'count' param."
)

# Build dynamically types for query response
Expand Down
16 changes: 7 additions & 9 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
black==22.3.0
flake8==4.0.*
isort==5.10.*
black==24.10.0
flake8==5.0.4
isort==5.11.5
mock==4.0.3
mongomock==4.1.*
moto[server]==2.2.*
mypy==1.13.0
pytest==7.4.*
pytest-cov==4.1.*
moto[server]==5.0.25
mypy==1.4.1
pytest==7.4.4
pytest-cov==4.1.0
pytest-vcr==1.0.*
pytest-asyncio==0.15.*
requests==2.28.*
boto3==1.20.24
botocore==1.23.24
httpx==0.28.1
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
aiobotocore==2.1.0
cuenca-validations===2.0.0.dev7
aiobotocore==2.16.1
cuenca-validations==2.0.0.dev9
fastapi==0.115.6
mongoengine-plus==0.0.3
mongoengine-plus==0.2.3.dev1
python-multipart==0.0.5
starlette-context==0.3.3
types-aiobotocore-sqs==2.1.0.post1
types-aiobotocore-sqs==2.5.0
20 changes: 12 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,21 @@
packages=find_packages(),
include_package_data=True,
package_data=dict(agave=['py.typed']),
python_requires='>=3.8',
python_requires='>=3.9',
install_requires=[
'aiobotocore>=1.0.0,<3.0.0',
'types-aiobotocore-sqs>=2.1.0.post1,<3.0.0',
'cuenca-validations>=0.9.4,<1.0.0',
'fastapi>=0.63.0,<0.69.0',
'mongoengine-plus>=0.0.2,<1.0.0',
'starlette-context>=0.3.2,<0.4.0',
'aiobotocore==2.16.1',
'types-aiobotocore-sqs==2.5.0',
'cuenca-validations==2.0.0.dev9',
'fastapi==0.115.6',
'mongoengine-plus==0.2.3.dev1',
'starlette-context==0.3.3',
],
classifiers=[
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
],
Expand Down
3 changes: 1 addition & 2 deletions tests/blueprint/test_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ def retrieve(self) -> str:


def test_copy_properties_from() -> None:
def retrieve():
...
def retrieve(): ... # noqa: E704

assert not hasattr(retrieve, 'i_am_test')
retrieve = copy_attributes(TestResource)(retrieve)
Expand Down
15 changes: 11 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import datetime as dt
import functools
import os
import subprocess
from functools import partial
from typing import Callable, Dict, Generator, List

Expand Down Expand Up @@ -185,13 +184,17 @@ def aws_credentials() -> None:
def aws_endpoint_urls(
aws_credentials,
) -> Generator[Dict[str, str], None, None]:
sqs = subprocess.Popen(['moto_server', 'sqs', '-p', '4000'])
from moto.server import ThreadedMotoServer

server = ThreadedMotoServer(port=4000)
server.start()

endpoints = dict(
sqs='http://127.0.0.1:4000/',
)
yield endpoints
sqs.kill()

server.stop()


@pytest.fixture(autouse=True)
Expand Down Expand Up @@ -222,7 +225,11 @@ async def sqs_client():
session = aiobotocore.session.get_session()
async with session.create_client('sqs', 'us-east-1') as sqs:
await sqs.create_queue(
QueueName='core.fifo', Attributes={'FifoQueue': 'true'}
QueueName='core.fifo',
Attributes={
'FifoQueue': 'true',
'ContentBasedDeduplication': 'true',
},
)
resp = await sqs.get_queue_url(QueueName='core.fifo')
sqs.send_message = partial(sqs.send_message, QueueUrl=resp['QueueUrl'])
Expand Down

0 comments on commit e2cdfa8

Please sign in to comment.