Skip to content

Commit 5a090fe

Browse files
committed
LITE-26463: added poetry and mkdocs
1 parent dfb0a46 commit 5a090fe

File tree

158 files changed

+3315
-1297
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

158 files changed

+3315
-1297
lines changed

.github/workflows/build.yml

+53-29
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,32 @@ on:
1111

1212
jobs:
1313
build_3_8_9_10_11_django_3_2:
14-
name: Build on Python 3.8, 3.9, 3.10, 3.11 django 3.2
14+
name: Build on Python ${{ matrix.python-version }} and django 3.2
1515
runs-on: ubuntu-latest
1616
strategy:
1717
matrix:
18-
python-version: ['3.8', '3.9', '3.10', '3.11']
18+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
1919
steps:
2020
- name: Checkout
21-
uses: actions/checkout@v2
21+
uses: actions/checkout@v3
2222
with:
2323
fetch-depth: 0
2424
- name: Set up Python ${{ matrix.python-version }}
25-
uses: actions/setup-python@v2
25+
uses: actions/setup-python@v4
2626
with:
2727
python-version: ${{ matrix.python-version }}
2828
- name: Install dependencies
2929
run: |
3030
python -m pip install --upgrade pip
31-
pip install -r requirements/dev.txt
32-
pip install -r requirements/test.txt
33-
pip install pytest-cov
34-
pip install django==3.2.*
31+
pip install poetry
32+
poetry install
33+
poetry run pip install django==3.2.*
3534
- name: Linting
3635
run: |
37-
flake8
36+
poetry run flake8
3837
- name: Testing
3938
run: |
40-
python setup.py test
39+
poetry run pytest
4140
build_3_10_django_4_0:
4241
name: Build on Python 3.10 django 4.0
4342
runs-on: ubuntu-latest
@@ -46,52 +45,77 @@ jobs:
4645
python-version: ['3.10']
4746
steps:
4847
- name: Checkout
49-
uses: actions/checkout@v2
48+
uses: actions/checkout@v3
5049
with:
5150
fetch-depth: 0
5251
- name: Set up Python ${{ matrix.python-version }}
53-
uses: actions/setup-python@v2
52+
uses: actions/setup-python@v4
5453
with:
5554
python-version: ${{ matrix.python-version }}
5655
- name: Install dependencies
5756
run: |
5857
python -m pip install --upgrade pip
59-
pip install -r requirements/dev.txt
60-
pip install -r requirements/test.txt
61-
pip install pytest-cov
62-
pip install django==4.0.*
58+
pip install poetry
59+
poetry install
60+
poetry run pip install django==4.0.*
6361
- name: Linting
6462
run: |
65-
flake8
63+
poetry run flake8
6664
- name: Testing
6765
run: |
68-
python setup.py test
66+
poetry run pytest
67+
build_3_10_django_4_1:
68+
name: Build on Python 3.10 django 4.1
69+
runs-on: ubuntu-latest
70+
strategy:
71+
matrix:
72+
python-version: ['3.10']
73+
steps:
74+
- name: Checkout
75+
uses: actions/checkout@v3
76+
with:
77+
fetch-depth: 0
78+
- name: Set up Python ${{ matrix.python-version }}
79+
uses: actions/setup-python@v4
80+
with:
81+
python-version: ${{ matrix.python-version }}
82+
- name: Install dependencies
83+
run: |
84+
python -m pip install --upgrade pip
85+
pip install poetry
86+
poetry install
87+
poetry run pip install django==4.1.*
88+
- name: Linting
89+
run: |
90+
poetry run flake8
91+
- name: Testing
92+
run: |
93+
poetry run pytest
6994
sonar:
7095
name: Sonar Checks
71-
needs: [build_3_8_9_10_11_django_3_2, build_3_10_django_4_0]
96+
needs: [build_3_8_9_10_11_django_3_2, build_3_10_django_4_0, build_3_10_django_4_1]
7297
runs-on: ubuntu-latest
7398
steps:
7499
- name: Checkout
75-
uses: actions/checkout@v2
100+
uses: actions/checkout@v3
76101
with:
77102
fetch-depth: 0
78103
- name: Set up Python '3.10'
79-
uses: actions/setup-python@v2
104+
uses: actions/setup-python@v4
80105
with:
81106
python-version: '3.10'
82107
- name: Install dependencies
83108
run: |
84109
python -m pip install --upgrade pip
85-
pip install -r requirements/dev.txt
86-
pip install -r requirements/test.txt
87-
pip install pytest-cov
88-
pip install django==4.0.*
110+
pip install poetry
111+
poetry install
112+
poetry run pip install django==4.0.*
89113
- name: Testing
90114
run: |
91-
python setup.py test
115+
poetry run pytest
92116
- name: Fix coverage report for Sonar
93117
run: |
94-
sed -i 's/\/home\/runner\/work\/django-cqrs\/django-cqrs\//\/github\/workspace\//g' coverage.xml
118+
sed -i 's/\/home\/runner\/work\/django-cqrs\/django-cqrs\//\/github\/workspace\//g' ./tests/reports/coverage.xml
95119
- name: SonarCloud
96120
uses: SonarSource/sonarcloud-github-action@master
97121
env:
@@ -112,11 +136,11 @@ jobs:
112136
runs-on: ubuntu-latest
113137
steps:
114138
- name: Checkout
115-
uses: actions/checkout@v2
139+
uses: actions/checkout@v3
116140
with:
117141
fetch-depth: 0
118142
- name: Set up Python '3.10'
119-
uses: actions/setup-python@v2
143+
uses: actions/setup-python@v4
120144
with:
121145
python-version: '3.10'
122146
- name: Integration tests

