diff --git a/.codespellignore b/.codespellignore new file mode 100644 index 0000000..4d75c60 --- /dev/null +++ b/.codespellignore @@ -0,0 +1,4 @@ +mor +tok +fpan +dpan diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 0000000..102b38d --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,31 @@ +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Lint + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + - uses: pre-commit/action@v3.0.1 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2874c4a --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +node_modules/ +.ruff_cache/ +__pycache__/ +.venv/ +*.py[cod] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..84ce949 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,48 @@ +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +exclude: '^(\.github/|\.vscode/|node_modules/).*|CODE_OF_CONDUCT\.md|CHANGELOG\.md' + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v6.0.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + args: [--unsafe] + - id: check-json + - id: check-added-large-files + - id: check-shebang-scripts-are-executable + - id: check-executables-have-shebangs + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.14.13 + hooks: + - id: ruff + args: [--fix, --exit-non-zero-on-fix, --ignore, "D,E501"] + - id: ruff-format + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v4.0.0-alpha.8 + hooks: + - id: prettier + files: \.(md|yaml|yml|json)$ + - repo: https://github.com/koalaman/shellcheck-precommit + rev: v0.10.0 + hooks: + - id: shellcheck + - repo: https://github.com/codespell-project/codespell + rev: v2.4.1 + hooks: + - id: codespell + args: ["-I", ".codespellignore"] diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..fb0e95d --- /dev/null +++ b/.prettierrc @@ -0,0 +1,19 @@ +{ + "tabWidth": 2, + "useTabs": false, + "trailingComma": "es5", + "bracketSameLine": true, + "overrides": [ + { + "files": "*.md", + "options": { + "tabWidth": 4, + "useTabs": false, + "trailingComma": "es5", + "endOfLine": "lf", + "printWidth": 80, + "proseWrap": "always" + } + } + ] +} diff --git a/README.md b/README.md index 6a04f4b..aecbcf6 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,8 @@ This repository contains the Python SDK for the [Universal Commerce Protocol (UCP)](https://ucp.dev). It provides Pydantic -models for UCP schemas, making it easy to build UCP-compliant applications -in Python. +models for UCP schemas, making it easy to build UCP-compliant applications in +Python. ## Installation @@ -69,7 +69,9 @@ The generated code is automatically formatted using `ruff`. ## Contributing -We welcome community contributions. See our [Contribution Guide](https://github.com/Universal-Commerce-Protocol/.github/blob/main/CONTRIBUTING.md) for details. +We welcome community contributions. See our +[Contribution Guide](https://github.com/Universal-Commerce-Protocol/.github/blob/main/CONTRIBUTING.md) +for details. ## License