Skip to content

Commit 6316d4c

Browse files
testing & linting improvement
1 parent 8866900 commit 6316d4c

File tree

24 files changed

+106
-102
lines changed

24 files changed

+106
-102
lines changed

Makefile

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,32 @@ SERVICES_DIR := services
22

33
install:
44
# install core
5-
pip install core
5+
pip install core/
66
# install services
77
@for f in $(shell ls ${SERVICES_DIR}); do pip install ${SERVICES_DIR}/$${f}; done
88

9-
install-dev:
10-
# install core
11-
pip install -e core && poetry install -C core --only dev --no-root
9+
install-dev:
1210
# install services
13-
@for f in $(shell ls ${SERVICES_DIR}); do pip install -e ${SERVICES_DIR}/$${f};poetry install -C ${SERVICES_DIR}/$${f} --only dev --no-root; done
11+
@for f in $(shell ls ${SERVICES_DIR}); do set -e;poetry install -C ${SERVICES_DIR}/$${f} --no-root;pip install -e ${SERVICES_DIR}/$${f}; done
12+
# install core. This needs to be done last or it will get overriden by the dependency installation of the services
13+
poetry install -C core --no-root; pip install -e core
1414

1515
test:
1616
# test core
17-
cd core && pytest && cd ..
17+
cd core && poetry install --with dev && pytest
1818
# test services
19-
@for f in $(shell ls ${SERVICES_DIR}); do set -e; cd ${SERVICES_DIR}/$${f}; sh -c 'pytest || ([ $$? = 5 ] && exit 0 || exit $$?)'; cd ../..; done
19+
@for f in $(shell ls ${SERVICES_DIR}); do set -e; cd ${SERVICES_DIR}/$${f}; poetry install --with dev;sh -c 'pytest || ([ $$? = 5 ] && exit 0 || exit $$?)'; cd ../..; done
2020

