Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/check-license.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: License Header Check

on:
pull_request:
paths:
- "**/*.py"
- "!clients/**"
- ".github/workflows/check-license.yml"
- ".licenserc.yaml"
push:
branches:
- develop
paths:
- "**/*.py"
- "!clients/**"
- ".github/workflows/check-license.yml"
- ".licenserc.yaml"

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
check-license-header:
name: Check License Header
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false

- name: Check license headers
uses: apache/skywalking-eyes/header@eddd8f193e5c1739a76dad4074f50ede635a19fe
with:
mode: check
65 changes: 65 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: CI

on:
pull_request:
paths:
- ".github/workflows/ci.yml"
- "Makefile"
- "packages/**"
- "pyproject.toml"
push:
branches:
- develop
- main
paths:
- ".github/workflows/ci.yml"
- "Makefile"
- "packages/**"
- "pyproject.toml"

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
ci:
name: Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.python-version == '3.15' }}
strategy:
fail-fast: false
matrix:
python-version: ["3.12", "3.13", "3.14", "3.14t", "3.15"]

steps:
- name: Checkout Repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false

- name: Install uv and set the Python version
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9
with:
python-version: ${{ matrix.python-version }}
activate-environment: true
enable-cache: true

- name: Setup workspace
run: |
make install

- name: Check python packages
if: ${{ matrix.python-version == '3.12' }}
run: |
make check-py

- name: Test python packages
run: |
make test-py

- name: Build python packages
run: |
make build-py
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ venv

# Caches
__pycache__/
.coverage
htmlcov/
.ruff_cache/
.pytest_cache/

Expand Down
18 changes: 18 additions & 0 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
header:
license:
spdx-id: Apache-2.0
copyright-owner: Amazon.com, Inc. or its affiliates.
content: |
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0

paths:
- "**/*.py"

paths-ignore:
- "clients/**"

language:
Python:
extensions:
- ".py"
22 changes: 21 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
DOCS_PORT ?= 8000
PYTHON_VERSION := 3.12

.PHONY: docs docs-serve docs-clean docs-install docs-lock venv
.PHONY: build-py check-py docs docs-serve docs-clean docs-install docs-lock \
install lint-py test-py venv

install:
uv sync --all-packages --all-extras
@printf "\n\nWorkspace initialized, please run:\n\033[36msource .venv/bin/activate\033[0m"

lint-py:
uv run ruff check packages --fix --config pyproject.toml
uv run ruff format packages --config pyproject.toml

check-py:
uv run ruff check packages --config pyproject.toml
uv run ruff format --check packages --config pyproject.toml
uv run pyright packages

test-py:
uv run pytest packages

build-py:
uv build --all-packages

venv:
uv venv --python $(PYTHON_VERSION)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "dependency",
"description": "Update STS credential resolution to use the new async client configuration API."
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,18 @@ async def get_identity(

async def _assume_role(self) -> AWSCredentialsIdentity:
from aws_sdk_sts.client import AsyncSTSClient
from aws_sdk_sts.config import Config
from aws_sdk_sts.config import AsyncSTSConfig
from aws_sdk_sts.models import AssumeRoleInput

if self._client is None:
overrides: dict[str, object] = {
"aws_credentials_identity_resolver": self._source_resolver,
"region": self._region,
}
if self._http_client is not None:
overrides["transport"] = self._http_client
self._client = AsyncSTSClient(
config=Config(
aws_credentials_identity_resolver=self._source_resolver,
region=self._region,
transport=self._http_client,
)
config=await AsyncSTSConfig.resolve(**overrides)
)

response = await self._client.assume_role(
Expand Down
55 changes: 55 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
[project]
name = "aws-sdk-python"
version = "0.1.0"
description = "AWS SDK for Python"
readme = "README.md"
requires-python = ">=3.12"
dependencies = []

[dependency-groups]
test = [
"pytest>=9.0.3",
"pytest-asyncio>=0.25.3",
"pytest-cov>=6.0.0",
"freezegun>=1.5.1",
]
lint = [
"ruff>=0.9.7",
]
typing = [
"pyright>=1.1.400",
]

[tool.uv]
required-version = ">=0.7.2"
package = false
default-groups = ["test", "lint", "typing"]

[tool.uv.workspace]
members = ["packages/*"]

[tool.pyright]
typeCheckingMode = "strict"
enableExperimentalFeatures = true
# TODO: Remove once generated clients ship a py.typed marker.
reportMissingTypeStubs = false

[tool.pytest.ini_options]
asyncio_mode = "auto" # makes pytest run async tests without having to be marked with the @pytest.mark.asyncio decorator
addopts = [ "--import-mode=importlib", "--cov", "--cov-report=term-missing" ]
consider_namespace_packages = true

[tool.ruff]
target-version = "py312"

[tool.ruff.lint]
select = [ "ASYNC", "C4", "E1", "E4", "E7", "E9", "F", "FURB", "G", "I", "LOG", "PIE", "RUF", "S", "T", "UP" ]

[tool.ruff.lint.isort]
classes = ["URI"]

[tool.ruff.lint.per-file-ignores]
"**/{tests}/*" = ["S"]

[tool.ruff.format]
docstring-code-format = true
3 changes: 3 additions & 0 deletions scripts/docs/generate_all_doc_stubs.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0

"""
Generate documentation stubs for all AWS SDK Python clients.

Expand Down
3 changes: 3 additions & 0 deletions scripts/docs/generate_nav.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0

# scripts/docs/generate_nav.py
"""
Generate client documentation navigation dynamically.
Expand Down
3 changes: 3 additions & 0 deletions scripts/docs/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0

"""Utilities for reading service metadata from Smithy models."""

import json
Expand Down
Loading