-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Subdirect #15
Subdirect #15
Changes from all commits
f765f93
4bcd09e
4fc5d2d
c82c43e
f0ae63b
7add12e
8e6d61c
3f69a0d
c59d1fc
d34ab70
d7a6dde
22c87ce
431456b
160911b
ee6abc9
9fede25
2759c05
be3dd7d
6665e53
02858c8
a6fd972
a34f893
e9b8e66
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.venv |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,41 @@ | ||
jobs: | ||
check: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: source includes.sh && ghas | ||
- run: source includes.sh dcb | ||
# Ideally this would come from default.settings_module() | ||
- run: source includes.sh dcr web python -m pytest --ds=demodj.settings | ||
|
||
check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
cache: npm | ||
node-version-file: .nvmrc | ||
- run: npm install --frozen-lockfile | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version-file: .python-version | ||
|
||
- run: pip install --upgrade pip uv | ||
env: | ||
PIP_PROGRESS_BAR: 'off' | ||
- run: | | ||
pip install --disable-pip-version-check --progress-bar off --upgrade \ | ||
"$(grep ^uv requirements.txt)" | ||
|
||
- run: uv venv | ||
- run: source includes.sh && ups && a && pcam --color always --show-diff-on-failure | ||
- run: .venv/bin/python -m build | ||
- run: .venv/bin/twine check dist/* | ||
- run: .venv/bin/python -m manage check | ||
- run: .venv/bin/python -m manage makemigrations --check | ||
- run: source includes.sh dcb | ||
# Ideally this would come from default.settings_module() | ||
- run: source includes.sh dcr web pytest --ds=demodj.settings | ||
|
||
summarize: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: source includes.sh summarize | ||
|
||
on: # yamllint disable-line rule:truthy | ||
- pull_request |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,39 @@ | ||
FROM python:3.12 | ||
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim | ||
|
||
# TODO assert C.UTF8 and PYTHONUNBUFFERED are set correctly | ||
# TODO assert C.UTF8 locale and PYTHONUNBUFFERED are set correctly | ||
ENV PYTHONUNBUFFERED 1 | ||
|
||
WORKDIR /srv | ||
RUN --mount=type=cache,target=/root/.cache pip install --upgrade pip-tools wheel | ||
COPY requirements.txt . | ||
RUN --mount=type=cache,target=/root/.cache pip-sync | ||
|
||
# TODO multi-stage for faster development builds? | ||
RUN mkdir -p static | ||
# hadolint ignore=DL3008,SC2046 | ||
RUN --mount=type=cache,target=/var/cache/apt \ | ||
--mount=type=bind,source=includes.sh,target=includes.sh \ | ||
rm /etc/apt/apt.conf.d/docker-clean \ | ||
darpham marked this conversation as resolved.
Show resolved
Hide resolved
|
||
&& echo 'Binary::apt::APT::Keep-Downloaded-Packages "1";' > /etc/apt/apt.conf.d/99cache \ | ||
&& apt-get update \ | ||
&& apt-get install -qq --no-install-recommends --yes nodejs npm \ | ||
$(sed -En 's/"$//; s/^PACKAGES="//p' includes.sh) \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Bind mount caused "EROFS: read-only file system, open '/srv/package-lock.json'" | ||
COPY package-lock.json ./ | ||
RUN --mount=type=cache,target=/root/.npm \ | ||
--mount=type=bind,source=package.json,target=package.json \ | ||
npm install --frozen-lockfile | ||
|
||
COPY . . | ||
# Not using /srv/.venv because it would make volume-mounting /srv harder | ||
ENV UV_COMPILE_BYTECODE=1 | ||
ENV UV_LINK_MODE=copy | ||
ENV UV_SYSTEM_PYTHON=1 | ||
# hadolint ignore=DL3013,DL3042 | ||
RUN --mount=type=cache,target=/root/.cache \ | ||
--mount=type=bind,source=requirements.txt,target=requirements.txt \ | ||
uv pip sync --quiet requirements.txt | ||
|
||
COPY . ./ | ||
|
||
ARG STATIC_URL | ||
ENV STATIC_URL ${STATIC_URL:-/static/} | ||
RUN STATIC_URL=${STATIC_URL} python -m manage collectstatic --no-input | ||
RUN mkdir -p static && STATIC_URL=${STATIC_URL} python -m manage collectstatic --no-input | ||
|
||
EXPOSE 8001 | ||
ENV PYTHONUNBUFFERED 1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,6 @@ | ||
# TODO Avoid "AppRegistryNotReady: Apps aren't loaded yet." | ||
# To avoid "AppRegistryNotReady: Apps aren't loaded yet." and similar problems, this file must | ||
# only import from the likes of allowedflare.core, not the likes of allowedflare.django. | ||
|
||
from allowedflare.allowedflare import clean_username | ||
from allowedflare.core import authenticate, clean_username | ||
|
||
# Django REST Framework authentication class | ||
from allowedflare.django import Authentication | ||
|
||
# Django Admin authentication backend | ||
from allowedflare.django import Backend | ||
|
||
# Django Admin login view | ||
from allowedflare.django import LoginView | ||
|
||
# SQL Explorer login view wrapper | ||
from allowedflare.django import login_view_wrapper | ||
|
||
__all__ = ( | ||
Authentication.__name__, | ||
Backend.__name__, | ||
LoginView.__name__, | ||
clean_username.__name__, | ||
login_view_wrapper.__name__, | ||
) | ||
__all__ = (authenticate.__name__, clean_username.__name__) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"@jupyterlab/apputils-extension:themes": { | ||
"theme": "JupyterLab Dark" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,8 +15,33 @@ dynamic = ['version'] | |
name = 'allowedflare' | ||
readme = 'README.md' | ||
|
||
[project.optional-dependencies] | ||
precommit = [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is for system/local installation of tools like codespell which pre-commit will use. |
||
'codespell', | ||
'django-stubs', | ||
'djangorestframework-stubs[compatible-mypy]', | ||
'hadolint-py @ git+https://github.com/AleksaC/hadolint-py.git', | ||
'mypy', | ||
'pre-commit', | ||
'ruff', | ||
'shellcheck-py', | ||
'uv', | ||
'yamllint', | ||
] | ||
demo = [ | ||
'dj-notebook', | ||
'django', | ||
'django-extensions', | ||
'django-health-check', | ||
'django-sql-explorer', | ||
'djangorestframework', | ||
'jupyterlab', | ||
] | ||
build = ['build', 'twine'] | ||
test = ['pytest', 'pytest-django', 'pytest-mock'] | ||
|
||
[project.urls] | ||
Homepage = 'https://github.com/covracer/allowedflare' | ||
Homepage = 'https://github.com/biobuddies/allowedflare' | ||
|
||
[tool.codespell] | ||
ignore-words-list = 'afterall' | ||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved to
setup-uv
, if you are curiousThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been seeing
uv sync
anduv.lock
in the docs. I'll have to try them out.