Skip to content

Commit

Permalink
Update to Poetry 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
johnthagen committed Jan 9, 2025
1 parent 35be74f commit 676d077
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
branches: [main]

env:
POETRY_VERSION: "1.8.4"
POETRY_VERSION: "2.0.0"
PYTHON_VERSION: "3.11"

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: python
on: [push, pull_request]

env:
POETRY_VERSION: "1.8.4"
POETRY_VERSION: "2.0.0"
PYTHON_VERSION: "3.11"

jobs:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
FROM python:3.11-slim-bookworm AS python_builder

# Pin Poetry to a specific version to make Docker builds reproducible.
ENV POETRY_VERSION=1.8.4
ENV POETRY_VERSION=2.0.0

# Set ENV variables that make Python more friendly to running inside a container.
ENV PYTHONDONTWRITEBYTECODE=1
Expand Down
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,8 @@ all machines that use the project, both during development and in production.

To install all dependencies into an isolated virtual environment:

> [!TIP]
> Append `--sync` to uninstall dependencies that are no longer in use from the virtual environment.
```bash
$ poetry install
$ poetry sync
```

To [activate](https://python-poetry.org/docs/basic-usage#activating-the-virtual-environment) the
Expand Down Expand Up @@ -107,7 +104,7 @@ environments and run commands based on [`noxfile.py`](./noxfile.py) for unit tes
guide checking, type checking and documentation generation.

> [!NOTE]
> `nox` is installed into the virtual environment automatically by the `poetry install` command
> `nox` is installed into the virtual environment automatically by the `poetry sync` command
> above. Run `poetry shell` to activate the virtual environment.
To run all default sessions:
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pipx install poetry
Then install the `fact` package and its dependencies:

```bash
poetry install
poetry sync
```

Activate the virtual environment created automatically by Poetry:
Expand Down
79 changes: 75 additions & 4 deletions poetry.lock

Large diffs are not rendered by default.

40 changes: 25 additions & 15 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
[tool.poetry]
[project]
name = "fact"
version = "1.0.0"
description = "Example Python project using best practices"
authors = ["John Hagen <johnthagen@users.noreply.github.com>"]
authors = [
{ name = "John Hagen", email = "johnthagen@users.noreply.github.com" }]
license = "MIT"
readme = "README.md"
repository = "https://github.com/johnthagen/python-blueprint"
documentation = "https://johnthagen.github.io/python-blueprint/"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
Expand All @@ -24,17 +23,31 @@ classifiers = [
# https://pypi.org/classifiers/
"Private :: Do Not Upload",
]
# For non-package/wheel application projects (e.g., FastAPI or Django app), you can omit the
# metadata above and replace it with:
# package-mode = false

[tool.poetry.dependencies]
# Some packages, such as scipy, constrain their upper bound of Python versions they support.
# Without also constraining the upper bound here, Poetry will not select those versions and will
# result in an old version being resolved/locked.
python = "^3.9, <3.14"
rich = "*"
typer-slim = { version = "*", extras = ["standard"] }
requires-python = ">=3.9, <3.14"
dependencies = [
"rich",
"typer-slim[standard]"
]

[project.urls]
Homepage = "https://github.com/johnthagen/python-blueprint"
Documentation = "https://johnthagen.github.io/python-blueprint/"
Repository = "https://github.com/johnthagen/python-blueprint"

[project.scripts]
fact = "fact.cli:app"

[tool.poetry]
requires-poetry = ">=2.0"
# For non-package/wheel application projects (e.g., FastAPI or Django app), you can omit the
# package metadata above and replace it with:
# package-mode = false

[tool.poetry.requires-plugins]
poetry-plugin-export = ">=1.8"

[tool.poetry.group.nox.dependencies]
nox-poetry = "*"
Expand Down Expand Up @@ -63,9 +76,6 @@ mkdocstrings = { version = "*", extras = ["python"] }
mkdocs-gen-files = "*"
mkdocs-literate-nav = "*"

[tool.poetry.scripts]
fact = "fact.cli:app"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
Expand Down

0 comments on commit 676d077

Please sign in to comment.