Skip to content

Commit 9ddeba2

Browse files
authored
feat: prepare for publishing (#37)
1 parent 43826ea commit 9ddeba2

File tree

1,031 files changed

+33610
-4211
lines changed

Some content is hidden

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

1,031 files changed

+33610
-4211
lines changed

.github/workflows/cd.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CD Workflow
2+
3+
on:
4+
push:
5+
tags:
6+
- "services/[a-zA-Z]+/v[0-9]+.[0-9]+.[0-9]+"
7+
- "services/[a-zA-Z]+/v[0-9]+.[0-9]+.[0-9]+-*"
8+
workflow_dispatch:
9+
10+
jobs:
11+
main:
12+
name: Build & Publish module
13+
runs-on: "ubuntu-latest"
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
- name: Install Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: "3.8"
21+
- name: Extract updated module path
22+
env:
23+
TAG: ${{ github.event.ref }}
24+
run: |
25+
# Remove the `refs/tags` prefix of the git tag
26+
TAG_NO_PREFIX=$(echo "$TAG" | sed 's/^refs\/tags\///')
27+
# Extract the path of the module to publish from the tag
28+
SERVICE_PATH=$(echo "$TAG_NO_PREFIX" | rev | cut -d'/' -f2- | rev)
29+
# Save the path to the module for use in the build/publish step to only update the module associated with this tag
30+
echo "SERVICE_PATH=$SERVICE_PATH" >> $GITHUB_ENV
31+
- name: Build & Publish to PyPi
32+
uses: JRubics/poetry-publish@v2.0
33+
with:
34+
pypi_token: ${{ secrets.PYPI_TOKEN }}
35+
poetry_publish_options: "--build"
36+
package_directory: $SERVICE_PATH

.github/workflows/ci.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ jobs:
2424
path: 'python-core'
2525
- name: Install Python SDK Core
2626
working-directory: 'python-core'
27-
run: make install
27+
run: make install
2828
- name: Install
29-
run: make install-dev
29+
run: |
30+
pip install poetry
31+
poetry config virtualenvs.create false
32+
make install-dev
3033
- name: Lint
3134
run: make lint
3235
- name: Test

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ install:
44
@for f in $(shell ls ${SERVICES_DIR}); do pip install ${SERVICES_DIR}/$${f}; done
55

66
install-dev:
7-
@for f in $(shell ls ${SERVICES_DIR}); do pip install -e ${SERVICES_DIR}/$${f}[dev]; done
7+
@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
88

99
test:
1010
@for f in $(shell ls ${SERVICES_DIR}); do set -e; cd ${SERVICES_DIR}/$${f}; sh -c 'pytest || ([ $$? = 5 ] && exit 0 || exit $$?)'; cd ../..; done

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,13 @@ This allows you to use any services that the SDK offers.
2929

3030

3131
## Installation from source
32+
For an installation from source `poetry` is required.
33+
It can be installed with the following command:
34+
```bash
35+
pip install poetry
36+
```
3237

33-
You can also install the packages from source by replacing the package-name by the path to the code.
34-
The path can be local, but can also point to a git-repository. For an installation using local code from the root folder of the repository this can look like the following:
38+
In order to install the code from source you have to execute the following code:
3539
```bash
3640
pip install services/<service-name>
3741
```

examples/iaas/example_setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from stackit.iaas.models.create_network_payload import CreateNetworkPayload
1010
from stackit.iaas.models.network_range import NetworkRange
1111
from stackit.iaas.models.boot_volume import BootVolume
12+
from stackit.iaas.models.allowed_addresses_inner import AllowedAddressesInner
1213
from stackit.iaas.models.boot_volume_source import BootVolumeSource
1314
from stackit.iaas.models.create_nic_payload import CreateNICPayload
1415
from stackit.iaas.models.create_public_ip_payload import CreatePublicIPPayload
@@ -81,7 +82,7 @@
8182
project_id,
8283
network.network_id,
8384
CreateNICPayload(
84-
allowed_addresses=["192.0.2.0/24"],
85+
allowed_addresses=[AllowedAddressesInner("192.0.2.0/24")],
8586
security_groups=[security_group1_groupid],
8687
),
8788
)

