Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdf18a4f

Browse files
authored
Use dynamic versioning (#15)
1 parent74f08bd commitdf18a4f

File tree

11 files changed

+38
-17
lines changed

11 files changed

+38
-17
lines changed

‎.gitignore‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,7 @@ localstack-pro-azure/tests/otherlangs/dotnet/*/obj
6363

6464
# setuptools_scm version.py
6565
*/*/*/*/version.py
66-
localstack-sdk-python-2/.openapi-generator/
66+
localstack-sdk-python-2/.openapi-generator/
67+
68+
# setuptools_scm version.py
69+
**/version.py

‎VERSION‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎bin/generate.sh‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
#!/bin/bash
22

3-
version=$(cat VERSION)
4-
53
docker run --rm -v"${PWD}:/local" openapitools/openapi-generator-cli:v7.10.0 generate \
64
-i https://raw.githubusercontent.com/localstack/openapi/refs/heads/main/openapi/emulators/localstack-spec-latest.yml \
75
--skip-validate-spec \
86
-g python \
97
-o /local//packages/localstack-sdk-generated \
108
--global-property models,apis,supportingFiles \
119
-p packageName=localstack.sdk \
12-
-p packageVersion=$version \
1310
--template-dir /local/packages/localstack-sdk-generated/templates \
1411
--global-property apiTests=false,modelTests=false \
1512
--global-property apiDocs=false,modelDocs=False

‎localstack-sdk-python/localstack/sdk/clients.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
fromlocalstack.sdkimportversion
12
fromlocalstack.sdk.api_clientimportApiClient
23
fromlocalstack.sdk.configurationimportConfiguration
34

@@ -30,3 +31,5 @@ def __init__(self, host: str | None = None, auth_token: str | None = None, **kwa
3031
self.auth_token=auth_token
3132
self.configuration=Configuration(host=self.host)
3233
self._api_client=ApiClient(configuration=self.configuration)
34+
# The generated code comes with 1.0.0 hard-coded. We set here the correct version
35+
self._api_client.user_agent=f"LocalStack SDK/{version.version}/python"

‎packages/localstack-sdk-generated/localstack/sdk/api_client.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def __init__(
9191
self.default_headers[header_name]=header_value
9292
self.cookie=cookie
9393
# Set default User-Agent.
94-
self.user_agent='OpenAPI-Generator/0.0.4/python'
94+
self.user_agent='OpenAPI-Generator/1.0.0/python'
9595
self.client_side_validation=configuration.client_side_validation
9696

9797
def__enter__(self):

‎packages/localstack-sdk-generated/localstack/sdk/configuration.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ def to_debug_report(self) -> str:
495495
"OS: {env}\n"\
496496
"Python Version: {pyversion}\n"\
497497
"Version of the API: latest\n"\
498-
"SDK Package Version:0.0.4".\
498+
"SDK Package Version:1.0.0".\
499499
format(env=sys.platform,pyversion=sys.version)
500500

501501
defget_host_settings(self)->List[HostSetting]:

‎packages/localstack-sdk-generated/pyproject.toml‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name ="localstack-sdk-generated"
3-
version ="0.0.4"
3+
dynamic =["version"]
44
description ="LocalStack REST API - Generated Code"
55
authors = [
66
{name ="LocalStack Contributors",email ="info@localstack.cloud" }
@@ -18,13 +18,17 @@ dev-dependencies = [
1818
]
1919

2020
[build-system]
21-
requires = ["setuptools"]
21+
requires = ["setuptools","setuptools_scm>=8"]
2222
build-backend ="setuptools.build_meta"
2323

24+
[tool.setuptools_scm]
25+
local_scheme ="no-local-version"
26+
root ="../.."
27+
2428
[tool.setuptools]
2529
package-dir = {"" ="."}
2630

2731
[tool.setuptools.packages.find]
2832
where = ["."]
2933
include = ["*"]
30-
exclude = ["tests*"]
34+
exclude = ["tests*"]

‎packages/localstack-sdk-generated/templates/pyproject.mustache‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "localstack-sdk-generated"
3-
version ="{{{packageVersion}}}"
3+
dynamic =["version"]
44
description = "LocalStack REST API - Generated Code"
55
authors = [
66
{ name ="LocalStack Contributors", email ="info@localstack.cloud"}
@@ -18,13 +18,17 @@ dev-dependencies = [
1818
]
1919

2020
[build-system]
21-
requires = ["setuptools"]
21+
requires = ["setuptools", "setuptools_scm>=8"]
2222
build-backend = "setuptools.build_meta"
2323

24+
[tool.setuptools_scm]
25+
local_scheme = "no-local-version"
26+
root = "../.."
27+
2428
[tool.setuptools]
2529
package-dir ={"" ="."}
2630

2731
[tool.setuptools.packages.find]
2832
where = ["."]
2933
include = ["*"]
30-
exclude = ["tests*"]
34+
exclude = ["tests*"]

‎pyproject.toml‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description = "Python SDK for LocalStack"
55
authors = [
66
{name ="LocalStack Team",email ="info@localstack.cloud"}
77
]
8-
version ="0.0.4"
8+
dynamic =["version"]
99
dependencies = [
1010
"localstack-sdk-generated"
1111
]
@@ -17,9 +17,13 @@ Repository = "https://github.com/localstack/localstack-sdk-python.git"
1717
Issues ="https://github.com/localstack/localstack-sdk-python/issues"
1818

1919
[build-system]
20-
requires = ["setuptools>=64"]
20+
requires = ["setuptools>=64","setuptools_scm>=8"]
2121
build-backend ="setuptools.build_meta"
2222

23+
[tool.setuptools_scm]
24+
version_file ="localstack-sdk-python/localstack/sdk/version.py"
25+
local_scheme ="no-local-version"
26+
2327
[tool.setuptools.dynamic]
2428
readme = {file = ["README.md"],content-type ="text/markdown"}
2529

@@ -30,6 +34,8 @@ dev-dependencies=[
3034
"boto3>=1.35.40",
3135
]
3236

37+
cache-keys = [{file ="pyproject.toml" }, {git = {commit =true ,tags =true }}]
38+
3339
[tool.uv.sources]
3440
localstack-sdk-generated = {workspace =true }
3541

‎tests/test_client.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
importlocalstack.sdk.aws
2+
fromlocalstack.sdkimportversion
3+
4+
5+
deftest_client_version():
6+
client=localstack.sdk.aws.AWSClient()
7+
assertversion.versioninclient._api_client.user_agent

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp