-
-
Notifications
You must be signed in to change notification settings - Fork 358
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
Use tomllib/tomli/tomli-w instead of unmaintained toml [WIP] #596
Conversation
There's one problem with this: right now it fails because it attempts to serialize |
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 will add support for 3.11 once it is released
please remove it so far
does tomli
include type annotations as inlines?
That sounds quite pointless, given it's at rc2 now and the API is frozen already but sure.
Yes. |
477f25e
to
dd6cfc2
Compare
makes sense to switch. Thanks for the PR at the time of writing the feature I chose will also resolve #595 |
I'm surprised at that but I suppose there's still work to be done there. I think most of the major projects (black, flit, mypy, pytest, setuptools, tox to list just a few) have switched to |
@mgorny https://github.com/getsentry/responses#tests-and-code-quality-validation |
See #596 (comment). The problem is that the input is broken right now, and I'm looking for guidance what fix would you prefer for it. |
it is not buggy, but done on purpose according to toml-lang the value with null should not be present in the file, thus, it should be filtered out in languages where it is present eg python. So, we need to filter all nulls out. def remove_nones(d):
if isinstance(d, dict):
return {k: remove_nones(v) for k, v in d.items() if v is not None}
return d and then dump the result |
Replace the `toml` dependency that is unmaintained (last release in 2020) and does not implement TOML 1.0 with more modern `tomli` and `tomli-w` packages. Co-authored-by: Maksim Beliaev <[email protected]>
Thanks for the snippet. Done that now and the tests seem to pass. |
Codecov ReportBase: 100.00% // Head: 99.92% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #596 +/- ##
===========================================
- Coverage 100.00% 99.92% -0.08%
===========================================
Files 9 9
Lines 2775 2788 +13
===========================================
+ Hits 2775 2786 +11
- Misses 0 2 +2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Thank you 🎉 |
Thanks! |
Python 3.11.0 has been released on Oct 24th. |
Replace the
toml
dependency that is unmaintained (last release in 2020) and does not implement TOML 1.0 with more modern libraries. Use the built-intomllib
module to load .toml files on Python 3.11, and its drop-in replacementtomli
package on older versions of Python. For writing .toml files, use thetomli-w
package.