.github/workflows/publish.yml

+19-12
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,25 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout
13-
uses: actions/checkout@v2
13+
uses: actions/checkout@v3
1414
with:
1515
fetch-depth: 0
1616
- name: Set up Python 3.8
17-
uses: actions/setup-python@v2
17+
uses: actions/setup-python@v4
1818
with:
19-
python-version: 3.8
19+
python-version: '3.8'
2020
- name: Install dependencies
2121
run: |
2222
python -m pip install --upgrade pip
23-
pip install -r requirements/dev.txt
24-
pip install -r requirements/test.txt
25-
pip install pytest-cov
26-
pip install django==3.2.*
23+
pip install poetry
24+
poetry install
25+
poetry run pip install django==3.2.*
2726
- name: Linting
2827
run: |
29-
flake8
28+
poetry run flake8
3029
- name: Testing
3130
run: |
32-
python setup.py test
31+
poetry run pytest
3332
- name: Fix coverage report for Sonar
3433
run: |
3534
sed -i 's/\/home\/runner\/work\/django-cqrs\/django-cqrs\//\/github\/workspace\//g' coverage.xml
@@ -47,11 +46,19 @@ jobs:
4746
timeout-minutes: 5
4847
env:
4948
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
49+
- name: Extract tag name
50+
uses: actions/github-script@v6
51+
id: tag
52+
with:
53+
github-token: ${{ secrets.GITHUB_TOKEN }}
54+
result-encoding: string
55+
script: |
56+
return context.payload.ref.replace(/refs\/tags\//, '')
5057
- name: Publish
5158
env:
5259
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
5360
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
5461
run: |
55-
pip install twine
56-
python setup.py sdist
57-
twine upload dist/*
62+
poetry version ${{ steps.tag.outputs.result }}
63+
poetry build
64+
poetry publish -u $TWINE_USERNAME -p $TWINE_PASSWORD

.readthedocs.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Required
2+
version: 2
3+
4+
build:
5+
os: ubuntu-20.04
6+
tools:
7+
python: "3.9"
8+
9+
mkdocs:
10+
configuration: mkdocs.yml
11+
12+
python:
13+
install:
14+
- requirements: requirements/docs.txt
15+
- method: pip
16+
path: .

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
same "printed page" as the copyright notice for easier
188188
identification within third-party archives.
189189

190-
Copyright 2020 Ingram Micro Inc. All rights reserved.
190+
Copyright 2023 Ingram Micro Inc. All rights reserved.
191191

192192
Licensed under the Apache License, Version 2.0 (the "License");
193193
you may not use this file except in compliance with the License.

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ kubectl exec -i REPLICA_CONTAINER -- python manage.py cqrs_deleted_diff_replica
209209
Development
210210
===========
211211

212-
1. Python 3.7 +
212+
1. Python >= 3.7
213213
2. Install dependencies `requirements/dev.txt`
214214
3. We use `isort` library to order and format our imports, and we check it using `flake8-isort` library (automatically on `flake8` run).
215215
For convenience you may run `isort .` to order imports.
@@ -220,7 +220,7 @@ Testing
220220

221221
Unit testing
222222
------
223-
1. Python 3.7 +
223+
1. Python >= 3.7
224224
2. Install dependencies `requirements/test.txt`
225225
3. `export PYTHONPATH=/your/path/to/django-cqrs/`
226226

@@ -243,5 +243,5 @@ To generate HTML coverage reports use:
243243
Integrational testing
244244
------
245245
1. docker-compose
246-
0. `cd integration_tests`
247-
0. `docker-compose run master`
246+
2. `cd integration_tests`
247+
3. `docker-compose run master`

dj_cqrs/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright © 2021 Ingram Micro Inc. All rights reserved.
1+
# Copyright © 2023 Ingram Micro Inc. All rights reserved.
22

33
import django # pragma: no cover
44

dj_cqrs/_validation.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright © 2022 Ingram Micro Inc. All rights reserved.
1+
# Copyright © 2023 Ingram Micro Inc. All rights reserved.
22

33
import logging
44
from inspect import getfullargspec, isfunction

dj_cqrs/admin.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright © 2021 Ingram Micro Inc. All rights reserved.
1+
# Copyright © 2023 Ingram Micro Inc. All rights reserved.
22

33
from django.utils.translation import gettext_lazy
44

@@ -22,17 +22,22 @@ def _cqrs_sync_queryset(self, queryset):
2222
"""
2323
This function is used to adjust the QuerySet before sending the sync signal.
2424
25-
:param queryset: Original queryset
26-
:type queryset: Queryset
27-
:return: Updated queryset
28-
:rtype: Queryset
25+
Args:
26+
queryset (Queryset): Original queryset.
27+
28+
Returns:
29+
(Queryset): Updated queryset.
2930
"""
3031
return queryset
3132

3233
def sync_items(self, request, queryset):
3334
"""
3435
This method synchronizes selected items from the Admin Page.
3536
It is registered as a custom action in Django Admin
37+
38+
Args:
39+
request (Request): Original request.
40+
queryset (Queryset): Original queryset.
3641
"""
3742
items_not_synced = []
3843
for item in self._cqrs_sync_queryset(queryset):

dj_cqrs/apps.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright © 2021 Ingram Micro Inc. All rights reserved.
1+
# Copyright © 2023 Ingram Micro Inc. All rights reserved.
22

33
from django.apps import AppConfig
44
from django.conf import settings

dj_cqrs/constants.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright © 2021 Ingram Micro Inc. All rights reserved.
1+
# Copyright © 2023 Ingram Micro Inc. All rights reserved.
22

33
ALL_BASIC_FIELDS = '__all__'
44

dj_cqrs/controller/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# Copyright © 2020 Ingram Micro Inc. All rights reserved.
1+
# Copyright © 2023 Ingram Micro Inc. All rights reserved.

dj_cqrs/controller/consumer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright © 2022 Ingram Micro Inc. All rights reserved.
1+
# Copyright © 2023 Ingram Micro Inc. All rights reserved.
22

33
import copy
44
import logging

dj_cqrs/controller/producer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright © 2020 Ingram Micro Inc. All rights reserved.
1+
# Copyright © 2023 Ingram Micro Inc. All rights reserved.
22

33
from dj_cqrs.transport import current_transport
44

dj_cqrs/correlation.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright © 2021 Ingram Micro Inc. All rights reserved.
1+
# Copyright © 2023 Ingram Micro Inc. All rights reserved.
22

33
from django.conf import settings
44

0 commit comments

Comments
 (0)