Skip to content
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

DM-38650: Adopt safir.redis and safir.github modules #50

Merged
merged 21 commits into from
Apr 19, 2023

Conversation

jonathansick
Copy link
Member

@jonathansick jonathansick commented Apr 13, 2023

  • Adopt safir.redis.pydantic for Redis-backed storage.
  • Adopt safir.github creating the GitHub App client and modelling of GitHub resources with Pydantic.
  • Fix handling of disabled pages so that they aren't executed in a GitHub check, and are dropped if they previously existed in the database.
  • Refactor the GitHub service into the timessquare.services.githubrepo module.
  • Update to Python 3.11

Moves all configuration to pyproject.toml, except for .flake8 because
flake8 doesn't use pyproject.toml
The updated mypy found more potential issues, so this update fixes them.
This is required by current versions of FastAPI/Starlette.
The base class, RedisPageInstanceStorage, now adds the functionality
of adding the page instance's key; it's a direct subclass of
PydanticRedisStorage.

NbHtmlCacheStorage and NoteburstJobStore both subclass
RedisPageInstanceStorage.

Add types-redis to support type checking of the redis package.
This makes the uvicorn logging more consistent with app logs.
The GitHubAppClientFactory from safir.github is the new version of the
timessquare.services.github.client module, and also includes the ability
to set up an installation client for a repo.
Now if the sidecar for a notebook marks a page as disabled, the page
won't be executed and if it already existed, it'll be marked for
soft-deletion.
Use safir.github.webhooks for webhook payloads and safir.github.models
for the GitHub REST API resources. The githubcheckrun, githubcheckout,
and githubtree models persist because they reflect internal models
(but they're related to github concepts)
We already covered disabling an existing page; this second path is to
ensure a disable page isn't created in the first place.
Previously it was in services, but this did make sense because these
aren't "services." Instead, it makes sense to treat the gidgethub router
as a request handler, so now we're co-locating it with the external API
handler since it's the external_router that gets the webhook events
originally from GitHub.
This avoids the handlers.xyz.handlers naming phenomenon and is more
specific about the role of the module.
Now that there aren't additional items in services.github, it makes
sense to move the repo module into the root of the services subpackage
and rename as githubrepo to match the class name.
@jonathansick jonathansick marked this pull request as ready for review April 19, 2023 17:22
@jonathansick jonathansick merged commit 2ffb96e into main Apr 19, 2023
2 checks passed
@jonathansick jonathansick deleted the tickets/DM-38650 branch April 19, 2023 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant