From a67155d7c2da28fa2de1bf3c417f766633ac54c0 Mon Sep 17 00:00:00 2001 From: Kamil Monicz Date: Tue, 9 Jan 2024 02:00:26 +0100 Subject: [PATCH 1/4] Copy just python files from cython_lib --- default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/default.nix b/default.nix index 006c8f9..310b008 100644 --- a/default.nix +++ b/default.nix @@ -30,10 +30,11 @@ with pkgs; dockerTools.buildLayeredImage { cp "${./.}"/LICENSE . cp "${./.}"/*.py . cp -r "${./.}"/api . - cp -r "${./.}"/cython_lib . cp -r "${./.}"/middlewares . cp -r "${./.}"/models . cp -r "${./.}"/states . + mkdir cython_lib + cp "${./.}"/cython_lib/*.py cython_lib export PATH="${lib.makeBinPath shell.buildInputs}":$PATH ${shell.shellHook} ''; From b39296407fe5eb75e2a33c7975a5bef402bd62ac Mon Sep 17 00:00:00 2001 From: Kamil Monicz Date: Tue, 9 Jan 2024 02:00:26 +0100 Subject: [PATCH 2/4] Copy just python files from cython_lib --- default.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/default.nix b/default.nix index 006c8f9..327db39 100644 --- a/default.nix +++ b/default.nix @@ -30,11 +30,12 @@ with pkgs; dockerTools.buildLayeredImage { cp "${./.}"/LICENSE . cp "${./.}"/*.py . cp -r "${./.}"/api . - cp -r "${./.}"/cython_lib . cp -r "${./.}"/middlewares . cp -r "${./.}"/models . cp -r "${./.}"/states . - export PATH="${lib.makeBinPath shell.buildInputs}":$PATH + mkdir cython_lib + cp "${./.}"/cython_lib/*.py cython_lib + export PATH="${lib.makeBinPath shell.buildInputs}:$PATH" ${shell.shellHook} ''; From 9d50d8dfb1d4ca8d01b46a857ae005965d9f0fc9 Mon Sep 17 00:00:00 2001 From: Kamil Monicz Date: Tue, 9 Jan 2024 02:03:13 +0100 Subject: [PATCH 3/4] Revert, Minor path correction --- default.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/default.nix b/default.nix index 327db39..82aeb62 100644 --- a/default.nix +++ b/default.nix @@ -30,11 +30,10 @@ with pkgs; dockerTools.buildLayeredImage { cp "${./.}"/LICENSE . cp "${./.}"/*.py . cp -r "${./.}"/api . + cp -r "${./.}"/cython_lib . cp -r "${./.}"/middlewares . cp -r "${./.}"/models . cp -r "${./.}"/states . - mkdir cython_lib - cp "${./.}"/cython_lib/*.py cython_lib export PATH="${lib.makeBinPath shell.buildInputs}:$PATH" ${shell.shellHook} ''; From aa74d9a75a78e7081fd410959c40d58802c20871 Mon Sep 17 00:00:00 2001 From: Kamil Monicz Date: Wed, 10 Jan 2024 03:56:18 +0100 Subject: [PATCH 4/4] Update GeoJSON url, Add dependency on brotlicffi --- .gitignore | 10 ++++++---- config.py | 5 +---- osm_countries.py | 2 +- poetry.lock | 2 +- pyproject.toml | 1 + 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 58089a3..30799f5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,8 @@ -# Created by https://www.toptal.com/developers/gitignore/api/dotenv,python,visualstudiocode -# Edit at https://www.toptal.com/developers/gitignore?templates=dotenv,python,visualstudiocode +# Created by https://www.toptal.com/developers/gitignore/api/dotenv,python,visualstudiocode,direnv +# Edit at https://www.toptal.com/developers/gitignore?templates=dotenv,python,visualstudiocode,direnv + +### direnv ### +.direnv ### dotenv ### .env @@ -194,9 +197,8 @@ pyrightconfig.json .history .ionide -# End of https://www.toptal.com/developers/gitignore/api/dotenv,python,visualstudiocode +# End of https://www.toptal.com/developers/gitignore/api/dotenv,python,visualstudiocode,direnv -result data/* cert/* diff --git a/config.py b/config.py index 9823d83..2cdb17a 100644 --- a/config.py +++ b/config.py @@ -18,10 +18,7 @@ OVERPASS_API_URL = 'https://overpass-api.de/api/interpreter' OPENSTREETMAP_API_URL = os.getenv('OPENSTREETMAP_API_URL', 'https://api.openstreetmap.org/api/0.6/') REPLICATION_URL = 'https://planet.openstreetmap.org/replication/minute/' -COUNTRIES_GEOJSON_URL = ( - 'https://raw.githubusercontent.com/Zaczero/osm-countries-geojson/main/geojson/osm-countries-0-01.geojson.br' -) - +COUNTRIES_GEOJSON_URL = 'https://osm-countries-geojson.monicz.dev/osm-countries-0-01.geojson.br' DEFAULT_CACHE_MAX_AGE = timedelta(minutes=1) DEFAULT_CACHE_STALE = timedelta(minutes=5) diff --git a/osm_countries.py b/osm_countries.py index dd0800b..f511e08 100644 --- a/osm_countries.py +++ b/osm_countries.py @@ -1,6 +1,6 @@ from collections.abc import Sequence -import brotli +import brotlicffi as brotli import orjson from shapely.geometry import shape diff --git a/poetry.lock b/poetry.lock index b4e3fa7..98aeb0e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2209,4 +2209,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.12" -content-hash = "48fbb10bd2e88cb26838d0f395f11981176bdf2f21090fa6bd91c769e5794288" +content-hash = "06c5a5903df8c8d4887cc720bdc6d5642d97f37cc6b3d3799e4d2b566ce0ff2b" diff --git a/pyproject.toml b/pyproject.toml index c264a53..3e20a61 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,6 +36,7 @@ uvicorn = {extras = ["standard"], version = "^0.25.0"} xmltodict = "^0.13.0" tzfpy = "^0.15.3" pytz = "^2023.3.post1" +brotlicffi = "^1.1.0.0" [build-system] build-backend = "poetry.core.masonry.api"