Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #16 +/- ##
==========================================
+ Coverage 97.39% 98.03% +0.64%
==========================================
Files 3 5 +2
Lines 115 204 +89
==========================================
+ Hits 112 200 +88
- Misses 3 4 +1
🚀 New features to boost your workflow:
|
|
the failing CI looks like some issue with codecov, unrelated to the changes here. |
There was a problem hiding this comment.
Looking good!
I fixed the types in 6a65ee7 – the biggest change is that I found the use of the implicit __class__ variable weird. It’s identical to subcls right? So I just renamed subcls to cls (as is convention) and made _get_packagename a classmethod instead of a staticmethod taking a class.
|
Co-authored-by: Copilot <copilot@github.com>
flying-sheep
left a comment
There was a problem hiding this comment.
Looks great! Thank you for this!
I’d prefer no default for docstring_style, otherwise I think this looks perfect!
| package_name = package_name[:dotidx] | ||
| return package_name | ||
|
|
||
| def __init_subclass__(subcls, *, exported_object_name: str, docstring_style: Literal["google", "numpy"] = "google"): |
There was a problem hiding this comment.
I would prefer no default here so this is explicit.
| def __init_subclass__(subcls, *, exported_object_name: str, docstring_style: Literal["google", "numpy"] = "google"): | |
| def __init_subclass__(subcls, *, exported_object_name: str, docstring_style: Literal["google", "numpy"]): |
Co-authored-by: Copilot <copilot@github.com>
The boilerplate is heavily inspired by AnnData's settings.
Forces validation on assignment, even if a subclass tries to disable it.
Unfortunately, it turns out that Pydantic doesn't really work with Sphinx that well (all the attributes and methods from
BaseModelare added to the docs). I've tried sphinxcontrib-pydantic, but that has at least two issues that make it not work here. For now, I work around it by using a very minimal autosummary template for theSettingsclass.This only implements the first part of #8. The second part (settings that apply to all scverse packages) needs some more thinking. One thing I could imagine is having a
ScverseSettingsclass with global settings, and a sentinel typeGLOBAL_DEFAULT. Each package's settings class can then add fields from the global settings and have them default toGLOBAL_DEFAULT. Customizing__getattribute__in the base class, we could then return either the global setting, or the proper value if set by the user. This would allow users to override the globals for individual packages as needed. I'm still not sure about how to set the global settings, though. Should this be another class inscverse-misc(which would either require users to import it directly or other pakcages to re-export it)? Do we make another packagescverse-settings?