electronic_eel has quit [Ping timeout: 240 seconds]
electronic_eel has joined #glasgow
PyroPeter_ has joined #glasgow
PyroPeter has quit [Ping timeout: 272 seconds]
PyroPeter_ is now known as PyroPeter
thaytan has quit [Ping timeout: 256 seconds]
thaytan has joined #glasgow
nicoo has quit [Read error: Connection reset by peer]
nicoo has joined #glasgow
lxdr has quit [Quit: Ping timeout (120 seconds)]
d_olex_ has joined #glasgow
ExeciN has joined #glasgow
Getorix_ has joined #glasgow
Getorix has quit [Ping timeout: 256 seconds]
Getorix has joined #glasgow
Getorix_ has quit [Ping timeout: 258 seconds]
ExeciN has quit [Ping timeout: 256 seconds]
Exec1N has joined #glasgow
Exec1N has quit [Ping timeout: 240 seconds]
Exec1N has joined #glasgow
Exec1N is now known as ExeciN
Stormwind_mobile has joined #glasgow
Getorix_ has joined #glasgow
Getorix has quit [Ping timeout: 256 seconds]
_whitelogger has joined #glasgow
Stormwind_mobile has quit [Ping timeout: 265 seconds]
Stormwind_mobile has joined #glasgow
promach3 has quit [Quit: killed]
sambristow_nz[m] has quit [Quit: killed]
emily has quit [Quit: killed]
disasm[m] has quit [Quit: killed]
jevinskie[m] has quit [Quit: killed]
ZerataX1 has quit [Quit: killed]
gillesmauve has quit [Quit: killed]
jschievink has quit [Quit: killed]
fridtjof[m] has quit [Quit: killed]
fridtjof[m] has joined #glasgow
jschievink has joined #glasgow
emily has joined #glasgow
ZerataX has joined #glasgow
promach3 has joined #glasgow
jevinskie[m] has joined #glasgow
gillesmauve has joined #glasgow
sambristow_nz[m] has joined #glasgow
disasm[m] has joined #glasgow
jpa- has quit [*.net *.split]
Chips4Makers has quit [*.net *.split]
kmehall_ has quit [*.net *.split]
kmehall_ has joined #glasgow
jpa- has joined #glasgow
Chips4Makers has joined #glasgow
thaytan has quit [Ping timeout: 260 seconds]
thaytan has joined #glasgow
ExeciN has quit [Quit: so long king Bowser]
bvernoux has joined #glasgow
<d1b2>
<mwick83> hi everyone! I just got my own glasgow thanks to @Attie and I started to experiment a bit with the cli tool and the spi_master applet. Well, what I instantly started to think about is how the glasgw framework is supposed to be used in a scripted environment. What I mean: Suppose I have more or less complex SPI device, which I want to interact with, but not by calling multiple calls to the cli tool, but by running a loop/event based script, e.g. I'm
<d1b2>
sending a command, get the response and depending on the repsonse I send something else and so on. I saw the run-repl command, which is should work for very simple scripting, but I would rather like to write my code in a separate python file. How would such a scenario be best implemented? Do I write my own Applet that subclasses from the SPIMaster Applet? Or does the "cli" have an exported API for such scenarios that I can import and make use of in my own python
<d1b2>
script?
<tnt>
I think at the moment you pretty much have to write your own applet.
<tnt>
alternatively you can make your own applet that act as a server through some RPC mechanism to interacti with whatever external script you need.
<d1b2>
<mwick83> @tnt okay, thanks. I see, I thought I was missing something obvious. So, yeah, I guess writing my own applet would be the way to go
<d1b2>
<Attie> glad you received it ok!
<d1b2>
<Attie> i'd also suggest writing your own applet... possibly extending the existing, and overlaying the run(), or possibly adding an interact() function if that suits
<d1b2>
<mwick83> yes, that's what I hand in mind. Just wanted to make sure, I didn't miss an obvious API of the cli for such scenarios
<d1b2>
<Attie> don't forget that only the first execution will build and load the bitstream, so subsequent executions of the same applet should be pretty quick
<d1b2>
<mwick83> It's not that easy to get a quick overview of the intended usage of the applet/cli flow 😉
<d1b2>
<mwick83> actually, I'm not quite sure how to organize my workspace for such more or less personal / custom applets
<tnt>
AFAIR I think being to import some python module and interact programatically in a larger app is a goal but ... not done yet.
<d1b2>
<mwick83> is there a flow/possibility to manage own applets kind of out-of-tree?
<electronic_eel>
mwick83: whitequark thought about a way to have out-of-tree applets, but IIRC there wasn't a clean and easy way to do it. so it is currently not implemented yet
<d1b2>
<mwick83> Got it, thanks
ali-as has quit [Remote host closed the connection]
ali-as has joined #glasgow
tf68 has joined #glasgow
tf6 has quit [Read error: Connection reset by peer]
vup has quit [Quit: No Ping reply in 180 seconds.]
vup has joined #glasgow
nicoo has quit [Remote host closed the connection]
nicoo has joined #glasgow
bvernoux has quit [Quit: Leaving]
<whitequark>
electronic_eel: there is, I believe, using pip
<whitequark>
it's just that I haven't got around to it
<electronic_eel>
ah, so I misremembered
<d1b2>
<Attie> a similar mechanism to pytest's plugins perhaps?
<whitequark>
regarding the original question of mwick83 though, it is also reasonably easy to run glasgow applets (or their chunks) in the Python REPL; it's not currently discoverable though
<whitequark>
Attie: I think so, there's basically one setuptools mechanism for that
<electronic_eel>
how would the import work for an external applet?
<d1b2>
<Attie> sounds good
<electronic_eel>
is it using more ... than we currently have to go out of the tree?
<whitequark>
no, you'd just go `from glasgow import`
<whitequark>
since the setuptools plugin would also reference glasgow explicitly, no way around that
<d1b2>
<Attie> iirc, you define a custom entrypoint for the package (alongside the CLI entrypoint), using a special name... other packages are then able to discover their plugins for example
<electronic_eel>
but then you don't call the normal glasgow cli from the shell, but your own program
<electronic_eel>
or am I wrong there?
<d1b2>
<Attie> so here, glasgow as it stands would be updated to "discover" other installed packages that provide relevant entrypoints
<whitequark>
electronic_eel: with setuptools plugins, you'd just get extra applets in the list
<d1b2>
<Attie> re mwick83's original question, I was considering suggesting something like pexpect to drive the python interface
<whitequark>
that's horrible
<d1b2>
<Attie> haha, okay... maybe not
<whitequark>
re "I saw the run-repl command, which is should work for very simple scripting, but I would rather like to write my code in a separate python file.
<whitequark>
"
<whitequark>
you can do something like `exec(open("myfile.py"))` in the REPL
<whitequark>
and we should probably just add an option to run-repl that executes a file so this isn't necessary
<d1b2>
<Attie> yeah, fair
Stormwind_mobile has quit [Ping timeout: 240 seconds]
<whitequark>
New in version 3.8: ast.PyCF_ALLOW_TOP_LEVEL_AWAIT can now be passed in flags to enable support for top-level await, async for, and async with.
<d1b2>
<Attie> is 3.7 support a hard requirement still?
<whitequark>
no. 3.9 got released, so we can (and should) bump our minimum python version to 3.8
<whitequark>
the policy is to support at least two latest python releases
<d1b2>
<Attie> ok, i might keep playing with it for a bit, even if it's not merged / useful for a little while
<whitequark>
i think we can merge it if/when you implement it