Replies: 5 comments 4 replies
-
Sounds like something that needs some serious discussion, preferably soon! Guessing that will have to wait till the new year at this point? Certainly build processes and the CI have long been a pain point though part of that has been the need to pin versions of some dependencies. I assume this will not help with that? Other long standing issues with the build process such as the need to pull in the documentation from various dependencies before building, the various path issues and the perennial issues with Unix deployments sound like they might be addressed by this proposal? Given most facilities seem to deploy SasView locally for users on Unix machines that would probably be helpful. |
Beta Was this translation helpful? Give feedback.
-
I agree with pretty much all of this. Just to add my own contributions:
I think this would be a really good idea, and would also fix #3142. When I got the Flatpak reviewed, the reviewers really didn't like how we are putting a lot of configuration, and other data into the I think also (as alluded to), the documentation system is something we are going to need to take a close look at. If my understanding is correct (which it may not be), currently, documentation is copied to the home folder on installation, and is built from there? This won't work under the Flatpak as it is built under a separate container, and won't have access to the user's home folder at all at this stage (not least because it will not even be built on the user's machine). My opinion in general is that we need to move away from custom installation, and build logic to using pre-existing systems as much as possible. Your work in my eyes marks significant progress in this area. |
Beta Was this translation helpful? Give feedback.
-
Consider using conda-pack as the distribution rather than pyinstaller. Rather than a zip-file bundle the resources can be located within the install tree as a usual python package. This simplifies bundling the package and finding the resources from within the bundle. |
Beta Was this translation helpful? Give feedback.
-
Since bumps has a life outside of SasView I posted this discussion as a bumps issue: bumps/bumps#208 |
Beta Was this translation helpful? Give feedback.
-
Moving to pyproject.toml seems reasonable (we already did so for bumps and periodictable) but I don't find hatchling to be particularly compelling compared to setuptools for the build system. I would personally wait until its usage passes poetry-core (see download trends) before switching from known pain to unknown pain. Moving to importlib.resources would be good if it means we can remove code. That depends on whether the bundling of data works with the sasview installer. SasView doc build is going to be weird no matter how it is handled. It might help if we can tell sphinx to use files in another tree when building so at least we don't have the copy step. Carrying the .rst files around in the package just to save a little work in the SasView CI seems a little ugly. If SasView is using doc files from bumps [ I don't know why you would in their current state :-( ] then put a ticket into bumps. We can pre-compile the tutorials (i.e., run gentut.py) as part of the build so SasView doesn't need to know about that. pyopencl is already using platformdirs for its cache. It makes debugging harder since I never know where it hides things 8-) |
Beta Was this translation helpful? Give feedback.
-
The build system for SasView (and friends) carries a lot of historical baggage and now gets in the way of working on SasView like a 'normal' Python package. In looking at build systems, documentation and CI, I've prototyped some ideas that I think address many of the issues.
Since this is a set of changes across sasview, sasmodels, sasdata, and bumps, I've created this as a design discussion rather jumping to four (or more!?) separate PRs.
Current state
setup.py
could probably be convinced to make a.whl
, but with documentation being an integral part of SasView, the wheels are incomplete.Desired future state
pip install sasview
works.pip install ...
)Approach
There are a few things to do:
As a build system,
hatchling
is being developed by the pypa folks (i.e. the people who maintain the tool chain packagesbuild
,installer
,wheel
,pip
,setuptools
). While it is possible to usehatch
as a driver for managing builds, build environments, test environments etc, that is not necessary. As a standards-compliant backend builder,hatchling
is invisible to the person who invokes the build.For routine work of assembling python files and data files into a wheel,
hatchling
is fine. There are then plugins to deal with versions from git or from magic strings in files. There is a growing selection of plugins to deal with metadata or building; I've written one that can build documentation with sphinx.To ensure that the wheels contain everything that is needed for all uses of the module, the wheel then needs to contain the sphinx source for the documentation. By embedding the sphinx source for sasdata into the
sasdata
wheel as a set of data files that are part of the module, those files are available for the next build step; likewise for the other projects whose documentation is embedded into sasview's documentation.When building sasview, the sphinx source for each module can be located and extracted (a couple of lines with
importlib
) and then the assembled documentation source can be given to sphinx.The sasview wheel needs to contain both the assembled sphinx source ready to build, and also the pre-built documentation.
importlib
once again).importlib
), copied into the user's profile directory (perhaps using platformdirs to do this more portably?) and then the docs can be rebuilt as needed.If the wheels are more self-contained, then pyinstaller usage can also be improved. It's possible to let each module be a bit more self-describing of its resources for pyinstaller via entry-points.
Prototypes
The above plan is not just hypothesis... there are prototypes available for discussion
https://github.com/llimeht/sasmodels/tree/tmp/pyproject
https://github.com/llimeht/sasdata/tree/tmp/pyproject
https://github.com/llimeht/bumps/tree/tmp/docs-source
https://github.com/llimeht/sasview/tree/pyproject-hatchling
These are obviously not perfect but any problems can be treated as bugs to fix rather than showstoppers that invalidate the approach.
Known issues:
sasview.spec
can be further simplified.For discussion
Beta Was this translation helpful? Give feedback.
All reactions