Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions .codeclimate.yml

This file was deleted.

12 changes: 5 additions & 7 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@ exclude_lines =

[run]
omit =
*tests*
*migrations*
*urls*
*site-packages*
*config*
*django-*
*src*
*migrations*
*settings*
*config*
*site-packages*
*test_helpers*
*virtualenv*
*tests*
*tos*
*tos_i18n* # TOS package is clone of pip package, needs removed when updated.
*urls*
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
.dockerignore
.idea
.tox
.venv
./docker-compose*.yml
./deploy.sh
**/*.pyc
Expand Down
26 changes: 14 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ jobs:
DJANGO_LOG_LEVEL: ERROR
run: |
# verify no migrations need to be made...
docker exec seed_web python manage.py makemigrations --check --dry-run
docker exec seed_web uv run python manage.py makemigrations --check --dry-run

# run migrations
docker exec --env DJANGO_LOG_LEVEL seed_web ./manage.py migrate
docker exec --env DJANGO_LOG_LEVEL seed_web ./manage.py create_default_user --username=demo@example.com --password=demo123
docker exec --env DJANGO_LOG_LEVEL seed_web /bin/bash -c 'echo "y" | ./manage.py make_superuser --user demo@example.com'
docker exec --env DJANGO_LOG_LEVEL seed_web uv run python manage.py migrate
docker exec --env DJANGO_LOG_LEVEL seed_web uv run python manage.py create_default_user --username=demo@example.com --password=demo123
docker exec --env DJANGO_LOG_LEVEL seed_web /bin/bash -lc 'echo "y" | uv run python manage.py make_superuser --user demo@example.com'
- uses: actions/setup-node@v6
with:
node-version: 24
Expand Down Expand Up @@ -89,9 +89,9 @@ jobs:
DJANGO_LOG_LEVEL: ERROR
run: |
docker exec seed_web touch /seed/config/settings/local_untracked.py
docker exec --env SEED_PM_UN --env SEED_PM_PW --env DJANGO_LOG_LEVEL --env SF_INSTANCE --env SF_USERNAME --env SF_PASSWORD --env SF_SECURITY_TOKEN --env SF_DOMAIN seed_web coverage run manage.py test --settings=config.settings.docker_dev
docker exec --env SEED_PM_UN --env SEED_PM_PW --env DJANGO_LOG_LEVEL --env SF_INSTANCE --env SF_USERNAME --env SF_PASSWORD --env SF_SECURITY_TOKEN --env SF_DOMAIN seed_web /bin/bash -lc 'uv run coverage run manage.py test --settings=config.settings.docker_test --parallel="$(nproc)" --verbosity=2'
if [[ ! -z "${COVERALLS_REPO_TOKEN}" ]]; then
docker exec --env COVERALLS_REPO_TOKEN seed_web coveralls
docker exec --env COVERALLS_REPO_TOKEN seed_web uv run coveralls
else
echo "INFO: Env var COVERALLS_REPO_TOKEN was not found, skipping coveralls update"
fi
Expand All @@ -105,8 +105,8 @@ jobs:
- name: Test API
if: ${{ matrix.test_env == 'api' }}
run: |
docker exec seed_web ./manage.py create_test_user_json --username demo@example.com --host http://localhost --file ./seed/tests/api/api_test_user.json
docker exec seed_web python seed/tests/api/test_seed_host_api.py --noinput --nofile
docker exec seed_web uv run python manage.py create_test_user_json --username demo@example.com --host http://localhost --file ./seed/tests/api/api_test_user.json
docker exec seed_web uv run python seed/tests/api/test_seed_host_api.py --noinput --nofile
- name: Web container logs
if: ${{ always() }}
run: docker logs seed_web
Expand All @@ -121,7 +121,10 @@ jobs:
submodules: true
- uses: actions/setup-python@v6
with:
python-version: '3.9'
python-version-file: '.python-version'
- uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- uses: actions/setup-node@v6
with:
node-version: 24
Expand All @@ -131,8 +134,7 @@ jobs:
version: 10
- name: Install deps
run: |
pip install --upgrade pip
pip install tox==4.30.2
uv sync --frozen --all-groups
sudo apt-get update
sudo apt-get install gdal-bin
- name: Setup config
Expand All @@ -145,4 +147,4 @@ jobs:
}
EOF
- name: Run tox
run: tox -e ${{ matrix.tox_env }}
run: uv run tox -e ${{ matrix.tox_env }}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
.idea
.project
.pydevproject
.python-version
.vscode
*~
*~$*
Expand Down
28 changes: 18 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: check-added-large-files
args: ["--maxkb=2000"]
Expand All @@ -12,7 +12,7 @@ repos:
- id: check-toml
- id: check-xml
- id: check-yaml
exclude: '(pnpm-lock\.yaml|pnpm-workspace\.yaml)'
exclude: pnpm-lock\.yaml|pnpm-workspace\.yaml
- id: debug-statements
- id: end-of-file-fixer
exclude: seed/static/seed/locales/
Expand All @@ -26,15 +26,23 @@ repos:
rev: v4.0.0-alpha.8
hooks:
- id: prettier
exclude: '(pnpm-lock\.yaml|pnpm-workspace\.yaml)'
# for now ignoring html, javascript
args: [--no-cache]
exclude: pnpm-lock\.yaml|pnpm-workspace\.yaml
types_or: [yaml, markdown, css, scss]
# https://docs.astral.sh/ruff/integrations/#pre-commit
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.19.1
hooks:
- id: mypy
args: [--install-types, --non-interactive, --show-error-codes]
additional_dependencies:
- types-Markdown
- types-PyYAML
- types-python-dateutil
- types-pytz
- types-requests
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.8
rev: v0.15.6
hooks:
# Run the linter
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --output-format=full] #, --unsafe-fixes]
# Run the formatter
- id: ruff-check
args: [--fix, --exit-non-zero-on-fix, --output-format=full]
- id: ruff-format
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
2 changes: 0 additions & 2 deletions .spelling.dic
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,6 @@ username
usr
util
utils
uwsgi
uWSGI
validator
validators
vcr
Expand Down
36 changes: 11 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ ARG NGINX_LISTEN_OPTS
# TO_BUILD_AND_RUN: docker compose build && docker compose up

FROM node:22-alpine3.19
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

ARG NGINX_LISTEN_OPTS

Expand Down Expand Up @@ -44,33 +45,18 @@ RUN apk add --no-cache \
## - coreutils is required due to an issue with our wait-for-it.sch script:
## https://github.com/vishnubob/wait-for-it/issues/71

# Install pyenv and Python globally
ENV PYTHON_VERSION=3.9.22
ENV PYENV_ROOT="/opt/pyenv"
ENV PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH"
ENV UV_LINK_MODE=copy
ENV UV_PYTHON_INSTALL_DIR="/opt/uv/python"
ENV UV_PROJECT_ENVIRONMENT="/seed/.venv"
ENV PATH="/seed/.venv/bin:$PATH"

RUN git clone https://github.com/pyenv/pyenv.git $PYENV_ROOT && \
$PYENV_ROOT/bin/pyenv install $PYTHON_VERSION && \
$PYENV_ROOT/bin/pyenv global $PYTHON_VERSION && \
ln -sf $PYENV_ROOT/shims/python /usr/local/bin/python && \
ln -sf $PYENV_ROOT/shims/python3 /usr/local/bin/python3 && \
ln -sf $PYENV_ROOT/shims/pip /usr/local/bin/pip && \
ln -sf $PYENV_ROOT/shims/pip3 /usr/local/bin/pip3

# Make sure non-root users inherit pyenv paths
ENV PYENV_ROOT="/opt/pyenv"
ENV PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH"

# Install pip
RUN bash -c "python3 -m ensurepip --upgrade && python3 -m pip install --upgrade pip setuptools && \
pip install supervisor==4.3.0"

### Install python requirements
### Install python dependencies
WORKDIR /seed
COPY ./requirements.txt /seed/requirements.txt
COPY ./requirements/*.txt /seed/requirements/
RUN pip uninstall -y enum34
RUN pip install -r requirements/aws.txt
COPY ./.python-version /seed/.python-version
COPY ./pyproject.toml /seed/pyproject.toml
COPY ./uv.lock /seed/uv.lock
RUN uv sync --frozen --managed-python --no-dev --no-install-project && \
uv pip install supervisor==4.3.0

### Install JavaScript requirements - do this first because they take a while
### and the dependencies will probably change slower than python packages.
Expand Down
42 changes: 12 additions & 30 deletions Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM node:22-alpine3.19
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

RUN apk add --no-cache \
postgresql-dev \
Expand Down Expand Up @@ -36,37 +37,18 @@ RUN apk add --no-cache \
## - coreutils is required due to an issue with our wait-for-it.sch script:
## https://github.com/vishnubob/wait-for-it/issues/71

# Install pyenv and Python globally
ENV PYTHON_VERSION=3.9.22
ENV PYENV_ROOT="/opt/pyenv"
ENV PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH"
ENV UV_LINK_MODE=copy
ENV UV_PYTHON_INSTALL_DIR="/opt/uv/python"
ENV UV_PROJECT_ENVIRONMENT="/seed/.venv"
ENV PATH="/seed/.venv/bin:$PATH"

RUN git clone https://github.com/pyenv/pyenv.git $PYENV_ROOT && \
$PYENV_ROOT/bin/pyenv install $PYTHON_VERSION && \
$PYENV_ROOT/bin/pyenv global $PYTHON_VERSION && \
ln -sf $PYENV_ROOT/shims/python /usr/local/bin/python && \
ln -sf $PYENV_ROOT/shims/python3 /usr/local/bin/python3 && \
ln -sf $PYENV_ROOT/shims/pip /usr/local/bin/pip && \
ln -sf $PYENV_ROOT/shims/pip3 /usr/local/bin/pip3

# Make sure non-root users inherit pyenv paths
ENV PYENV_ROOT="/opt/pyenv"
ENV PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH"

# Install pip
RUN bash -c "python3 -m ensurepip --upgrade && python3 -m pip install --upgrade pip setuptools && \
pip install supervisor==4.3.0"

### Install python requirements
### Install python dependencies
WORKDIR /seed
COPY ./requirements.txt /seed/requirements.txt
COPY ./requirements/*.txt /seed/requirements/
RUN pip uninstall -y enum34
RUN pip install -r requirements/local.txt
# for remote debugging
RUN pip install remote-pdb
# for live reloading celery
RUN pip install watchdog[watchmedo]
COPY ./.python-version /seed/.python-version
COPY ./pyproject.toml /seed/pyproject.toml
COPY ./uv.lock /seed/uv.lock
RUN uv sync --frozen --managed-python --no-install-project && \
uv pip install supervisor==4.3.0 remote-pdb "watchdog[watchmedo]"

### Install JavaScript requirements - do this first because they take awhile
### and the dependencies will probably change slower than python packages.
Expand All @@ -87,4 +69,4 @@ RUN git config --system --add safe.directory /seed

EXPOSE 80

CMD ["python", "manage.py", "runserver", "--settings=config.settings.docker_dev", "0.0.0.0:80"]
CMD ["uv", "run", "hypercorn", "config.asgi:seed", "--bind", "0.0.0.0:80", "--reload"]
36 changes: 11 additions & 25 deletions Dockerfile.ecs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ ARG NGINX_LISTEN_OPTS
# TO_BUILD_AND_RUN: docker compose build && docker compose up

FROM node:22-alpine3.19
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

# Install necessary dependencies (curl and ca-certificates)
RUN apk add --no-cache curl ca-certificates && \
Expand Down Expand Up @@ -50,33 +51,18 @@ RUN apk add --no-cache \
## - coreutils is required due to an issue with our wait-for-it.sch script:
## https://github.com/vishnubob/wait-for-it/issues/71

# Install pyenv and Python globally
ENV PYTHON_VERSION=3.9.22
ENV PYENV_ROOT="/opt/pyenv"
ENV PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH"
ENV UV_LINK_MODE=copy
ENV UV_PYTHON_INSTALL_DIR="/opt/uv/python"
ENV UV_PROJECT_ENVIRONMENT="/seed/.venv"
ENV PATH="/seed/.venv/bin:$PATH"

RUN git clone https://github.com/pyenv/pyenv.git $PYENV_ROOT && \
$PYENV_ROOT/bin/pyenv install $PYTHON_VERSION && \
$PYENV_ROOT/bin/pyenv global $PYTHON_VERSION && \
ln -sf $PYENV_ROOT/shims/python /usr/local/bin/python && \
ln -sf $PYENV_ROOT/shims/python3 /usr/local/bin/python3 && \
ln -sf $PYENV_ROOT/shims/pip /usr/local/bin/pip && \
ln -sf $PYENV_ROOT/shims/pip3 /usr/local/bin/pip3

# Make sure non-root users inherit pyenv paths
ENV PYENV_ROOT="/opt/pyenv"
ENV PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH"

# Install pip
RUN bash -c "python3 -m ensurepip --upgrade && python3 -m pip install --upgrade pip setuptools && \
pip install supervisor==4.3.0"

### Install python requirements
### Install python dependencies
WORKDIR /seed
COPY ./requirements.txt /seed/requirements.txt
COPY ./requirements/*.txt /seed/requirements/
RUN pip uninstall -y enum34
RUN pip install -r requirements/aws.txt
COPY ./.python-version /seed/.python-version
COPY ./pyproject.toml /seed/pyproject.toml
COPY ./uv.lock /seed/uv.lock
RUN uv sync --frozen --managed-python --no-dev --no-install-project && \
uv pip install supervisor==4.3.0

### Install JavaScript requirements - do this first because they take awhile
### and the dependencies will probably change slower than python packages.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ or from the front end by clicking the API documentation link in the sidebar.

### Starting SEED Platform

In production the following two commands will run the web server (uWSGI) and
In production the following two commands will run the web server (Hypercorn) and
the background task manager (Celery) with:

```
bin/start_uwsgi.sh
bin/start_hypercorn.sh
bin/start_celery.sh
```

In development mode, you can start the web server (uWSGI) and the background
In development mode, you can start Django and the background
task manager (Celery) with:

```
Expand Down
10 changes: 10 additions & 0 deletions bin/start_hypercorn.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -e

cd "$(dirname "$0")/.."

WORKERS="${HYPERCORN_WORKERS:-$(nproc)}"
WORKERS=$(($WORKERS > 1 ? $WORKERS : 1))

exec uv run hypercorn config.asgi:seed --bind 127.0.0.1:8000 --workers "$WORKERS"
5 changes: 0 additions & 5 deletions bin/start_uwsgi.sh

This file was deleted.

Loading
Loading