-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #232 from nationalarchives/poetize
Use poetry
- Loading branch information
Showing
8 changed files
with
789 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,9 +24,7 @@ jobs: | |
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.9" | ||
cache: pip | ||
cache-dependency-path: requirements.txt | ||
python-version: "3.12" | ||
|
||
- name: Run pre-commit | ||
uses: pre-commit/[email protected] | ||
|
@@ -48,12 +46,15 @@ jobs: | |
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.9" | ||
cache: pip | ||
cache-dependency-path: requirements.txt | ||
python-version: "3.12" | ||
|
||
- name: Install requirements | ||
run: pip install -r requirements.txt | ||
- name: Install Poetry | ||
uses: abatilo/[email protected] | ||
with: | ||
poetry-version: 1.6.1 | ||
|
||
- name: Install dependencies | ||
run: poetry install | ||
|
||
- name: Run test | ||
run: script/test | ||
run: poetry run script/test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,17 @@ | ||
FROM python:3.12 AS builder | ||
FROM python:3.12 as service | ||
|
||
WORKDIR /usr/src/app | ||
RUN pip install poetry==1.6.1 | ||
|
||
RUN python3 -m venv /venv | ||
ENV PATH="/venv/bin:$PATH" | ||
ENV POETRY_NO_INTERACTION=1 \ | ||
POETRY_VIRTUALENVS_IN_PROJECT=1 \ | ||
POETRY_VIRTUALENVS_CREATE=1 | ||
|
||
RUN pip install --upgrade pip | ||
WORKDIR /app | ||
|
||
COPY . . | ||
RUN pip install -r requirements.txt --no-cache-dir . | ||
COPY pyproject.toml poetry.lock ./ | ||
|
||
RUN poetry install --without dev --no-root | ||
|
||
FROM python:3.12 AS test_runner | ||
WORKDIR /tmp | ||
COPY --from=builder /venv /venv | ||
COPY --from=builder /usr/src/app/tests tests | ||
ENV PATH=/venv/bin:$PATH | ||
|
||
# install test dependencies | ||
RUN pip install pytest | ||
|
||
# run tests | ||
RUN pytest tests | ||
|
||
|
||
FROM python:3.12 AS service | ||
WORKDIR /root/app/site-packages | ||
COPY --from=test_runner /venv /venv | ||
ENV PATH=/venv/bin:$PATH | ||
ENV VIRTUAL_ENV=/app/.venv \ | ||
PATH="/app/.venv/bin:$PATH" | ||
COPY src . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
[build-system] | ||
requires = ["setuptools", "wheel"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
|
||
[tool.black] | ||
line-length = 88 | ||
|
@@ -28,3 +26,30 @@ skip = [ | |
'.venv', '_build', 'buck-out', 'build', 'dist', 'node_modules', 'venv', | ||
] | ||
skip_gitignore = true | ||
|
||
[tool.poetry] | ||
name = "ds-caselaw-privileged-api" | ||
version = "0.3.0" | ||
description = "" | ||
authors = ["David McKee <[email protected]>"] | ||
license = "MIT" | ||
readme = "README.md" | ||
|
||
[tool.poetry.dependencies] | ||
python = ">=3.12, <4" | ||
fastapi = ">=0.103.2" | ||
python-dotenv = ">=1.0.0" | ||
ds-caselaw-marklogic-api-client = ">=5.2.0" | ||
django-environ = ">=0.11.2" | ||
requests = {extras = ["use-chardet-on-py3"], version = ">=2.31.0"} | ||
requests-toolbelt = ">=1.0.0" | ||
lxml = ">= 4.9.3" | ||
httpx = ">= 0.25.0" | ||
uvicorn = ">= 0.23.2" | ||
|
||
[tool.poetry.group.dev.dependencies] | ||
pytest = "^7.4.3" | ||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
#! /bin/bash | ||
|
||
export $(cat .env|xargs) | ||
PYTHONPATH=src pytest tests $* |