Skip to content

Commit

Permalink
build: standardize and upgrade python version (#203)
Browse files Browse the repository at this point in the history
* build: standardize and upgrade python version

* Change python version to 3.11
  • Loading branch information
ArturLange committed Feb 23, 2024
1 parent 8b6172d commit d560908
Show file tree
Hide file tree
Showing 8 changed files with 938 additions and 1,002 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: pre-commit/[email protected]
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repos:
rev: 23.11.0
hooks:
- id: black
language_version: python3.10
language_version: python3.11

- repo: https://github.com/pycqa/flake8
rev: 6.1.0
Expand Down
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Prerequisites

- Python 3.10 (lower version may be OK, but untested)
- Python 3.11 (lower version may be OK, but untested)
- PostgreSQL 13 (lower version may be OK, but untested)

## Setup
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ If you are looking for the frontend of Open Prices, [look here](https://github.c

## Dependencies

* Python 3.10
* Python 3.11
* [FastAPI](https://fastapi.tiangolo.com/) framework
* PostgreSQL database

Expand Down
5 changes: 0 additions & 5 deletions app/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,6 @@ class LocationFull(LocationCreate):

# Proof
# ------------------------------------------------------------------------------
# class ProofCreate(BaseModel):
# file: UploadFile
# type: ProofTypeEnum


class ProofFull(BaseModel):
model_config = ConfigDict(from_attributes=True, arbitrary_types_allowed=True)

Expand Down
1,915 changes: 927 additions & 988 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ license = "AGPL-3.0 licence"
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.10"
python = "~3.11"
alembic = "~1.12.1"
Babel = "~2.13.1"
fastapi = "~0.103.1"
Expand Down
10 changes: 5 additions & 5 deletions tests/integration/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ def test_delete_price(db_session, user_session: SessionModel, clean_prices):
assert response.status_code == 403
# with authentication but price unknown
response = client.delete(
f"/api/v1/prices/{db_price.id+1}",
f"/api/v1/prices/{db_price.id + 1}",
headers={"Authorization": f"Bearer {user_session.token}"},
)
assert response.status_code == 404
Expand Down Expand Up @@ -899,13 +899,13 @@ def test_get_product(db_session, clean_products):
response = client.get(f"/api/v1/products/{last_product.id}")
assert response.status_code == 200
# by id: product does not exist
response = client.get(f"/api/v1/products/{last_product.id+1}")
response = client.get(f"/api/v1/products/{last_product.id + 1}")
assert response.status_code == 404
# by code: product exists
response = client.get(f"/api/v1/products/code/{last_product.code}")
assert response.status_code == 200
# by code: product does not exist
response = client.get(f"/api/v1/products/code/{last_product.code+'X'}")
response = client.get(f"/api/v1/products/code/{last_product.code + 'X'}")
assert response.status_code == 404


Expand Down Expand Up @@ -949,7 +949,7 @@ def test_get_location(location):
response = client.get(f"/api/v1/locations/{location.id}")
assert response.status_code == 200
# by id: location does not exist
response = client.get(f"/api/v1/locations/{location.id+1}")
response = client.get(f"/api/v1/locations/{location.id + 1}")
assert response.status_code == 404
# by osm id & type: location exists
response = client.get(
Expand All @@ -962,6 +962,6 @@ def test_get_location(location):
assert response.status_code == 200
# by osm id & type: location does not exist
response = client.get(
f"/api/v1/locations/osm/{location.osm_type.value}/{location.osm_id+1}"
f"/api/v1/locations/osm/{location.osm_type.value}/{location.osm_id + 1}"
)
assert response.status_code == 404

0 comments on commit d560908

Please sign in to comment.