Skip to content

Commit

Permalink
Move to a poetry 2.0 compatible format (#253)
Browse files Browse the repository at this point in the history
* Move to a poetry 2.0 compatible format

* Update Poetry

* Fix test issues

* Add dev deps

* Update poetry

* poetry lock

* Update Makefile

* Update Dockerfile

* Update Dockerfile

* Udpate verison number

* Package mode = false

* Package mode = false

* As recommended on https://python-poetry.org/docs/main/faq/#migrate-pep621-new-static
  • Loading branch information
Ash-Crow authored Jan 21, 2025
1 parent d0bab59 commit df849ea
Show file tree
Hide file tree
Showing 9 changed files with 431 additions and 328 deletions.
2 changes: 1 addition & 1 deletion .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ DATABASE_USER=dju
DATABASE_PASSWORD=djpwd
DATABASE_HOST=127.0.0.1
DATABASE_PORT=5432
DEBUG=True
DEBUG=False
DATABASE_URL=postgres://${DATABASE_USER}:${DATABASE_PASSWORD}@${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_NAME}
2 changes: 1 addition & 1 deletion .github/workflows/ci-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
python -m pip install --upgrade pip
pip install poetry
pip install ruff
poetry install --no-root
poetry install --no-root --with dev
- name: 📄 Copy empty .env.test to .env
run: |
cp .env.test .env
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.10
FROM python:3.13

EXPOSE ${CONTAINER_PORT}

Expand All @@ -8,7 +8,7 @@ ENV GECKODRIVER_URL=https://github.com/mozilla/geckodriver/releases/download/v0.
ENV APP_DIR="/app"

# Configure Poetry
ENV POETRY_VERSION=1.8.2
ENV POETRY_VERSION=2.0.1
ENV POETRY_HOME=/opt/poetry
ENV POETRY_VENV=/opt/poetry-venv
ENV POETRY_CACHE_DIR=/opt/.cache
Expand All @@ -32,7 +32,7 @@ ENV PATH="${PATH}:${POETRY_VENV}/bin"
WORKDIR $APP_DIR

COPY pyproject.toml poetry.lock ./
RUN poetry install
RUN poetry install --no-root

COPY --chown=app:app . .

Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ index:

.PHONY: init
init:
$(EXEC_CMD) poetry install --without dev
$(EXEC_CMD) poetry install --no-root --without dev
$(EXEC_CMD) poetry run python manage.py migrate
make collectstatic
$(EXEC_CMD) poetry run python manage.py set_config
Expand All @@ -56,13 +56,13 @@ init:
.PHONY: init-dev
init-dev:
make init
$(EXEC_CMD) poetry install
$(EXEC_CMD) poetry install --no-root
$(EXEC_CMD) poetry run pre-commit install


.PHONY: update
update:
$(EXEC_CMD) poetry install --without dev
$(EXEC_CMD) poetry install --no-root --without dev
$(EXEC_CMD) poetry run python manage.py migrate
make collectstatic
$(EXEC_CMD) poetry run python manage.py import_dsfr_pictograms
Expand Down
2 changes: 0 additions & 2 deletions blog/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,4 @@ def test_deep_blog_works(self):
self.assertPageIsRenderable(new_blog_post)

response = self.client.get(deep_blog_index_page.url + "rss/")
print(deep_blog_index_page.url + "rss/")
print(response)
self.assertEqual(response.status_code, 200)
2 changes: 0 additions & 2 deletions content_manager/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -757,8 +757,6 @@ def enlarge_link(self):
if len(call_to_action):
enlarge = False
elif len(tags):
print(tags)
print(tags.raw_data)
tags_list = tags.raw_data
for tag in tags_list:
if (
Expand Down
6 changes: 4 additions & 2 deletions content_manager/management/commands/import_dsfr_pictograms.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ def handle(self, *args, **kwargs):
image_exists = Image.objects.filter(title=full_image_title).first()
if image_exists:
file_hash = image_exists.get_file_hash()
print(f"A file named {full_image_title} already exists, skipping (file_hash: {file_hash})")
self.stdout.write(
f"A file named {full_image_title} already exists, skipping (file_hash: {file_hash})"
)
else:
image = import_image(
full_path=os.path.join(folder_path, filename),
Expand All @@ -49,4 +51,4 @@ def handle(self, *args, **kwargs):
image.tags.add("DSFR")
image.tags.add("Pictogrammes")
image.tags.add(folder_title)
print(f"File {full_image_title} imported")
self.stdout.write(f"File {full_image_title} imported")
668 changes: 386 additions & 282 deletions poetry.lock

Large diffs are not rendered by default.

65 changes: 33 additions & 32 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,42 +1,43 @@
[project]
requires-python = ">=3.10"

[tool.poetry]
name = "content-manager"
version = "1.11.1"
name = "sites-faciles"
requires-python = "<4.0,>=3.10"
version = "1.11.2"
description = "Gestionnaire de contenu permettant de créer et gérer un site internet basé sur le Système de design de l’État, accessible et responsive"
authors = [
"Sébastien Reuiller <[email protected]>",
"Sylvain Boissel <[email protected]>",
{name = "Sébastien Reuiller", email = "[email protected]"},
{name = "Sylvain Boissel", email = "[email protected]"}
]
maintainers = [
"Sylvain Boissel <[email protected]>",
{name = "Sylvain Boissel", email = "[email protected]"}
]
readme = "README.md"
dependencies = [
"django<6.0.0,>=5.1.4",
"wagtail<7.0,>=6.1",
"django-dsfr<2.0.0,>=1.1.2",
"psycopg2-binary<3.0.0,>=2.9.9",
"python-dotenv<2.0.0,>=1.0.0",
"dj-database-url<3.0.0,>=2.1.0",
"gunicorn<23.0.0,>=22.0.0",
"django-sass-processor<2.0,>=1.3",
"libsass<1.0.0,>=0.22.0",
"dj-static<1.0.0,>=0.0.6",
"wagtailmenus<5.0,>=4.0",
"wagtail-modeladmin<3.0.0,>=2.0.0",
"wagtail-markdown<1.0.0,>=0.11.1",
"unidecode<2.0.0,>=1.3.8",
"django-storages[s3]<2.0.0,>=1.14.2",
"boto3<2.0.0,>=1.34.56",
"beautifulsoup4<5.0.0,>=4.12.3",
"django-taggit<6.0.0,>=5.0.1",
"wagtail-localize<2.0,>=1.9",
"icalendar<6.0.0,>=5.0.13",
"faker<25.0.0,>=24.3.0",
]

[tool.poetry.dependencies]
python = "^3.10"
django = "^5.1.4"
wagtail = "^6.1"
django-dsfr = "^1.1.2"
psycopg2-binary = "^2.9.9"
python-dotenv = "^1.0.0"
dj-database-url = "^2.1.0"
gunicorn = "^22.0.0"
django-sass-processor = "^1.3"
libsass = "^0.22.0"
dj-static = "^0.0.6"
wagtailmenus = "^4.0"
wagtail-modeladmin = "^2.0.0"
wagtail-markdown = "^0.11.1"
unidecode = "^1.3.8"
django-storages = {extras = ["s3"], version = "^1.14.2"}
boto3 = "^1.34.56"
beautifulsoup4 = "^4.12.3"
django-taggit = "^5.0.1"
wagtail-localize = "^1.9"
icalendar = "^5.0.13"
faker = "^24.3.0"
[tool.poetry]
requires-poetry = ">=2.0"
package-mode = false

[tool.poetry.group.dev.dependencies]
black = "^24.3.0"
Expand All @@ -51,7 +52,7 @@ django-debug-toolbar = "^4.4.2"
ruff = "^0.4.10"

[build-system]
requires = ["poetry-core"]
requires = ["poetry-core>=2.0.0,<3.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.black]
Expand Down

0 comments on commit df849ea

Please sign in to comment.