flake: Dev convenience wrappers & environment #145
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "atse/thermostat:flake-dev-conveniences"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Makes PyThermostat contents more exposed and easier to bring up in the devShell.
For instance, after running
nix develop
, one can simply run:in the shell to run
pythermostat/pythermostat/plot.py
, with its source frozen at the point when the shell is entered.For running the scripts with the current source on disk, run
This is more useful for development.
Also, in a Python shell,
Then one can use Python to interactively interface with the Thermostat.
Wouldn't this
plot
command be more applicable for the customers, rather than devs? I thought in dev environment it is faster to directly edit and call the python files, rather than building anix develop
on each change.I think this PR is fine, just for the future shouldn't we export it for the customers?
No need for that though, since the wrapper script simply calls Python to run the wrapped modules
pytec/plot.py
orpytec/autotune.py
, so changes in those files would immediately show on run. This is really just a glorified alias.As for the customers, what is the best way to export it? Do we make another devShell or a bash script? Or make it
nix run
-able?c8b6bf01d1
to5bea19be36
But is it so? As far as I remember all files nix references are stored in nix store, meaning it was copied when
nix develop
is called.Ahh, that would be the case if
PYTHONPATH
was exported as${self}/pytec:$PYTHONPATH
in the devShell's shellHook. Here, the${self}
is`pwd`
instead to make it refer to the repo's working directory.@ -52,0 +60,4 @@
echo "exec python3 -m $progname \"\$@\"" >> $outname
chmod 755 $outname
fi
done
Why not package them normally e.g. with Python setup entry points?
Ah right! That would be the solution for the customers' end. However I think we'll have to use these wrappers for development, otherwise local changes wouldn't be reflected in the commands in
$PATH
.I've added the setup entry points in #149.
@ -68,2 +82,4 @@
numpy matplotlib
]);
shellHook = ''
export PYTHONPATH=`pwd`/pytec:$PYTHONPATH
In ARTIQ this is:
The dev shell can be entered from a subfolder, and your version would break.
Hmm, but this would be Git-specific is it not? How about something like:
Looks a bit complicated and I don't see a situation where a developer would enter the shell without using Git.
pwd
->git rev-parse --show-toplevel
in the force-push tod38864740b
.5bea19be36
tod38864740b
d38864740b
tod815a9ae55
d815a9ae55
to16c78c5784
16c78c5784
to1a3c831a06
@ -72,0 +80,4 @@
echo "exec python -m $progname \"\$@\"" >> $outname
chmod 755 $outname
fi
done
I think this isn't needed if you have the setup.py entry points?
But don't the entry points require
pip install
-ing the package for them to be in thePATH
? In a development shell we would ideally want them to be inPATH
already without any installing.No, just create a Nix Python package the regular way (see artiq or sipyco) and put that into the shell inputs. No pip.
But note that artiq follows a different approach for the development shells where you'd run the frontend tools as
python -m artiq.frontend.xxx
- because when developing you typically want the current source on the disk, not what the source was when the shell was entered.Done in force-push to
f21f9257a7
.1a3c831a06
tof21f9257a7
Checkout
From your project repository, check out a new branch and test the changes.