Skip to content

feat: prepare for publishing #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
33 changes: 33 additions & 0 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CD Workflow

on:
push:
tags:
- "services/[a-zA-Z]+/v[0-9]+.[0-9]+.[0-9]+"
- "services/[a-zA-Z]+/v[0-9]+.[0-9]+.[0-9]+-*"
workflow_dispatch:

jobs:
main:
name: Build & Publish module
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Extract updated module path
env:
TAG: ${{ github.event.ref }}
run: |
TAG_NO_PREFIX=$(echo "$TAG" | sed 's/^refs\/tags\///')
SERVICE_PATH=$(echo "$TAG_NO_PREFIX" | rev | cut -d'/' -f2- | rev)
echo "SERVICE_PATH=$SERVICE_PATH" >> $GITHUB_ENV
- name: Build & Publish to PyPi
uses: JRubics/poetry-publish@v2.0
with:
pypi_token: ${{ secrets.PYPI_TOKEN }}
poetry_publish_options: "--build"
package_directory: $SERVICE_PATH
7 changes: 5 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ jobs:
path: 'python-core'
- name: Install Python SDK Core
working-directory: 'python-core'
run: make install
run: make install
- name: Install
run: make install-dev
run: |
pip install poetry
poetry config virtualenvs.create false
make install-dev
- name: Lint
run: make lint
- name: Test
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ install:
@for f in $(shell ls ${SERVICES_DIR}); do pip install ${SERVICES_DIR}/$${f}; done

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

test:
@for f in $(shell ls ${SERVICES_DIR}); do set -e; cd ${SERVICES_DIR}/$${f}; sh -c 'pytest || ([ $$? = 5 ] && exit 0 || exit $$?)'; cd ../..; done
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ This allows you to use any services that the SDK offers.


## Installation from source
For an installation from source `poetry` is required.
It can be installed with the following command:
```bash
pip install poetry
```

You can also install the packages from source by replacing the package-name by the path to the code.
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:
In order to install the code from source you have to execute the following code:
```bash
pip install services/<service-name>
```
Expand Down
3 changes: 2 additions & 1 deletion examples/iaas/example_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from stackit.iaas.models.create_network_payload import CreateNetworkPayload
from stackit.iaas.models.network_range import NetworkRange
from stackit.iaas.models.boot_volume import BootVolume
from stackit.iaas.models.allowed_addresses_inner import AllowedAddressesInner
from stackit.iaas.models.boot_volume_source import BootVolumeSource
from stackit.iaas.models.create_nic_payload import CreateNICPayload
from stackit.iaas.models.create_public_ip_payload import CreatePublicIPPayload
Expand Down Expand Up @@ -81,7 +82,7 @@
project_id,
network.network_id,
CreateNICPayload(
allowed_addresses=["192.0.2.0/24"],
allowed_addresses=[AllowedAddressesInner("192.0.2.0/24")],
security_groups=[security_group1_groupid],
),
)
Expand Down
1,117 changes: 1,117 additions & 0 deletions services/authorization/poetry.lock

Large diffs are not rendered by default.

66 changes: 39 additions & 27 deletions services/authorization/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,48 +1,60 @@
[project]
[tool.poetry]
name = "stackit-authorization"
version = "1.0.0"
version = "0.0.1"
authors = [
{ name="OpenAPI Generator Community", email="team@openapitools.org" },
"OpenAPI Generator Community <team@openapitools.org>",
]
description = "STACKIT Membership API"
#readme = "README.md"
#license = "NoLicense"
requires-python = ">=3.8"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
]
dependencies = [
"requests ~= 2.32.3",
"python_dateutil ~= 2.5.3",
"pydantic ~= 2.9.2",
"stackit-core ~= 0.0.1",
packages = [
{ include = "stackit", from="src" }
]

[project.optional-dependencies]
dev = [
"black >= 24.8.0",
"pytest ~= 8.3.2",
"flake8 ~= 7.1.0",
"flake8-black ~= 0.3.6",
"flake8-pyproject ~= 1.2.3",
"flake8-quotes ~= 3.4.0",
"flake8-bandit ~= 4.1.1",
"flake8-bugbear ~= 24.8.19",
"flake8-eradicate ~= 1.5.0",
"flake8-eol ~= 0.0.8",
"autoimport ~= 1.6.1",
"isort ~= 5.13.2",
[tool.poetry.dependencies]
python = ">=3.8,<4.0"
stackit-core = "^0.0.1"
requests = "^2.32.3"
pydantic = "^2.9.2"
python-dateutil = "^2.9.0.post0"

[tool.poetry.group.dev.dependencies]
black = ">=24.8.0"
pytest = ">=8.3.3"
flake8 = [
{ version= ">=5.0.3", python="<3.12"},
{ version= ">=6.0.1", python=">=3.12"}
]
flake8-black = ">=0.3.6"
flake8-pyproject = ">=1.2.3"
autoimport = ">=1.6.1"
flake8-eol = ">=0.0.8"
flake8-eradicate = ">=1.5.0"
flake8-bandit = ">=4.1.1"
flake8-bugbear = ">=23.1.14"
flake8-quotes = ">=3.4.0"
isort = ">=5.13.2"

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

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
requires = ["setuptools", "poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.pytest.ini_options]
pythonpath = [
"src"
]
testpaths = [
"tests"
]

[tool.black]
line-length = 120
Expand Down Expand Up @@ -85,9 +97,9 @@ per-file-ignores = """
./tests/*: S101,
# F841: some variables get generated but may not be used, depending on the api-spec
# E501: long descriptions/string values might lead to lines that are too long
./stackit/*/models/*: F841,E501
./src/stackit/*/models/*: F841,E501
# F841: some variables get generated but may not be used, depending on the api-spec
# E501: long descriptions/string values might lead to lines that are too long
# B028: stacklevel for deprecation warning is irrelevant
./stackit/*/api/default_api.py: F841,B028,E501
./src/stackit/*/api/default_api.py: F841,B028,E501
"""
Loading
Loading