Am Donnerstag, 6. September 2018 11:19:27 UTC+2 schrieb Samuel Lelievre:
> Dear SageMath packagers,
>
> This pkgs.org page about SageMath
>
> https://pkgs.org/download/sagemath
repology.org is a more exhaustive source:
https://repology.org/metapackage/sagemath/versions
I just noticed that the nixpkgs stable version isn't listed there because of
a naming issue (its named "sage-wrapper" on repology). I'll fix that sometime.
> Please discuss anything that would make your life easier
> as a packager here on sage-packaging, or on sage-devel.
My biggest gripes (already mentioned in other places too) are
- the brittleness of the doctests. Often times they check string output of python
libraries that is not intended to be stable. As a result they break at pretty
much every minor package version change.
- the number of package patches. I think sage-the-distribution makes it too easy
to patch dependencies without considering the consequences. Every patch to a
dependency is a burdon on all packagers and workarounds within sage should be
preferred. I already discussed this in sage-devel without much success.
- packaging concerns still seem second class
Minor issues:
- the commit policy is weird. Commits often aren't self contained changes that
pass the doctests but commits like "update package" "fix some doctests in file
x" "fix some more doctests in file y" instead. That makes cherry picking and
bisecting unnecessarily hard.
- the treatment of random failures. There are several open trac tickets with the
"random_fail" keyword [1]. In my opinion they should all be release blockers
and at least be marked as known failures before a release. Random failures in
package tests are a huge pain for continuous integration.
- the tight entanglement between "sage the library" and "sage the distribution".
I don't think implementing an ad-hoc package manager with make is a good idea.
> If you spot Sage Days you would like to go to, register and
> tell the organisers you are involved with packaging SageMath
> for your distribution. A remote Sage days to train packagers
> to the Sage development workflow could also be arranged.
> See the list of upcoming Sage Days at:
>
> https://wiki.sagemath.org/Workshops
>
> In particular, I'm one of the organisers of
>
> Software tools for mathematics
> Koper, Slovenia
> 24 -- 28 September 2018
> http://stm.famnit.upr.si/
> https://wiki.sagemath.org/days97
>
> and can allocate funding for SageMath packagers to attend
> (and we could organise a special session).
I'm actually a bit tempted since I will already be half way in that direction
on the 24th anyways. I'm not sure if I can take the additional time off and if
I would even add any value there.
> Kind regards,
> Samuel
By the way a contributor is nearly finished[2] adding darwin support to the sage
nix package. There still is some openblas/fflas_ffpack issue[3] however and it
has been a while since their last comment.
My current remaining patches (ignoring package update patches) are
- https://trac.sagemath.org/ticket/25358
- https://trac.sagemath.org/ticket/25316
Which is way less than I started out with. I hope to be able to package sage
unpatched in the future, but the prospects on getting those two issues resolved
seem bleak. Upstreaming the other patches worked pretty well.
Timo
[1] https://trac.sagemath.org/query?status=!closed&keywords=~random_fail
[2] https://github.com/NixOS/nixpkgs/pull/45364
[3] https://trac.sagemath.org/ticket/26130
Its really not about blame. Fixes should be done as far upstream as possible.
However if that is not possible, working around it is better than simply fixing
it ourselves.
Well there already is the sage package for nix. So at least for linux, it
wouldn't be much work. Some of the patches sage applies for other platforms
would need to be added, but I can't test that myself.
I'm advocating to change the policy for sage (I'd like to think I'm not
complaining, but thats mostly a matter of definition). I can't do the same
for every upstream package. What am I supposed to do, nag people on upstream
PRs until they grow agitated? I'm saying that yes upstream should fix stuff
but *also* sage should not make it harder than necessary for *its* downstream
and users.
Exactly :)
> If we want to pin to an *exact* version we
> should vendor the library directly into the Sage sources (which can
> still be problematic, depending on the policies of a given
> distribution; e.g. I think Debian will try to un-vendor things like
> this but you can clarify; it also depends on how much it's modified,
> etc.).
Just in case you meant me with "you", I am not involved with debian. I think if
there truly are breaking changes or important new features and accomodating both
versions is unreasonable, it is okay to not support an older version. It just
shouldn't be nearly as common as it is with sage. I'm not sure if vendoring
would be an improvement.
> > [...]
> > Yes that is a workaround. I don't think git-bisect can be made to do that, you'd
> > have to `git bisect skip` everything that you don't want to test. Making an
> > effort to make nice self-contained patches would be better though.
> >
> > I think part of the issue is that most of sages contributors (I'm assuming) are
> > mathematicians and not software engineers. That is necessarily so because
> > software engineers often lack the necessary domain language (I know I often do).
> > But it does mean that many contributors are not aware of some best practices.
>
> I'm not exactly sure what you mean here. A lot of what you're
> describing sounds like some of the Python 3 updates which have
> admittedly been a bit haphazard.
I'm mostly talking about package updates, since that is what I'm most involved
with. A random example I dug up right no is #25277. I *don't* want to point
fingers right now and since we don't currently have a policy the contributor
didn't do anything wrong. It is just not the way I consider ideal. Commits include:
_test_divides in Rings()
divides for integer mod ring
smarter iteration over pairs of elements
# there are lots of doctest failures after this
doctests fix
skip _test_divides in the symbolic
remove useless tests
> I also don't necessarily believe
> every commit must be 100% self-contained. For example, if I'm
> refactoring some area of code (as part of a larger set of logically
> connected changes) I will do that refactoring as a single commit that
> can be explained in the commit message.
self-contained does not mean big. It just means that if sage built and the
doctests succeeded before the commit, they should also do so after. There are
a lot of git subcommands that make the assumption that commit are like that:
git bisect, git cherry-pick and git revert come to mind. So a refactoring can
very well (and should) be a seperate commit. In the above example the necessity
of a "doctests fix" commit show that the commits before that were clearly not
self contained.
Also there is the somewhat less important matter of the commit message. I prefer
the style used in the git book[1] (short, imperative, first letter capitalized).
But just some standardization would be nice.
> they are not very interesting or self-contained. I've observed that a
> lot of Sage contributors are not well-versed in using tools like "git
> rebase", and often also occasionally up on merges. While Sage's "git
> trac" command is very convenient for many cases, for beginners and
> advanced developers alike, we could probably do more as a community to
> train Sage developers on effective git usage.
Thats what I meant by sages unique position of having lots of contributions by
non-CS people. For many contributors sage is probably the first open soruce
project they ever contribute to.
> > > > - the treatment of random failures. There are several open trac tickets with the
> > [...]
> I think I generally agree with you about this. Perhaps the bigger
> blocker here is just available developer resources to investigate
> random failures, especially if they are difficult to reproduce. So
> they are probably deemed "more acceptable".
Yes I understand that we can't fix them all, but we should at least mark them as
known before release. As Jeroen noted that is already possible and is what I
tried to do in #25968 for one such failure for the last release. I agree that
still reporting those known failures would be better, but at least there are the
open trac tickets as reminders.
> > Obviously being biased, but I think nix would be perfect for the job. Package
> > [...]
>
> Two years ago in Cernay (or was it three??) we had a workshop about
> package managers for Sage, and looked at a number of possible ways to
> replace Sage's current hand-rolled "packaging system" such that it is.
> I believe nix was looked at, as well as conda, Guix, and hashdist. I
> personally rather liked Guix, but I think it fell somewhat on deaf
> ears. I have a feeling that it's Guile/Scheme-based configuration
> language turned a lot of people off. Indeed it threw me for a loop as
> well at first, but I pressed on and decided I liked it. I also have
> found that I like hashdist, but it doesn't seem to be getting much
> traction.
Guix is pretty much the same as Nix, just a different CLI and different language.
Its a good tool and more polished in some areas, I'm just sad that they felt the
need to split the community. Nix has a bigger community and does not flat-out
reject all unfree packages (while still allowing users to disable them), which
is why I chose Nix over Guix.
> All that said, after that workshop, there was no real conclusion or
> strong consensus; I think the strongest consensus was maybe for conda,
> but that will be a problem for Sage on Cygwin, as there is not
> officially a conda for Cygwin, or conda binaries for Cygwin.
I'm not sure what the state of nix for windows is. I think I read somewhere
that it runs on bash-on-windows. If you're interested in looking into that
and maybe even make sage build there, I'd be happy to help. I would assume
that the effort wouldn't be too great (as long as n ix already runs on windows
and the necessary fixes are already known since the spkgs work there), but
maybe I'm naive.
> > > If you can bring your ticket into a state that
> > > the patchbots are happy with I am very happy to try my best to wave it
> > > through.
> >
> > That would be great :) I'm having trouble interpreting the patchbot output
> > for #255358. As far as I can see the reported failures are some pyflakes
> > issue and `--optional - magma` doctest failures, both should be unrelated.
> > Could you leave a comment at #255358 explaining the issue?
>
> I wish people would either stop enabling optional tests on their
> patchbots, or only enable them after they've first made an effort to
> fix ones that fail regularly :(
So there is nothing to be done then?
Another nice thing about the transparent binary substiutions in nix is that
users can modify a single package (like configure mpir to build with optimizations)
and build that locally while everything else is still fetched from a build server.
> > Again regarding rebuilds, replacing the make-based system with nix would solve
> > that.
>
> I'll have to take a closer look at nix. I know I looked at it before
> but I don't remember much about it. I still think it might be a
> bigger effort than it's worth to completely replace Sage's "packaging
> system" with something else, but I haven't *tried* either. Certainly
> the conda-forge folks have made impressive progress so it's not
> impossible.
As I said before, sage builds on nix so at least for linux its really not that
big an effort. Fixes for other platforms would just need to be ported. I don't
know which platforms are oficially supported by sage.
Maybe I'll write a post to sage-devel where I explain the advantages of nix in
more detail.
Yes I haven't even required this on the few tickets I reviewed myself, since
there are no existing guidelines to point people to. There is little one can do
as a single contributor/reviewer, especially if the majority of contributor /
reviewers don't agree / are not aware of a problem. I don't have the energy to
work on changing that either.
> I'm guilty of this myself, however. In the case of Sage it's also
> more common to find doctest failures later that were not caught during
> development. This is because the size of Sage's test suite is too
> large and it's almost impossible to do a normal build/test/commit
> cycle.
Ah yes, that is also a problem. Most changes I did were small enough to be only
one commit, so build/compile/test worked for me. But I understand that that is
harder when making bigger changes in multiple commits. Maybe the `--short`
doctest will at least somewhat help here. It doesn't have to be perfect either.
Many times commits are just split into "change this file" and "change that
file". In that case, it would be obvious that they should be merged / seperated
diefferently.
> At best I might test one or two modules that are closely
> related to the changes I'm making. But sometimes there can be
> failures in tests in distantly unrelated modules (and some of these
> tests are really bad IMO, especially some of the tests that use the
> actual Sage sources as input to the test, so that arbitrary changes to
> the sources can randomly break those tests).
I personally think sage may have pushed the "test all the things" mentallity
a little too far. While tests are essential and good, I feel like some tests
are just there for the sake of having tests and aren't very useful.
> Two related things I'm working on to improve this situation:
>
> 1) I have a prototype for line coverage built into Sage's doctest
> runner, so I can get *actual* test coverage results.
> [...]
Nice effort, thanks again for your good work :) Although I think there is no
getting around testing the integration of modules outside of the modules.
> > Also there is the somewhat less important matter of the commit message. I prefer
> > the style used in the git book[1] (short, imperative, first letter capitalized).
> > But just some standardization would be nice.
>
> I'm very inconsistent about things like this. If we could get the
> community to agree to a commit message style (huge bikeshed magnet but
> a good idea in principle) it would be nice.
Yes, consistency is far more important than any particular style. Yet again,
I don't want to "fight that battle" and start the bike-shedding.
> > [...]
> > I'm not sure what the state of nix for windows is. I think I read somewhere
> > that it runs on bash-on-windows. If you're interested in looking into that
> > and maybe even make sage build there, I'd be happy to help. I would assume
> > that the effort wouldn't be too great (as long as n ix already runs on windows
> > and the necessary fixes are already known since the spkgs work there), but
> > maybe I'm naive.
>
> The Windows Subsystem for Linux (aka "bash-on-windows") is currently
> not very interesting to me. It *could* become interesting, especially
> if Microsoft would expose and document more of its internals. It's a
> convenience for doing development on Windows, sure, but I actually
> hardly use it. Having Docker has mostly obviated it for me since if I
> want to bring up a Linux machine with any distro I can just pull down
> the appropriate Docker image and run in that.
>
> However, if more of its internals were exposed it could be very useful
> for Cygwin, especially the fork and socket implementations.
>
> The problem with using the WSL for Sage on Windows is that, while it
> may be useful for development, it's not intended to be used for
> software distribution; in other words, distributing pre-built Windows
> software that relies on the WSL to work is not supported. This is why
> Sage for Windows uses Cygwin instead--Cygwin is just a handful of DLLs
> you can include in your software distribution.
What do you mean it is not supported? You can certainly fetch pre-build binaries
with nix on bash-on-windows.
For what its worth I checked, and there are multiple Cygwin-specific fixes
in nixpkgs. So apparently it does run there. CI tests are only run on
x86-64-linux, aarch64-linux and darwin however. And I'm note sure what the
situation about shipping binary packages is. I assume bash-on-linux can just
use linux binaries, but Cygwin probably cannot. So since I don't think we
currently officially ship Cygwin binaries, you'd have to build everything
from source. It is possible to create your own server to serve binaries
however.
> > [...]
> > Maybe I'll write a post to sage-devel where I explain the advantages of nix in
> > more detail.
>
> That would be interesting. Like I said, I've not very aware of the
> specifics of Nix. I've heard of it of course, but I've never tried to
> use it or read the docs. Anything that should work as the "primary
> supported" packaging system for Sage would have to work on
> Linux/FreeBSD, macOS, and preferably Cygwin at a minimum. For macOS I
> have no idea. For Cygwin it could work *in principle* but there are
> usually some hairy bits when it comes to things like
> packaging/building on Cygwin. This person claims to have gotten Nix
> sort of working on Cygwin:
> https://invalidmagic.wordpress.com/2011/01/19/running-the-nix-package-manager-on-windows/
> But that was in 2011, so I doubt it works all the same today. Still,
> it might be interesting to try sometime.
Well as I said, darwin support is already close. Actually the only blocker i'm
aware of is a test failure in a test sage-the-distribution just doesn't run, so
the same failure is probably also present there (#26130). I think the BSDs are
somewhat supported, although I know little about them and the differences from
linux. As long as nix runs on a platform, porting sage's dependencies should be
manageable since all the fixes are already present in the spkgs.
> But this is why my approach, after not being quite satisfied with any
> solution I saw at the Cernay workshop, has been to focus on improving
> what we already have, and instead make it so that Sage does not rely
> on building so many of its dependencies, so that it can instead use
> more existing system packages regardless what the underlying package
> manager is. This could include, where appropriate, hooks for package
> managers as well. But I haven't made it to that stage yet.
Thank you for that. I appreciate that you take the concerns seriously.
> > [...]
> > So there is nothing to be done then?
>
> Well, not nothing: https://gitlab.com/sagemath/dev/trac/pipelines
How do I interpret that?
I'm still not convinced the hard-fork was necessary -- the two communities
could have accomplished more if we had sticked to a common package base.
All unfree packages are clearly marked as such and "Guix" could have been
Nix with the only difference being a hardcoded inability to parse those
packages (essentially hardcoding `allowUnfree = false`). That discussion
is off-topic of course and would probably be a better fit at
discourse.nixos.org :)
> Another thing we are interested in is to build everything from source, so
> we try to unbundle as much as possible (at the time, that was different
> in Nix: when I packaged texlive for Guix and compiled it from source, the
> Nix packages consisted of unwrapped Debian binaries, if I remember well;
> this has changed in the meantime, at least for texlive).
As is Nix, although there are some compromises when there is a lack of manpower.
Which is why it would have been nice to work together.
> We are also striving for reproducible builds, but this may also be true
> for Nix.
Yes that is also true for Nix, although I think Guix's effort may be further
along. Again, lack of resources to make it a main priority. That is a personal
"pet peeve" of mine that I'd love to see improved. I hope I'll have time to
improve it myself in the future.
> Concerning Docker images, they can easily be created with Guix, see
> https://www.gnu.org/software/guix/blog/2017/creating-bundles-with-guix-pack/
> (Docker is mentioned in the "Bells and whistles" section). So if we had
> Sage in Guix, it would be easy to create Docker images for it.
I believe that is possible in Nix too, although I am not certain (no experience
with docker). The only thing I could find with a quick search is this[1], but
that is unmaintained.
Ah so you mean you can't package it up in a windows installer? I don't really
care much about Windows so I'm not aware, though I realize that windows support
is important for many.
> Requiring that users have Windows 10, with developer mode enabled
I wasn't aware you need to enable developer mode or something. I (somewhat
naively maybe) assumed you could just create a desktop shortcut executing
something like `bash -c sage`.
> > For what its worth I checked, and there are multiple Cygwin-specific fixes
> > in nixpkgs. So apparently it does run there. CI tests are only run on
> > x86-64-linux, aarch64-linux and darwin however. And I'm note sure what the
>
> The latest posts I saw on the subject suggest that it does not work.
> Perhaps it worked at one point but it is not maintained.
I just asked on IRC and got
"I think Cygwin, in theory, should be able to build Nix and whatnot fine. It's "just" a C++ app. Nixpkgs is a totally different story, though there's some code scattered in there still. Support for Cygwin has sort of been on/off over the years, IIRC, so -- "it works, if it works"?"
so if you're really interested, its probably best you just try. Since the Nix
binary *should* work, it *should* only be a matter of porting platform-specific
patches to packages where necessary and not already applied.
> > situation about shipping binary packages is. I assume bash-on-linux can just
> > use linux binaries, but Cygwin probably cannot. So since I don't think we
> > currently officially ship Cygwin binaries, you'd have to build everything
> > from source. It is possible to create your own server to serve binaries
> > however.
>
> Of course. And the same is true for Conda. I think Conda, for its
> macOS support, looks like the best bet right now and Sage already
> mostly works there.
As I said nix also supports macos (even first-level support). Conda may or
may not be more appropriate. I've barely heard of it and never used it, so I
can't judge.
> > > > So there is nothing to be done then?
> > >
> > > Well, not nothing: https://gitlab.com/sagemath/dev/trac/pipelines
> >
> > How do I interpret that?
>
> As an alternative to the patchbot.
Didn't you imply that there were some specific changes #25358 and #25316 need?
Reading thorugh the first few pages of the user-guide it does seem interesting
in comparsion to PIP, but it doesn't offer anything my current package manager
doesn't. So since repos generally try to avoid 3rd party package managers
anyways, I don't think it would be very useful for me.
Of course :)