Compare commits

..

2 Commits

Author SHA1 Message Date
f21f9257a7 flake: Add PyThermostat to devShell
Make Python scripts in PyThermostat available in the development shell
(thermostat_plot, thermostat_autotune, and thermostat_test).
2024-11-25 12:54:18 +08:00
417eb08cd3 flake: Add PyThermostat to PYTHONPATH in devshell
For easier testing of PyThermostat code in the development shell, so
that the following is possible right in the repo root:

```
$ python -m pythermostat.plot
Channel 0 target temperature: 25.000
$ python
Python 3.11.9 (main, Apr  2 2024, 08:25:04) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pythermostat.client import Client
>>> c = Client()
>>> c
<pythermostat.client.Client object at 0x7f9a41cab190>
>>>
```
2024-11-25 12:45:47 +08:00
4 changed files with 1 additions and 14 deletions

View File

@ -69,19 +69,6 @@
matplotlib
];
};
pythermostat-dev-wrappers = pkgs.runCommandNoCC "pythermostat-dev-wrappers" { } ''
mkdir -p $out/bin
for program in ${self}/pythermostat/*.py; do
if [ -x $program ]; then
progname=`basename -s .py $program`
outname=$out/bin/thermostat_$progname
echo "#!${pkgs.bash}/bin/bash" >> $outname
echo "exec python -m $progname \"\$@\"" >> $outname
chmod 755 $outname
fi
done
'';
in
{
packages.x86_64-linux = {
@ -103,11 +90,11 @@
openocd
dfu-util
rlwrap
pythermostat-dev-wrappers
]
++ (with python3Packages; [
numpy
matplotlib
pythermostat
]);
shellHook = ''
export PYTHONPATH=`git rev-parse --show-toplevel`/pythermostat:$PYTHONPATH

0
pythermostat/pythermostat/autotune.py Executable file → Normal file
View File

0
pythermostat/pythermostat/plot.py Executable file → Normal file
View File

0
pythermostat/pythermostat/test.py Executable file → Normal file
View File