21-
lint:
22-
# lint examples
23-
flake8 --toml-config $(word 1, $(wildcard $(SERVICES_DIR)/*))/pyproject.toml --black-config $(word 1, $(wildcard $(SERVICES_DIR)/*))/pyproject.toml examples;
21+
lint:
2422
# lint core
23+
cd core && poetry install --no-root --only dev &&flake8 .
24+
# lint examples. Use configuration from core
2525
flake8 --toml-config core/pyproject.toml --black-config core/pyproject.toml examples;
2626
# lint services
27-
@for f in $(shell ls ${SERVICES_DIR}); do set -e; cd ${SERVICES_DIR}/$${f};flake8 .; cd ../..; done
27+
@for f in $(shell ls ${SERVICES_DIR}); do set -e; cd ${SERVICES_DIR}/$${f};poetry install --no-root --only dev; flake8 .; cd ../..; done
2828

29-
lock:
29+
update-dependencies:
3030
# lock core
31-
cd core;poetry lock --no-update;cd..;
31+
cd core && poetry lock
3232
# lock services
33-
@for f in $(shell ls ${SERVICES_DIR}); do set -e; cd ${SERVICES_DIR}/$${f};poetry lock --no-update; cd ../..; done
33+
@for f in $(shell ls ${SERVICES_DIR}); do set -e; cd ${SERVICES_DIR}/$${f};poetry lock; cd ../..; done

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,7 @@ If you encounter any issues or have suggestions for improvements, please open an
158158
## Contribute
159159

160160
### Installing in editable mode
161-
For developing it is recommended to install `poetry`, which can be installed via:
162-
```bash
163-
pip install poetry
161+
For developing it is recommended to install [`poetry`](https://python-poetry.org/). An installation guide can be found [here](https://python-poetry.org/docs/#installation).
164162

165163
For development it is best to install the packages in editable mode.
166164
You can install a single package in editable mode using the following command:
@@ -181,6 +179,9 @@ If you want to install all services in editable mode, as well as the dev-depende
181179
```bash
182180
make install-dev
183181
```
182+
When using the `make install-dev` command it is important to prevent `poetry` from creating a different environment for every package.
183+
This can be achieved by running `poetry config virtualenvs.create false`, but there are multiple way to achieve this, it is best to consult the [poetry docs](https://python-poetry.org/docs/configuration/) to see which option fits best for you.
184+
184185
## License
185186

186187
Apache 2.0

core/pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ requests = ">=2.32.3"
2828
[tool.poetry.group.dev.dependencies]
2929
black = ">=24.8.0"
3030
pytest = ">=8.3.3"
31-
flake8 = ">=5.0.3"
31+
flake8 = [
32+
{ version= ">=5.0.3", python="<3.12"},
33+
{ version= ">=6.0.1", python=">=3.12"}
34+
]
3235
flake8-black = ">=0.3.6"
3336
flake8-pyproject = ">=1.2.3"
3437
flake8-quotes = ">=3.4.0"

services/dns/pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ packages = [
1818

1919
[tool.poetry.dependencies]
2020
python = ">=3.8,<4.0"
21-
stackit-core = "^0.0.1a"
22-
requests = "^2.32.3"
23-
pydantic = "^2.9.2"
24-
python-dateutil = "^2.9.0.post0"
21+
stackit-core = ">=0.0.1a"
22+
requests = ">=2.32.3"
23+
pydantic = ">=2.9.2"
24+
python-dateutil = ">=2.9.0.post0"
2525

2626
[tool.poetry.group.dev.dependencies]
2727
black = ">=24.8.0"

services/iaas/pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ packages = [
1818

1919
[tool.poetry.dependencies]
2020
python = ">=3.8,<4.0"
21-
stackit-core = "^0.0.1a"
22-
requests = "^2.32.3"
23-
pydantic = "^2.9.2"
24-
python-dateutil = "^2.9.0.post0"
21+
stackit-core = ">=0.0.1a"
22+
requests = ">=2.32.3"
23+
pydantic = ">=2.9.2"
24+
python-dateutil = ">=2.9.0.post0"
2525

2626
[tool.poetry.group.dev.dependencies]
2727
black = ">=24.8.0"

services/iaasalpha/pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ packages = [
1818

1919
[tool.poetry.dependencies]
2020
python = ">=3.8,<4.0"
21-
stackit-core = "^0.0.1a"
22-
requests = "^2.32.3"
23-
pydantic = "^2.9.2"
24-
python-dateutil = "^2.9.0.post0"
21+
stackit-core = ">=0.0.1a"
22+
requests = ">=2.32.3"
23+
pydantic = ">=2.9.2"
24+
python-dateutil = ">=2.9.0.post0"
2525

2626
[tool.poetry.group.dev.dependencies]
2727
black = ">=24.8.0"

services/loadbalancer/pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ packages = [
1818

1919
[tool.poetry.dependencies]
2020
python = ">=3.8,<4.0"
21-
stackit-core = "^0.0.1a"
22-
requests = "^2.32.3"
23-
pydantic = "^2.9.2"
24-
python-dateutil = "^2.9.0.post0"
21+
stackit-core = ">=0.0.1a"
22+
requests = ">=2.32.3"
23+
pydantic = ">=2.9.2"
24+
python-dateutil = ">=2.9.0.post0"
2525

2626
[tool.poetry.group.dev.dependencies]
2727
black = ">=24.8.0"

services/logme/pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ packages = [
1818

1919
[tool.poetry.dependencies]
2020
python = ">=3.8,<4.0"
21-
stackit-core = "^0.0.1a"
22-
requests = "^2.32.3"
23-
pydantic = "^2.9.2"
24-
python-dateutil = "^2.9.0.post0"
21+
stackit-core = ">=0.0.1a"
22+
requests = ">=2.32.3"
23+
pydantic = ">=2.9.2"
24+
python-dateutil = ">=2.9.0.post0"
2525

2626
[tool.poetry.group.dev.dependencies]
2727
black = ">=24.8.0"

services/mariadb/pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ packages = [
1818

1919
[tool.poetry.dependencies]
2020
python = ">=3.8,<4.0"
21-
stackit-core = "^0.0.1a"
22-
requests = "^2.32.3"
23-
pydantic = "^2.9.2"
24-
python-dateutil = "^2.9.0.post0"
21+
stackit-core = ">=0.0.1a"
22+
requests = ">=2.32.3"
23+
pydantic = ">=2.9.2"
24+
python-dateutil = ">=2.9.0.post0"
2525

2626
[tool.poetry.group.dev.dependencies]
2727
black = ">=24.8.0"

services/mongodbflex/pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ packages = [
1818

1919
[tool.poetry.dependencies]
2020
python = ">=3.8,<4.0"
21-
stackit-core = "^0.0.1a"
22-
requests = "^2.32.3"
23-
pydantic = "^2.9.2"
24-
python-dateutil = "^2.9.0.post0"
21+
stackit-core = ">=0.0.1a"
22+
requests = ">=2.32.3"
23+
pydantic = ">=2.9.2"
24+
python-dateutil = ">=2.9.0.post0"
2525

2626
[tool.poetry.group.dev.dependencies]
2727
black = ">=24.8.0"

0 commit comments

Comments
 (0)