-
Notifications
You must be signed in to change notification settings - Fork 0
feat(repo): Added Python and TypeScript packages for RFC 9457 Problem Details #1
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
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c985679
feat(repo): add python and typescript implementations
frankkilcommins f72deac
additional tests for conformance. CI and release actions
frankkilcommins 4c5c879
fix(python): make FastAPI a lazy optional dependency
char0n 94f0b4f
fix(license): align Python package license with repo (Apache-2.0)
char0n 1f6a365
fix(typescript): use ESM-compatible path resolution and remove unused…
char0n 4c7ec43
fix(typescript): handle malformed JSON in ProblemDetailError.fromResp…
char0n b86f04d
fix: use standard HTTP phrase "Unprocessable Content" for 422 title
char0n 8df27e4
fix(typescript): differentiate isProblemDetail and isErrorItem type g…
char0n 12373c7
fix(python): remove unused HttpUrl import from models
char0n 768f5f5
fix(typescript): replace hand-rolled YAML parser with yaml package
char0n 8c100c5
fix(python): source __version__ from package metadata
char0n 08cf64d
fix(docs): add missing Request import in README FastAPI example
char0n 03cf521
chore: remove duplicate python/.gitignore
char0n 50dc5ad
feat(python): add py.typed marker for PEP 561
char0n File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| python: | ||
| name: Python ${{ matrix.python-version }} | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| python-version: ["3.11", "3.12", "3.13"] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v5 | ||
| with: | ||
| enable-cache: true | ||
|
|
||
| - name: Install dependencies | ||
| working-directory: python | ||
| run: | | ||
| uv pip install --system -e ".[dev]" | ||
|
|
||
| - name: Run tests | ||
| working-directory: python | ||
| run: | | ||
| pytest tests/ -v --cov=jentic.problem_details --cov-report=term-missing | ||
|
|
||
| typescript: | ||
| name: TypeScript | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| cache: 'npm' | ||
| cache-dependency-path: typescript/package-lock.json | ||
|
|
||
| - name: Install dependencies | ||
| working-directory: typescript | ||
| run: npm ci | ||
|
|
||
| - name: Build | ||
| working-directory: typescript | ||
| run: npm run build | ||
|
|
||
| - name: Run tests | ||
| working-directory: typescript | ||
| run: npm test | ||
|
|
||
| - name: Type check | ||
| working-directory: typescript | ||
| run: npm run typecheck |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| version: | ||
| description: 'Version to release (e.g., 1.0.0)' | ||
| required: true | ||
| type: string | ||
|
|
||
| concurrency: release | ||
|
|
||
| jobs: | ||
| release: | ||
| name: Release packages | ||
| runs-on: ubuntu-latest | ||
| if: github.ref == 'refs/heads/main' | ||
| environment: | ||
| name: npm-release | ||
| url: https://www.npmjs.com/org/jentic | ||
| permissions: | ||
| contents: write | ||
| id-token: write # Required for PyPI OIDC and NPM provenance | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.12' | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v5 | ||
|
|
||
| - name: Set up Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| registry-url: 'https://registry.npmjs.org' | ||
|
|
||
| - name: Configure Git | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
|
|
||
| - name: Update Python package version | ||
| working-directory: python | ||
| run: | | ||
| sed -i 's/^version = .*/version = "${{ inputs.version }}"/' pyproject.toml | ||
|
|
||
| - name: Update TypeScript package version | ||
| working-directory: typescript | ||
| run: | | ||
| npm version ${{ inputs.version }} --no-git-tag-version | ||
|
|
||
| - name: Commit version changes and create tag | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| git add python/pyproject.toml typescript/package.json typescript/package-lock.json | ||
| git commit -m "chore: release v${{ inputs.version }}" | ||
| git tag -a "v${{ inputs.version }}" -m "Release v${{ inputs.version }}" | ||
| git push origin main --tags | ||
|
|
||
| - name: Install Python dependencies and build | ||
| working-directory: python | ||
| run: | | ||
| uv pip install --system build | ||
| python -m build | ||
|
|
||
| - name: Build TypeScript package | ||
| working-directory: typescript | ||
| run: | | ||
| npm ci | ||
| npm run build | ||
|
|
||
| - name: Prepare release artifacts | ||
| run: | | ||
| mkdir -p release-assets | ||
| cp python/dist/* release-assets/ | ||
|
|
||
| echo "📦 Release artifacts:" | ||
| ls -la release-assets/ | ||
|
|
||
| - name: Create GitHub Release | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| echo "🚀 Creating GitHub release..." | ||
| VERSION="${{ inputs.version }}" | ||
|
|
||
| # Try to extract changelog for this version | ||
| CHANGELOG_CONTENT="$(sed -n '/^## v'$VERSION'/,/^## /p' CHANGELOG.md 2>/dev/null | sed '$d')" | ||
|
|
||
| if [ -z "$CHANGELOG_CONTENT" ]; then | ||
| CHANGELOG_CONTENT="Release v$VERSION" | ||
| fi | ||
|
|
||
| gh release create "v$VERSION" \ | ||
| --title "v$VERSION" \ | ||
| --notes "$CHANGELOG_CONTENT" \ | ||
| release-assets/* | ||
|
|
||
| - name: Publish Python package to PyPI | ||
| id: pypi_publish | ||
| continue-on-error: true # TODO: Remove after Trusted Publisher is configured on PyPI | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||
| with: | ||
| packages-dir: python/dist/ | ||
| attestations: false | ||
|
|
||
| - name: Publish TypeScript package to NPM | ||
| id: npm_publish | ||
| working-directory: typescript | ||
| run: npm publish --access public --provenance | ||
|
|
||
| - name: Release Summary | ||
| run: | | ||
| echo "🎉 RELEASE COMPLETED" | ||
| echo "Released version: ${{ inputs.version }}" | ||
| echo "" | ||
| if [ "${{ steps.pypi_publish.outcome }}" == "success" ]; then | ||
| echo "Published to PyPI: ✓" | ||
| else | ||
| echo "Published to PyPI: ⚠️ SKIPPED (Trusted Publisher not configured yet)" | ||
| fi | ||
| echo "Published to NPM: ✓" | ||
| echo "GitHub release created: ✓" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| # Python | ||
| __pycache__/ | ||
| *.py[cod] | ||
| *$py.class | ||
| *.so | ||
| .Python | ||
| build/ | ||
| develop-eggs/ | ||
| dist/ | ||
| downloads/ | ||
| eggs/ | ||
| .eggs/ | ||
| lib/ | ||
| lib64/ | ||
| parts/ | ||
| sdist/ | ||
| var/ | ||
| wheels/ | ||
| *.egg-info/ | ||
| .installed.cfg | ||
| *.egg | ||
| MANIFEST | ||
|
|
||
| # Virtual environments | ||
| venv/ | ||
| ENV/ | ||
| env/ | ||
| .venv/ | ||
|
|
||
| # Testing | ||
| .pytest_cache/ | ||
| .coverage | ||
| htmlcov/ | ||
| .tox/ | ||
| coverage/ | ||
| .hypothesis/ | ||
|
|
||
| # TypeScript/JavaScript | ||
| node_modules/ | ||
| dist/ | ||
| *.tsbuildinfo | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
| .pnpm-debug.log* | ||
|
|
||
| # IDEs | ||
| .vscode/ | ||
| .idea/ | ||
| *.swp | ||
| *.swo | ||
| *.sublime-project | ||
| *.sublime-workspace | ||
|
|
||
| # OS | ||
| .DS_Store | ||
| .DS_Store? | ||
| ._* | ||
| .Spotlight-V100 | ||
| .Trashes | ||
| ehthumbs.db | ||
| Thumbs.db | ||
|
|
||
| # Type checking | ||
| .mypy_cache/ | ||
| .dmypy.json | ||
| dmypy.json | ||
| .pytype/ | ||
|
|
||
| # Build outputs | ||
| *.log |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.