Skip to content

Conversation

@plietar
Copy link
Member

@plietar plietar commented Oct 31, 2025

We replaced GitHub authentication in Packit with a native device flow authentication. Instead of authenticating against GitHub and then trading a GitHub PAT for a Packit token, pyorderly can now authenticate directly against Packit.

This simplifies the implementation and allows us to login to Packit instances that do not use GitHub authentication (such as Montagu).

This flow has been in use in the R orderly package for a while now and is working quite well.

@plietar
Copy link
Member Author

plietar commented Oct 31, 2025

You can test against the live Packit server with the following:

from pyorderly.outpack.location import *
loc = outpack_location_packit("https://reside-dev.packit-dev.dide.ic.ac.uk/")
print(loc.list())

See mrc-ide/orderly#218 for the R counterpart.

@@ -0,0 +1,136 @@
import time
Copy link
Member Author

Choose a reason for hiding this comment

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

This is almost identical to the existing version. Just moving it out because it is a very generic and standalone bit of code compared to the rest of location_packit.py.

The only difference is that I removed the scope parameter from authenticate() since we don't need it anymore.

@codecov
Copy link

codecov bot commented Oct 31, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.23%. Comparing base (f790f07) to head (e8127df).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #67   +/-   ##
=======================================
  Coverage   99.23%   99.23%           
=======================================
  Files          55       57    +2     
  Lines        4307     4326   +19     
  Branches      285      285           
=======================================
+ Hits         4274     4293   +19     
  Misses         18       18           
  Partials       15       15           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@EmmaLRussell EmmaLRussell left a comment

Choose a reason for hiding this comment

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

Works for me! Couple of tiny suggestions.

return {"Authorization": f"Bearer {token}"}
if token is not None:
if re.match("^gh._", token):
msg = "Using a GitHub token to login to Packit isn't supported anymore."

Choose a reason for hiding this comment

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

Might be nice to include the additional advice which is in the R: "Either use a Packit token or omit the token to use interactive authentication.."

Comment on lines +118 to +119
else:
interval = parameters.interval

Choose a reason for hiding this comment

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

Don't need this as already set interval on line 115?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch. I've removed the line 115 assignment.

Base automatically changed from fix-ruff to main November 6, 2025 11:27
We replaced GitHub authentication in Packit with a native device flow
authentication. Instead of authenticating against GitHub and then
trading a GitHub PAT for a Packit token, pyorderly can now authenticate
directly against Packit.

This simplifies the implementation and allows us to login to Packit
instances that do not use GitHub authentication (such as Montagu).

This flow has been in use in the R orderly package for a while now and
is working quite well.
@plietar plietar merged commit 919111e into main Nov 6, 2025
12 checks passed
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.

3 participants