services/authorization/poetry.lock

Lines changed: 1117 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

services/authorization/pyproject.toml

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,60 @@
1-
[project]
1+
[tool.poetry]
22
name = "stackit-authorization"
3-
version = "1.0.0"
3+
version = "0.0.1"
44
authors = [
5-
{ name="OpenAPI Generator Community", email="team@openapitools.org" },
5+
"OpenAPI Generator Community <team@openapitools.org>",
66
]
77
description = "STACKIT Membership API"
88
#readme = "README.md"
99
#license = "NoLicense"
10-
requires-python = ">=3.8"
1110
classifiers = [
1211
"Programming Language :: Python :: 3",
1312
"License :: OSI Approved :: Apache Software License",
1413
"Operating System :: OS Independent",
1514
]
16-
dependencies = [
17-
"requests ~= 2.32.3",
18-
"python_dateutil ~= 2.5.3",
19-
"pydantic ~= 2.9.2",
20-
"stackit-core ~= 0.0.1",
15+
packages = [
16+
{ include = "stackit", from="src" }
2117
]
2218

23-
[project.optional-dependencies]
24-
dev = [
25-
"black >= 24.8.0",
26-
"pytest ~= 8.3.2",
27-
"flake8 ~= 7.1.0",
28-
"flake8-black ~= 0.3.6",
29-
"flake8-pyproject ~= 1.2.3",
30-
"flake8-quotes ~= 3.4.0",
31-
"flake8-bandit ~= 4.1.1",
32-
"flake8-bugbear ~= 24.8.19",
33-
"flake8-eradicate ~= 1.5.0",
34-
"flake8-eol ~= 0.0.8",
35-
"autoimport ~= 1.6.1",
36-
"isort ~= 5.13.2",
19+
[tool.poetry.dependencies]
20+
python = ">=3.8,<4.0"
21+
stackit-core = "^0.0.1"
22+
requests = "^2.32.3"
23+
pydantic = "^2.9.2"
24+
python-dateutil = "^2.9.0.post0"
25+
26+
[tool.poetry.group.dev.dependencies]
27+
black = ">=24.8.0"
28+
pytest = ">=8.3.3"
29+
flake8 = [
30+
{ version= ">=5.0.3", python="<3.12"},
31+
{ version= ">=6.0.1", python=">=3.12"}
3732
]
33+
flake8-black = ">=0.3.6"
34+
flake8-pyproject = ">=1.2.3"
35+
autoimport = ">=1.6.1"
36+
flake8-eol = ">=0.0.8"
37+
flake8-eradicate = ">=1.5.0"
38+
flake8-bandit = ">=4.1.1"
39+
flake8-bugbear = ">=23.1.14"
40+
flake8-quotes = ">=3.4.0"
41+
isort = ">=5.13.2"
3842

3943
[project.urls]
4044
Homepage = "https://github.com/stackitcloud/stackit-sdk-python"
4145
Issues = "https://github.com/stackitcloud/stackit-sdk-python/issues"
4246

4347
[build-system]
44-
requires = ["setuptools"]
45-
build-backend = "setuptools.build_meta"
48+
requires = ["setuptools", "poetry-core"]
49+
build-backend = "poetry.core.masonry.api"
50+
51+
[tool.pytest.ini_options]
52+
pythonpath = [
53+
"src"
54+
]
55+
testpaths = [
56+
"tests"
57+
]
4658

4759
[tool.black]
4860
line-length = 120
@@ -85,9 +97,9 @@ per-file-ignores = """
8597
./tests/*: S101,
8698
# F841: some variables get generated but may not be used, depending on the api-spec
8799
# E501: long descriptions/string values might lead to lines that are too long
88-
./stackit/*/models/*: F841,E501
100+
./src/stackit/*/models/*: F841,E501
89101
# F841: some variables get generated but may not be used, depending on the api-spec
90102
# E501: long descriptions/string values might lead to lines that are too long
91103
# B028: stacklevel for deprecation warning is irrelevant
92-
./stackit/*/api/default_api.py: F841,B028,E501
104+
./src/stackit/*/api/default_api.py: F841,B028,E501
93105
"""

0 commit comments

Comments
 (0)