diff --git a/README.md b/README.md index cd3acb5a..3a57f727 100644 --- a/README.md +++ b/README.md @@ -54,12 +54,12 @@ well as policy-makers and economic stakeholders. Bloom is tested with: -| | Main version (dev) | Stable version (1.0.0) | -|------------|----------------------|------------------------| -| Python | 3.8, 3.9, 3.10, 3.11 | 3.8, 3.9, 3.10, 3.11 | -| Platform | AMD64/ARM64(\*) | AMD64/ARM64(\*) | -| Docker | 24 | 24 | -| PostgreSQL | 14 | 14 | +| | Main version (dev) | Stable version (1.0.0) | +|------------|--------------------|------------------------| +| Python | 3.11 | 3.11 | +| Platform | AMD64/ARM64(\*) | AMD64/ARM64(\*) | +| Docker | 24 | 24 | +| PostgreSQL | 14 | 14 | ## Getting started @@ -118,7 +118,7 @@ You can now jump to [Use the Bloom Application](#use-the-bloom-application) #### Prerequistes -* **Python**: 3.9, 3.10, 3.11 +* **Python**: 3.11 * **Python-pip**: >=20 * **Postgresql**: 14, 15, 16 @@ -130,18 +130,10 @@ password, database name, port to use) ```bash # From project diretory cd ./backend - # Install poetry - pip install --user "poetry==1.8.1" - # Mise à disposition de l'exécutable de manière temporaire - export PATH=$PATH:~/.local/bin/ - # Ensure that poetry will create a `.venv` directory into the project with the command - poetry config virtualenvs.in-project true - # Install dependencies from pyproject.toml - poetry install - # Make sure everything is all right using - poetry env info - # Enable virtual poetry project environment - poetry shell + # Install uv + curl -LsSf https://astral.sh/uv/install.sh | sh + # Install project and dependencies + uv sync ``` #### Initial configuration diff --git a/backend/pyproject.toml b/backend/pyproject.toml index 57637c2b..3c5c6ecc 100644 --- a/backend/pyproject.toml +++ b/backend/pyproject.toml @@ -1,49 +1,57 @@ [build-system] -requires = ["poetry-core"] -build-backend = "poetry.core.masonry.api" +requires = ["hatchling"] +build-backend = "hatchling.build" -[tool.poetry] +[tool.hatch.build.targets.wheel] +packages = ["bloom"] + + +[dependency-groups] +dev = [ + "pre-commit~=3.6", + "ruff~=0.7", + "tox~=4.14", +] + +[project] +authors = [ + {name = "Your Name", email = "you@example.com"}, +] +requires-python = "~=3.10" +dependencies = [ + "alembic~=1.13", + "autopep8~=2.3", + "dependency-injector~=4.42", + "dependency-injection~=1.2", + "GeoAlchemy2~=0.15", + "geopandas~=0.14", + "geopy~=2.4", + "gql~=3.5", + "matplotlib~=3.9", + "openpyxl~=3.1", + "pandas~=2.2", + "poetry~=1.8", + "psycopg2-binary~=2.9", + "pydantic~=2.9", + "pydantic-settings~=2.6", + "python-dotenv~=1.0", + "PyYAML~=6.0", + "requests~=2.32", + "requests-toolbelt~=1.0", + "shapely~=2.0", + "scipy==1.12.0", + "slack-sdk~=3.33", + "SQLAlchemy~=2.0", + "pycountry==23.12.11", + "fastapi[standard]>=0.115.0,<1.0.0", + "uvicorn~=0.32", + "redis~=5.0", +] name = "bloom" version = "0.1.0" description = "Bloom scrapping application" -authors = ["Your Name "] - -[tool.poetry.dependencies] -alembic = "~1.13" -autopep8 = "~2.0" -dependency-injector = "~4.41" -dependency_injection = "~1.2" -GeoAlchemy2 = "~0.14" -geopandas = "~0.14" -geopy = "~2.4" -gql = "~3.5" -matplotlib = "~3.8" -openpyxl = "~3.1" -pandas = "~2.2" -poetry = "~1.8" -psycopg2-binary = "~2.9" -pydantic = "~2.6" -pydantic-settings = "~2.2" -python = ">=3.9,<3.9.7 || >3.9.7,<4.0" -python-dotenv = "~1.0" -PyYAML = "~6.0" -requests = "~2.31" -requests-toolbelt = "~1.0" -shapely = "~2.0" -scipy = "1.12.0" -slack-sdk = "~3.27" -SQLAlchemy = "~2.0" -pycountry = "23.12.11" -fastapi = "^0.111.0" -uvicorn = "^0.30.1" -redis = "^5.0.4" -[tool.poetry.group.dev.dependencies] -pre-commit = "~3.6" -ruff = "~0.3" -tox = "~4.14" - [tool.ruff] select = [ "A", @@ -148,3 +156,4 @@ target-version = "py310" [tool.ruff.mccabe] max-complexity = 10 + diff --git a/clevercloud/clever.json b/clevercloud/clever.json new file mode 100644 index 00000000..c8b3b95b --- /dev/null +++ b/clevercloud/clever.json @@ -0,0 +1,3 @@ +[ + "*/15 * * * * /home/bas/venv/bin/python /home/bas/app_7244f095-70bc-43c3-9950-d075c01af05f/backend/load_spire_data_from_api.py" +] \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile index 5f03f3dc..c9e567f8 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -5,10 +5,14 @@ RUN apt-get update &&\ apt-get -y install curl &&\ apt-get install -y rsyslog &&\ apt-get install -y libgdal-dev &&\ - apt-get install -y g++ + apt-get install -y g++ &&\ + apt-get install -y clang # Define working directory +ARG VIRTUAL_ENV=/.venv +ENV PATH=${VIRTUAL_ENV}/bin:$PATH \ + VIRTUAL_ENV=${VIRTUAL_ENV} ARG PROJECT_DIR=/project ENV PROJECT_DIR=${PROJECT_DIR} WORKDIR ${PROJECT_DIR} @@ -23,14 +27,19 @@ ARG POETRY_VERSION=1.8.2 ENV POETRY_VERSION=${POETRY_VERSION} RUN pip install --upgrade pip && pip install --user "poetry==$POETRY_VERSION" ENV PATH="${PATH}:/root/.local/bin" -COPY ./backend/pyproject.toml ./backend/poetry.lock ./backend/alembic.ini ./backend/ +COPY ./backend/pyproject.toml ./backend/alembic.ini ./backend/ -ENV PATH=/venv/bin:$PATH \ - VIRTUAL_ENV=/venv -RUN python -m venv /venv &&\ - echo ". /venv/bin/activate" >> /root/.bashrc &&\ + +# Install UV +RUN curl -LsSf https://astral.sh/uv/install.sh | sh +ARG UV_PROJECT_ENVIRONMENT=${VIRTUAL_ENV} +ENV UV_PROJECT_ENVIRONMENT=${VIRTUAL_ENV} +RUN \ + . ~/.cargo/env &&\ cd backend &&\ - poetry install + uv venv ${VIRTUAL_ENV} &&\ + echo ". ${VIRTUAL_ENV}/bin/activate" >> /root/.bashrc &&\ + uv sync # Launch cron services RUN DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install -y cron \