We may also introduce a block tag like ":: optional - sage.modules sage.rings.finite_rings" that applies to a block of lines.
how do you know which modules some random doctest you want to include depends on?
I also think it might be good to have a style guide
[...] to inform users/developers why a particular optional tag is needed, in a comment or something. For a lot of the optional libraries, that was fairly obvious (e.g. if you didn't have Mma or Maple installed, don't do those tests, or for the various LP solvers), but maybe that isn't so clear now.
Happy to see that you are curious regarding the modularization project, but I don't think it's a good approach to start this discussion with claims that sound authoritative ("nobody will actually maintain", "does not scale", "nearly all end users", etc.) and a policy proposal.
What about a completely different approach: Instead of annotating the doctests, simply ignore test blocks that fail due to a thrown import error (or missing feature error) of a package that is not installed in the modularized test environment? That might hide some edge cases, but would in total be a less intrusive way to handle things.
At the very least, I would propose to hide these optional tags from the generated docs.
Maybe I'm misunderstanding the purpose of the modularized doctests. Can someone explain me what they should test and what not?
My thought was that when you declare a new module, you run the doctests of that module. They usually break for two reasons:a) some real dependency was not declared for that module - in this case, add the dependency and run the tests again.b) some doctests require a library that is not a dependency of the original module - in this case, add an optional tag to the failing doctest (current solution)My proposal would be in b) to add it the offending import to a whitelist ("test dependency of module xyz") and then all doctests for module xyz are ignoring import errors for these whitelisted dependencies. So in short, instead of annotating each doctest you annotate the module.
- Modularized distributions must be testable separately!
My thought was that when you declare a new module, you run the doctests of that module. They usually break for two reasons:a) some real dependency was not declared for that module - in this case, add the dependency and run the tests again.b) some doctests require a library that is not a dependency of the original module - in this case, add an optional tag to the failing doctest (current solution)My proposal would be in b) to add it the offending import to a whitelist ("test dependency of module xyz") and then all doctests for module xyz are ignoring import errors for these whitelisted dependencies. So in short, instead of annotating each doctest you annotate the module.After you whitelist an import from M because there is some valid doctest that uses M for integration-testing purposes (for example, by testing basic linear algebra functionality by running it on an element of an algebra defined in M), the modularized distribution is no longer guarded by its testsuite against modularization regressions that involve the whitelisted module.
On Wednesday, 14 June 2023 at 02:36:16 UTC+8 Matthias Koeppe wrote:- Modularized distributions must be testable separately!And why is this a desirable goal?
Integration tests almost by definition are testing multiple modules/units and thus don't fit into this scheme.
But I think it would be better to reuse tools (or at least their ideas) that were developed exactly to manage and restrict dependencies between different layers/modules of an application, such as https://github.com/zyskarch/pytestarch, https://github.com/seddonym/import-linter, https://github.com/jwbargsten/pytest-archon, https://github.com/TNG/ArchUnit. All of them define external rules about admissible relationships.
And as I explained elsewhere, the # optional annotations also improve the documentation for the benefit of the project.
More specifically, when users of a modularized distribution make their first steps to contributing to it, that's already difficult; and we do not want to have to tell them "if you want to make this contribution, you first have to become a real SageMath user."
- Some # optional annotations reduce the barrier for contributors, by clearly signaling to developers "it's OK and definitely not your fault if you don't understand this doctest".
On Wednesday, 14 June 2023 at 05:03:21 UTC+8 Matthias Koeppe wrote:More specifically, when users of a modularized distribution make their first steps to contributing to it, that's already difficult; and we do not want to have to tell them "if you want to make this contribution, you first have to become a real SageMath user."Judging from the current people interested in the modularization, it seems more likely that a few senior sage devs will work on modularized distribution.
But my question was more: what kind of issues/bugs do you try to prevent by modularizing the tests as well?
On Wednesday, 14 June 2023 at 05:37:15 UTC+8 Matthias Koeppe wrote:- Some # optional annotations reduce the barrier for contributors, by clearly signaling to developers "it's OK and definitely not your fault if you don't understand this doctest".
[...] As a (new) user, reading "# optional - sage.symbolic" makes me more think "wtf. what is this? how do I install this sage.symbolic thing so that I can run use this example?!" than "oh, yes, this test depends on another part of sage, that I have not yet encountered, so I don't need to try to understand this example".
[...] Some of it can be fixed by changing the nomenclature "optional" to something else as that suggests something a user should add to the installation.
Perhaps this is the core question (for me): What do you expect most/casual users to download and install?
--
You received this message because you are subscribed to the Google Groups "sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/80a6ba58-17e8-4a99-950a-3bfb5e0b24fen%40googlegroups.com.
On Thursday, June 15, 2023 at 6:03:41 PM UTC-7 Travis Scrimshaw wrote:
Perhaps this is the core question (for me): What do you expect most/casual users to download and install?It may be the wrong question because it seems to assume there is one population of such users.
The population of current Sage users and developers can continue to install the monolithic Sage.Or, in the modularized terminology, they install the distribution "sagemath-standard".
But the point why I have been working so intensely on the modularization project is to open parts of Sage to new populations of users and developers who are at home in the Python world. In particular those who find that they cannot use the monolithic Sage for their needs and therefore go looking for other projects that do not impose such constraints.
then we should make sure the doc is very clean.
Have you worried at all about doctests/examples and the sage preparser/global environment that is assumed in all the doctests?