-
Notifications
You must be signed in to change notification settings - Fork 963
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
Sync PSF sponsors with logo placement API #10766
Sync PSF sponsors with logo placement API #10766
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just some small comments
I ask reviewers to leave instructions on the new unit tests. I feel that the tests are complex due to pretend and also I feel that probably there's a clever way to mock the task request object.
Tests look good to me, I think your request fixture is fine.
warehouse/sponsors/__init__.py
Outdated
@@ -22,3 +24,8 @@ def _sponsors(request): | |||
def includeme(config): | |||
# Add a request method which will allow to list sponsors | |||
config.add_request_method(_sponsors, name="sponsors", reify=True) | |||
|
|||
# Add a periodic task to update sponsors table | |||
config.add_periodic_task( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to wrap this in a conditional to check if pythondotorg.api_token
is set, then "unconfigure" it in dev. Mostly since I'm going to suggest we run this hourly to reduce the delay for new sponsors and confusion from PSF staff.
35c1b7e
to
d9b7ed3
Compare
* Add new config variables to integrate with pythondotorg * Add new fields with data from pythondotorg logo placement API * Register task to update sponsors table * Code linter * Fix typo * Minimal working code to integrate with logo palcement endpoint * First unit test to figure out how to mock requests * Create a new sponsor * Add logic to update existing sponsors * Reformat code * Leave HTTP vs HTTPS configuration to be handle by env variable * Fix linter errors * Create sponsor directly from the exception handler * Run task every 10 minutes * There's no need for the if condition * Only schedule cron job if there's a token in the env * Remove pythondotorg env variables from dev * Run linter Co-authored-by: Ee Durbin <ewdurbin@gmail.com>
This PR adds a new scheduled task to keep Pypi's database in sync with Python.org logo placements API. It's scheduled to run every sunday at 03:00 AM. The goal of this work is to centralize sponsors management at pythondotorg and, thus, reduce any type of duplicated work on Pypi side. It also opens the possibility to replace our logo placement by integration with EthicalAds, the same way we did on pythondotorg.
This PR does not handle sidebar, footer, one time or infra structure sponsors. It only operates on top of PSF ones.
I ask reviewers to leave instructions on the new unit tests. I feel that the tests are complex due to
pretend
and also I feel that probably there's a clever way to mock the task request object.cc/ @ewdurbin