Skip to content

KEH-2655 - PyJWT Migration - #35

Draft
TotalDwarf03 wants to merge 7 commits into
mainfrom
KEH-2655-PyJWT-migration
Draft

TotalDwarf03 wants to merge 7 commits into
mainfrom
KEH-2655-PyJWT-migration

Conversation

@TotalDwarf03

@TotalDwarf03 TotalDwarf03 commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Overview

This PR migrates the package to use pyjwt instead of jwt. This is due to conflicts with our MS Teams Alerts package which uses pyjwt.

In addition, this PR also brings the repository up to modern KEH spec, using our team template and other Python packages (i.e. Policy Methods Library) as a guide.

This PR is a fairly big refactor so will be released as a major version.

Testing

  • CI should pass.
  • Follow README instructions to verify package functionality using manual_testing.py.

Checklist

  • I have reviewed the changes in this pull request
  • I have tested the changes locally
  • I have updated/created any relevant documentation
  • I have updated/created any relevant tests
  • I have added any necessary labels to this pull request
  • I have assigned myself to this pull request
  • I have assigned the appropriate reviewers to this pull request

Exemptions

Additional Notes

@TotalDwarf03 TotalDwarf03 self-assigned this Sep 29, 2026
@TotalDwarf03 TotalDwarf03 added the enhancement New feature or request label Sep 29, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

HTTP error handling and several CI, documentation, and linter configurations remain functionally incorrect.

Review effort: Balanced
Findings: 9 Medium severity

Open (9)
What changed in this PR

Migrates authentication from jwt to PyJWT while modernising packaging, documentation, testing, and CI/CD infrastructure.

Changes:

  • Splits authentication, REST, and GraphQL clients into a src package layout.
  • Adds Poetry configuration and broader automated tests.
  • Introduces updated documentation, linting, release, and deployment workflows.
File Description
src/​github_api_toolkit/​__init__.py Exposes the public API.
src/​github_api_toolkit/​auth.py Implements PyJWT authentication.
src/​github_api_toolkit/​graphql.py Refactors the GraphQL client.
src/​github_api_toolkit/​rest.py Extracts the REST client.
tests/​test_github_interface.py Adds REST client tests.
tests/​test_github_graphql_interface.py Adds GraphQL client tests.
tests/​test_get_token_as_installation.py Tests PyJWT token generation.
tests/​test_get_codeowners_from_text.py Reformats CODEOWNERS tests.
tests/​manual_testing.py Adds manual integration testing.
tests/​__init__.py Updates test-package commentary.
pyproject.toml Defines Poetry packaging and dependencies.
setup.py Removes legacy setuptools configuration.
requirements.txt Removes legacy dependency pins.
Makefile Adds development automation targets.
.python-version Selects Python 3.12.
README.md Documents setup, usage, and development.
mkdocs.yml Updates documentation configuration.
mkdocs_requirements.txt Removes legacy documentation dependencies.
docs/​index.md Refreshes the documentation landing page.
docs/​documentation.md Updates documentation setup instructions.
docs/​testing.md Removes the standalone testing guide.
docs/​reference/​get_token_as_installation.md Retains authentication API reference.
docs/​reference/​github_interface.md Retains REST API reference.
docs/​reference/​github_graphql_interface.md Retains GraphQL API reference.
docs/​example_use_cases/​getting_a_repository_owner.md Corrects example formatting.
.github/​workflows/​ci-test.yml Adds unit-test CI.
.github/​workflows/​ci-fmt.yml Adds Python linting CI.
.github/​workflows/​ci-docs.yml Adds documentation CI.
.github/​workflows/​deploy-docs.yml Adds documentation deployment.
.github/​workflows/​deploy_mkdocs.yml Removes the legacy deployment workflow.
.github/​workflows/​publish-release.yml Adds package release automation.
.github/​workflows/​mega-linter.yml Adds MegaLinter CI.
.mega-linter.yml Configures MegaLinter.
.markdownlint.yaml Configures Markdownlint.
.gitignore Replaces ignored-file rules.
.github/​pull_request_template.md Modernises the PR template.
.github/​CODEOWNERS Updates repository ownership.
LICENSE Updates the copyright year.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/ci-docs.yml
Comment thread .github/workflows/ci-docs.yml
Comment thread .github/workflows/ci-fmt.yml
Comment thread .github/workflows/ci-test.yml
Comment thread .github/workflows/deploy-docs.yml
Comment thread .github/workflows/mega-linter.yml
Comment thread .mega-linter.yml
Comment thread src/github_api_toolkit/auth.py
Comment on lines +32 to +36
except requests.exceptions.ConnectionError as errc:
return errc
except requests.exceptions.Timeout as errt:
return errt
except requests.exceptions.RequestException as err:

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants