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
9 changes: 2 additions & 7 deletions .github/workflows/tox_matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,12 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies
cache-dependency-path: |
requirements/requirements*.txt
requirements*.txt
- name: Install requirements
run: |
pip install wheel
pip install tox
pip install -r requirements-dev.txt
pip install uv
env:
PIP_EXTRA_INDEX_URL: ${{vars.PIP_EXTRA_INDEX_URL}}
- name: Run tox
run: tox -e py -vvv
run: uv run --group tox --with tox-uv --no-dev tox run -e py -vvv --runner uv-venv-lock-runner
env:
PIP_EXTRA_INDEX_URL: ${{vars.PIP_EXTRA_INDEX_URL}}
38 changes: 22 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,39 @@
FROM python:3.11-slim AS base_image

FROM base_image AS builder
RUN apt update -y && apt install -y npm
RUN python -m pip install pip --upgrade && \
pip install --upgrade setuptools && \
pip install wheel build
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt update -y && apt install --no-install-recommends -y npm
COPY getmarcapi /src/getmarcapi/
COPY src /src/src/
COPY pyproject.toml README.rst README.md setup.py MANIFEST.in requirements.txt /src/
WORKDIR /src
COPY package.json package-lock.json webpack.config.js ./
RUN npm install
RUN --mount=type=cache,target=/root/.npm npm install
RUN npm run env -- webpack --output-path=/output

#
ARG PIP_INDEX_URL
ARG PIP_EXTRA_INDEX_URL
COPY requirements.txt ./requirements.txt
RUN pip wheel --wheel-dir=/wheels -r /src/requirements.txt
RUN python -m build --wheel --outdir /wheels
COPY pyproject.toml uv.lock README.rst README.md setup.py MANIFEST.in /src/
RUN python -m pip install --disable-pip-version-check uv && \
uv build --wheel --out-dir /wheels

FROM base_image

COPY --from=builder /wheels/*.whl /wheels/
COPY requirements.txt ./requirements.txt
RUN pip install --find-links=/wheels --no-index -r requirements.txt
RUN pip install --find-links=/wheels --no-index getmarcapi
EXPOSE 5000
WORKDIR /app
COPY pyproject.toml uv.lock README.rst /app/
ARG PIP_INDEX_URL
ARG UV_INDEX_URL
ARG UV_CACHE_DIR=/.cache/uv
ARG UV_EXTRA_INDEX_URL
RUN --mount=type=cache,target=${UV_CACHE_DIR} \
python -m venv uv && \
./uv/bin/pip install --disable-pip-version-check uv && \
./uv/bin/uv sync --group deploy --no-dev --no-editable --no-install-project --find-links=/wheels && \
./uv/bin/uv pip install --find-links=/wheels --no-index getmarcapi --no-deps
EXPOSE 5000
COPY api.cfg /app/settings.cfg
ENV GETMARCAPI_SETTINGS=/app/settings.cfg
RUN python -m getmarcapi --check
CMD gunicorn getmarcapi.app:app --bind 0.0.0.0:5000 --log-level=debug
RUN ./.venv/bin/python -m getmarcapi --check
CMD ./.venv/bin/gunicorn getmarcapi.app:app --bind 0.0.0.0:5000 --log-level=debug

36 changes: 35 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,37 @@ dependencies = [
'uiucprescon.getmarc2>=0.1.3',
'typing-extensions;python_version<"3.8"'
]
requires-python = ">= 3.9"
readme = "README.rst"
license = {text = "University of Illinois/NCSA Open Source License"}
license = "NCSA"
authors = [
{name = "University Library at The University of Illinois at Urbana Champaign: Preservation Services", email = "prescons@library.illinois.edu"},
]
maintainers = [
{name = "Henry Borchers", email = "hborcher@illinois.edu"}
]
description = "Provide MARC XML data"
[dependency-groups]
deploy = ['gunicorn', 'python-dotenv']
test = ['pytest']
tox = ["tox"]
publish = ["twine"]
docs = ["sphinx", "sphinxcontrib.spelling"]
dev = [
"bandit",
"coverage",
"flake8",
"lxml-stubs",
"mypy",
"paramiko",
"pydocstyle",
"pylint",
{include-group = "docs"},
{include-group = "publish"},
{include-group = "test"},
{include-group = "tox"},
]
ci = ["pysonar", {include-group = "dev"}]

[project.urls]
Download = "https://github.com/UIUCLibrary/"
Expand All @@ -40,3 +62,15 @@ testpaths = [
"tests"
]
junit_family="xunit2"

[[tool.uv.index]]
url = "https://pypi.org/simple"
default = true

[[tool.uv.index]]
name = "uiuc_prescon_python"
url = "https://nexus.library.illinois.edu/repository/uiuc_prescon_python/simple"
explicit = true

[tool.uv.sources]
"uiucprescon-getmarc2" = {index="uiuc_prescon_python"}
Loading