Skip to content

Commit 8d84fb1

Browse files
authored
Poetry2 (#336)
1 parent 8422781 commit 8d84fb1

13 files changed

+117
-22
lines changed

.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.venv/

.github/workflows/build-and-publish.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Install pip dependencies
3030
if: steps.pip-cache.outputs.cache-hit != 'true'
3131
run: |
32-
pip install psycopg2 poetry proto-parser
32+
pip install psycopg2 'poetry<3.0.0' proto-parser
3333
3434
- name: Install poetry
3535
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'

.github/workflows/lint-test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
- name: Install pip dependencies
5555
if: steps.pip-cache.outputs.cache-hit != 'true'
5656
run: |
57-
pip install psycopg2 poetry
57+
pip install psycopg2 'poetry<3.0.0'
5858
5959
- name: Poetry install
6060
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'

.readthedocs.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ build:
88
post_create_environment:
99
# Install poetry
1010
# https://python-poetry.org/docs/#installing-manually
11-
- pip install poetry
11+
- pip install 'poetry<3.0.0'
1212
post_install:
1313
# Install dependencies with 'docs' dependency group
1414
# https://python-poetry.org/docs/managing-dependencies/#dependency-groups

Dockerfile

+5-3
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ RUN sed -i 's/^# *\(fr_FR.UTF-8\)/\1/' /etc/locale.gen
1212
RUN sed -i 's/^# *\(en_US.UTF-8\)/\1/' /etc/locale.gen
1313
RUN locale-gen
1414

15-
RUN pip install --no-cache-dir psycopg2 'poetry<2.0.0'
15+
RUN pip install --no-cache-dir psycopg2 'poetry<3.0.0'
1616

17-
RUN poetry config virtualenvs.create false
1817

1918
COPY pyproject.toml .
2019
COPY poetry.lock .
2120

2221

2322
FROM builder AS server
2423

25-
RUN poetry install
24+
COPY ./django_socio_grpc /opt/code/django_socio_grpc
25+
RUN poetry install --with dev
2626

2727
FROM builder AS docs
2828

@@ -31,5 +31,7 @@ RUN apt update \
3131
&& apt clean
3232

3333
COPY docs docs
34+
COPY ./django_socio_grpc /opt/code/django_socio_grpc
35+
RUN poetry config virtualenvs.create false
3436
RUN poetry install --with docs
3537
RUN cd docs && make html

django_socio_grpc/protobuf/tests/test_json_format.py renamed to django_socio_grpc/tests/protobuf/test_json_format.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
from django_socio_grpc.protobuf.json_format import message_to_dict
2-
from django_socio_grpc.protobuf.tests.protos import test_proto_pb2
2+
from django_socio_grpc.tests.protobuf.protos import test_proto_pb2
33

44

55
def test_message_to_dict_include_optional_not_one_of():
66
message = test_proto_pb2.MyMessage(string_field="test")
77

88
result = message_to_dict(message)
9-
assert len(result) == 2
9+
assert len(result) == 1
1010
assert result["string_field"] == "test"
11-
assert result["optional_string_field"] is None
11+
assert message.HasField("optional_string_field") is False
1212

1313
message = test_proto_pb2.MyMessage(string_field="test", optional_string_field="test")
1414

django_socio_grpc/tests/test_authentication.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ def test_resolve_user_with_multiple_authentications(self):
6565
dummy_service = DummyService()
6666
dummy_service.context = FakeContext()
6767
dummy_service.context.META = {"HTTP_AUTHORIZATION": "faketoken"}
68-
dummy_service.authentication_classes = [FakeNotHandlingAuthentication, FakeAuthentication]
68+
dummy_service.authentication_classes = [
69+
FakeNotHandlingAuthentication,
70+
FakeAuthentication,
71+
]
6972

7073
auth_user_tuple = dummy_service.resolve_user()
7174
self.assertEqual(auth_user_tuple, ({"email": "[email protected]"}, "faketoken"))

docker-compose.yml

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ services:
1919
- test-database
2020
volumes:
2121
- .:/opt/code
22+
- ./.venv:/opt/code/.venv:delegated
2223
- ./test_utils:/opt/code/test_utils
2324
# ports:
2425
# - "7000:80"

poetry.lock

+90-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
[project]
2-
requires-python = ">=3.10"
3-
4-
[tool.poetry]
52
name = "django-socio-grpc"
63
version = "0.1.1"
74
description = "Fork of django-grpc-framework with more feature maintained by the socio team. Make GRPC with django easy."
8-
authors = ["Adrien Montagu <[email protected]>"]
5+
authors = [
6+
{name = "Adrien Montagu ", email = "[email protected]"}
7+
]
98
license = "Apache-2.0"
9+
requires-python = ">=3.10"
10+
11+
[tool.poetry]
12+
packages = [
13+
{ include = "django_socio_grpc" },
14+
]
1015

1116
[tool.poetry.scripts]
1217
tests = "test_utils.load_tests:launch"
@@ -43,7 +48,7 @@ myst-parser = "^2.0.0"
4348
sphinx-autodoc2 = "^0.5"
4449

4550
[build-system]
46-
requires = ["poetry-core>=1.0.0,<2.0.0"]
51+
requires = ["poetry-core>=2.0.1,<3.0.0"]
4752
build-backend = "poetry.core.masonry.api"
4853

4954
[tool.ruff.lint.isort]

0 commit comments

Comments
 (0)