This is an automated email from the ASF dual-hosted git repository. yasith pushed a commit to branch feat/sdk-facade-migration in repository https://gitbox.apache.org/repos/asf/airavata-portals.git
commit 6eca8257b49d068865dd4d4a8f52bcf04342febf Author: yasithdev <[email protected]> AuthorDate: Wed Apr 8 01:09:36 2026 -0500 build: replace pip with uv, add ty type checker and pre-commit hooks - pyproject.toml: add dependency-groups for dev tools (ruff, ty, pre-commit, pytest), add [tool.ty] and [tool.pytest.ini_options] - Delete requirements.txt, setup.py, tox.ini (uv reads pyproject.toml directly) - Create .pre-commit-config.yaml with ruff lint+format and ty type checking - Create .python-version (3.12) - Update Dockerfile: install uv from ghcr, use uv sync instead of pip - Update Tiltfile: uv sync + uv run manage.py - Update start-server.sh: uv run manage.py --- airavata-django-portal/.gitignore | 1 + airavata-django-portal/.pre-commit-config.yaml | 25 +++++++++++++++++++++++++ airavata-django-portal/.python-version | 1 + airavata-django-portal/Dockerfile | 10 ++++------ airavata-django-portal/Tiltfile | 7 +++---- airavata-django-portal/pyproject.toml | 23 ++++++++++++++++++++--- airavata-django-portal/requirements-mysql.txt | 1 - airavata-django-portal/requirements.txt | 13 ------------- airavata-django-portal/scripts/start-server.sh | 4 ++-- airavata-django-portal/setup.py | 5 ----- airavata-django-portal/tox.ini | 14 -------------- 11 files changed, 56 insertions(+), 48 deletions(-) diff --git a/airavata-django-portal/.gitignore b/airavata-django-portal/.gitignore index 9aa90e212..5b7b3716e 100644 --- a/airavata-django-portal/.gitignore +++ b/airavata-django-portal/.gitignore @@ -17,3 +17,4 @@ package-lock.json site/ .tox/ yarn-error.log +.venv/ diff --git a/airavata-django-portal/.pre-commit-config.yaml b/airavata-django-portal/.pre-commit-config.yaml new file mode 100644 index 000000000..e8ee63781 --- /dev/null +++ b/airavata-django-portal/.pre-commit-config.yaml @@ -0,0 +1,25 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-toml + - id: check-added-large-files + + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.8.6 + hooks: + - id: ruff + args: [--fix] + - id: ruff-format + + - repo: local + hooks: + - id: ty + name: ty type checker + entry: uv run ty check + language: system + types: [python] + pass_filenames: false diff --git a/airavata-django-portal/.python-version b/airavata-django-portal/.python-version new file mode 100644 index 000000000..e4fba2183 --- /dev/null +++ b/airavata-django-portal/.python-version @@ -0,0 +1 @@ +3.12 diff --git a/airavata-django-portal/Dockerfile b/airavata-django-portal/Dockerfile index c6df8e32c..d41f069d5 100644 --- a/airavata-django-portal/Dockerfile +++ b/airavata-django-portal/Dockerfile @@ -64,18 +64,16 @@ RUN yarn run build FROM python:3.12-slim as server-stage +COPY --from=ghcr.io/astral-sh/uv:0.5 /uv /usr/local/bin/uv + ENV PYTHONUNBUFFERED 1 EXPOSE 8000 WORKDIR /code -COPY requirements.txt requirements-mysql.txt ./ -COPY setup.* ./ -COPY pyproject.toml README.md ./ +COPY pyproject.toml uv.lock README.md ./ RUN apt-get update && apt-get install -y git gcc g++ zlib1g-dev libjpeg-dev default-libmysqlclient-dev -RUN pip install --upgrade pip setuptools wheel --no-cache -RUN pip install -r requirements.txt --no-cache -RUN pip install -r requirements-mysql.txt --no-cache +RUN uv sync --frozen --no-dev --extra mysql --no-editable # Copy in a default settings_local.py file COPY ./django_airavata/settings_local.py.sample ./django_airavata/settings_local.py diff --git a/airavata-django-portal/Tiltfile b/airavata-django-portal/Tiltfile index 1d91ee6b5..4a4bfa75d 100644 --- a/airavata-django-portal/Tiltfile +++ b/airavata-django-portal/Tiltfile @@ -7,10 +7,9 @@ docker_compose('./compose/docker-compose.yaml') local_resource( 'django-server', serve_cmd=' && '.join([ - 'pip install -e ".[mysql]" -q', - 'pip install -r requirements.txt -r requirements-mysql.txt -q', - 'python manage.py migrate --run-syncdb', - 'python manage.py runserver 0.0.0.0:8000', + 'uv sync --extra mysql', + 'uv run manage.py migrate --run-syncdb', + 'uv run manage.py runserver 0.0.0.0:8000', ]), deps=['django_airavata/'], ignore=[ diff --git a/airavata-django-portal/pyproject.toml b/airavata-django-portal/pyproject.toml index 190fb59ed..f0f7bdc26 100644 --- a/airavata-django-portal/pyproject.toml +++ b/airavata-django-portal/pyproject.toml @@ -42,13 +42,21 @@ dependencies = [ ] [project.optional-dependencies] -dev = [ - "ruff", -] mysql = [ "mysqlclient", ] +[dependency-groups] +dev = [ + "ruff>=0.8", + "ty", + "pre-commit>=4.0", + "pytest>=8.0", + "pytest-django>=4.8", + "pytest-cov>=5.0", + "django-stubs>=5.1", +] + [project.urls] Homepage = "https://github.com/apache/airavata-django-portal" @@ -61,3 +69,12 @@ line-length = 120 [tool.ruff.lint] select = ["E", "F", "I", "UP", "B", "SIM"] + +[tool.ty] +python-version = "3.12" + +[tool.pytest.ini_options] +DJANGO_SETTINGS_MODULE = "django_airavata.settings" +python_files = ["test_*.py"] +python_classes = ["Test*"] +python_functions = ["test_*"] diff --git a/airavata-django-portal/requirements-mysql.txt b/airavata-django-portal/requirements-mysql.txt deleted file mode 100644 index fbbfdfeae..000000000 --- a/airavata-django-portal/requirements-mysql.txt +++ /dev/null @@ -1 +0,0 @@ -mysqlclient==2.0.3 diff --git a/airavata-django-portal/requirements.txt b/airavata-django-portal/requirements.txt deleted file mode 100644 index b4a129d5a..000000000 --- a/airavata-django-portal/requirements.txt +++ /dev/null @@ -1,13 +0,0 @@ -Django==5.1.7 -djangorestframework==3.15.2 -requests==2.32.3 -requests-oauthlib==1.4.0 -django-vite==3.0.4 -logging-formatter-anticrlf==1.2 -wagtail==6.3.1 -papermill==2.6.0 -nbformat==5.10.4 -nbconvert==7.16.6 -grpcio==1.70.0 -airavata-python-sdk==3.0.0 --e "." diff --git a/airavata-django-portal/scripts/start-server.sh b/airavata-django-portal/scripts/start-server.sh index 8fd681028..b2acd4c24 100755 --- a/airavata-django-portal/scripts/start-server.sh +++ b/airavata-django-portal/scripts/start-server.sh @@ -1,4 +1,4 @@ #!/bin/bash -python manage.py migrate -exec python manage.py runserver 0.0.0.0:8000 +uv run manage.py migrate +exec uv run manage.py runserver 0.0.0.0:8000 diff --git a/airavata-django-portal/setup.py b/airavata-django-portal/setup.py deleted file mode 100644 index ccf785fc2..000000000 --- a/airavata-django-portal/setup.py +++ /dev/null @@ -1,5 +0,0 @@ -# Shim for editable installs (`pip install -e .`). -# All metadata lives in pyproject.toml. -from setuptools import setup - -setup() diff --git a/airavata-django-portal/tox.ini b/airavata-django-portal/tox.ini deleted file mode 100644 index 53a045d2a..000000000 --- a/airavata-django-portal/tox.ini +++ /dev/null @@ -1,14 +0,0 @@ -# tox (https://tox.readthedocs.io/) is a tool for running tests -# in multiple virtualenvs. This configuration file will run the -# test suite on all supported python versions. To use it, "pip install tox" -# and then run "tox" from this directory. - -[tox] -envlist = py36, py37, py38, py39, py310 #, py311 - -[testenv] -deps = - py{3,36,37,38,39,310,311}: -rrequirements-dev.txt - -commands = - ./runtests.py
