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

Enable Python 3.12 #153

Merged
merged 8 commits into from
Mar 25, 2024
Merged

Enable Python 3.12 #153

merged 8 commits into from
Mar 25, 2024

Conversation

Scienfitz
Copy link
Collaborator

@Scienfitz Scienfitz commented Feb 28, 2024

(Written by Adrian) Enables Python 3.12 and fixes a bug with the validation converter, which also happens to fix the cattrs issue that originally blocked this PR (see details in PR comment).

@Scienfitz Scienfitz added the enhancement Expand / change existing functionality label Feb 28, 2024
@Scienfitz Scienfitz self-assigned this Feb 28, 2024
@AdrianSosic
Copy link
Collaborator

Hi @Scienfitz, it took me one afternoon of debugging, but I eventually found the issue. Turned out it has nothing to do with cattrs (as far as I can tell) but is related to how Protocols are handled in Python 3.12, which causes and unintended fallback dispatch to our RecommenderProtocol. The issue is quite delicate and there are many unlucky things coming together (e.g., the validation then succeeds because for that class additional keywords are currently dropped, which is another open problem in our code for which we already have a longstanding TODO). Anyway, here the link to an issue I've posted that recreates the problem in form of a minimal example: python-attrs/cattrs#525

Regarding this PR: I made another minor change, which happens to fix the symptoms of the bug (for the root cause, we'll have to see what will happen in the ticket). The problem is fixed because the validation converter now contains an explicit hook for Campaign and therefore no longer relies on the incorrect fallback. However, note that the issue would return if we ever decided to remove that hook again, thus it's not a 100% satisfying solution. But for now, I think we can merge and track the ticket instead.

Copy link
Collaborator

@AdrianSosic AdrianSosic left a comment

Choose a reason for hiding this comment

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

Can be merged but the required pipeline checks still need to be adjusted.

.github/workflows/regular.yml Outdated Show resolved Hide resolved
baybe/campaign.py Show resolved Hide resolved
@Scienfitz Scienfitz merged commit 6895494 into main Mar 25, 2024
10 checks passed
@Scienfitz Scienfitz deleted the feature/py312 branch March 25, 2024 20:51
@AdrianSosic
Copy link
Collaborator

Solves #156

@AdrianSosic AdrianSosic linked an issue Mar 26, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Expand / change existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Python 3.12 blocked by failing config checks
3 participants