Skip to content
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

Update to Poetry 1.2 #121

Merged
merged 14 commits into from
Sep 18, 2022
Merged
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: docker
name: container

on: [push, pull_request]

Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,21 @@ on:
push:
branches: [master]

env:
POETRY_VERSION: 1.2.1

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
run: pipx install poetry==${POETRY_VERSION}
- uses: actions/setup-python@v4
with:
python-version: "3.9"
cache: "poetry"
- name: Install all dependencies, including Nox
run: poetry install
cache: poetry
- name: Install Nox and doc dependencies
run: poetry install --only nox,docs
- name: Publish Docs
run: poetry run nox -s docs_github_pages
24 changes: 16 additions & 8 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: python

on: [push, pull_request]

env:
POETRY_VERSION: 1.2.1

jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -11,32 +14,37 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
run: pipx install poetry==${POETRY_VERSION}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# https://github.com/actions/setup-python#caching-packages-dependencies
cache: poetry
- name: Install all dependencies, including Nox
run: poetry install
- name: Install Nox
run: poetry install --only nox
- name: Test with Nox
run: poetry run nox -s test-${{ matrix.python-version }}
quality:
runs-on: ubuntu-latest
strategy:
matrix:
nox-session: [ "fmt_check", "lint", "type_check", "docs" ]
job:
- { nox-session: fmt_check, poetry-groups: "fmt" }
- { nox-session: lint, poetry-groups: "lint" }
# type_check needs main dependencies for inline type annotations.
- { nox-session: type_check, poetry-groups: "main,type_check" }
- { nox-session: docs, poetry-groups: "docs" }
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
run: pipx install poetry==${POETRY_VERSION}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
cache: poetry
- name: Install all dependencies, including Nox
run: poetry install
- name: Install Nox and group dependencies
run: poetry install --only nox,${{ matrix.job.poetry-groups }}
- name: Test with Nox
run: poetry run nox -s ${{ matrix.nox-session }}
run: poetry run nox -s ${{ matrix.job.nox-session }}
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
FROM python:3.9-slim-bullseye AS python_builder

# Pin Poetry to a specific version to make Docker builds reproducible.
ENV POETRY_VERSION 1.1.14
ENV POETRY_VERSION 1.2.1

# Set ENV variables that make Python more friendly to running inside a container.
ENV PYTHONDONTWRITEBYTECODE 1
Expand Down Expand Up @@ -48,7 +48,7 @@ COPY pyproject.toml poetry.lock ./
# Don't install the package itself with Poetry because it will install it as an editable install.
# TODO: Improve this when non-editable `poetry install` is supported in Poetry.
# https://github.com/python-poetry/poetry/issues/1382
RUN poetry install --no-root --no-dev
RUN poetry install --only main --no-root

# Copy in source files.
COPY README.md ./
Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ all machines that use the project, both during development and in production.

To install all dependencies into an isolated virtual environment:

> Append `--remove-untracked` to uninstall dependencies that are no longer in use from the virtual
> environment.
> Append `--sync` to uninstall dependencies that are no longer in use from the virtual environment.

```bash
$ poetry install
Expand Down Expand Up @@ -375,7 +374,7 @@ using [pip-licenses](https://github.com/raimon49/pip-licenses):
typer 0.4.1 MIT License
```

# Docker
# Container

[Docker](https://www.docker.com/) is a tool that allows for software to be packaged into isolated
containers. It is not necessary to use Docker in a Python project, but for the purposes of
Expand All @@ -388,7 +387,7 @@ Docker is configured in:
- [`Dockerfile`](./Dockerfile)
- [`.dockerignore`](./.dockerignore)

To build the Docker image:
To build the container image:

```bash
$ docker build --tag fact .
Expand Down Expand Up @@ -437,7 +436,7 @@ sudo apt install python3.10

[`pipdeptree`](https://github.com/tox-dev/pipdeptree) is a utility for displaying installed
packages in the form of a dependency tree. For large projects, it is often difficult to
determine dependency relationships soley from `poetry.lock`.
determine dependency relationships soley from manually inspecting `poetry.lock`.

# PyCharm Configuration

Expand Down
Loading