Closed tcompa closed 10 months ago
We recently created a new package with Fractal tasks using this approach here: https://github.com/MaksHess/abbott
Options:
Qs: How do we get template updates back into old packages? How easy is it for a user to do all the required setup (todo list vs. copier questions)
Briefly, from the meeting this morning.
The main goal is scaffolding: get a user to adapt their scripts into a Fractal-compatible package as smoothly as possible. A (lower-priority) second goal is life-cycle management, which includes pulling templates updates into the project.
Options (see a partial comparison here):
Requirements:
src/example_task.py
python -m build
or some similar command.
python -m venv myenv; source myenv/bin/activate; pip install -e .
)Non urgent goals:
Non goals (for the moment):
Here is the first version of the template: https://github.com/exactlab/fractal-tasks-template. I will describe some higher-level choices here.
As a first option, we went with a simple template repository, not based on jinja or similar tools.
PROs:
CONs:
git
operations. Actually even the very first operation (forking and cloning) immediately requires git concepts.Point 3 is what made us look elsewhere. Writing a script that automatically makes a bunch of string replacements in a folder tree is easy, but the fact that it needs to invoke git mv
or git add
is cumbersome.
The second try is the one in https://github.com/exactlab/fractal-tasks-template, and it's based on copier.
PROs
git
command. There is obviously some git in the copier copy gh:...
command, but it's abstracted by copier
. And if you don't plan to ever run copier update
, then everything works without ever typing git init
.CONs:
copier
is one more "dependency" that can introduce breaking changes in future releases, and the template may require copier
-related maintenance activity.Point 9 is only fixed by making fractal-tasks-core an instance of fractal-tasks-template, which is not an option for the moment.
Points 7 and 8 above can be mitigated e.g. by:
subprocess.run
.The current fractal-tasks-template is a fork of https://github.com/pydev-guide/pyrepo-copier. Due to points 7 and 8 above, I tried to only keep a very slim skeleton of the template, meaning that the fork already diverged quite a lot from upstream.
TBD: should this remain a fork, or should it become an independent repository (while still acknowledging the original pyrepo-copier effort)? We can probably discuss it directly with the pyrepo-copier maintainer. If it's OK, I'd rather move to an independent repository.
A first diff between upstream and our repo is here, but then I kept cleaning up as much as possible. Some relevant changes:
TODO: the use of GitHub actions and/or code-quality tools should be encouraged, and maybe we should add specific recommendations in the README pointing to valid examples (https://pydev-guide.github.io itself, or also other resources like https://learn.scientific-python.org/development/tutorials/ or https://scikit-hep.org/developer) or directly to the specific tools' documentation.
These include:
tests/data
Note that (as in point 4/9 above) any item of this list is introduce some debt, since it will need to remain in-sync with the rest of Fractal:
The current version can still be improved, and most importantly it lacks a full end-to-end real-life test (that is, actually using the tasks within fractal); but we are at a stage where feedback and reviews are already valuable.
The first version is already available at https://github.com/fractal-analytics-platform/fractal-tasks-template
(e.g. using https://github.com/pydev-guide/pyrepo-copier)