m-labs / artiq

A leading-edge control system for quantum information experiments
https://m-labs.hk/artiq
GNU Lesser General Public License v3.0
426 stars 196 forks source link

split packages #585

Closed dnadlinger closed 4 years ago

dnadlinger commented 7 years ago

We are using a number of headless ARM/Linux boards to run ARTIQ controllers for various pieces of hardware (think Raspberry Pi, BeagleBone). The most natural way to integrate this with the rest of the system seems to be to go with small Python/pc_rpc servers that are herded by ctlmgr instances on those boards.

Currently, the ARTIQ package (as in setup.py/pip) pulls in the GUI parts of Qt and LLVM as hard dependencies. For the above use case, this is rather inconvenient, as the machines are neither running X11 nor necessarily have a C toolchain installed.

Would it be possible to either split up the monolithic package or offer another way of disabling the dependencies? (I'm quick to admit that Python packaging is not my forte, so I can't offer much advice as to what the best design would be.)

sbourdeauducq commented 7 years ago

Putting it politely, conda (and other Python package managers) is a pain to deal with.

jordens commented 7 years ago

A couple notes:

The latter two items seem to be small and robust. I'd be happy to accept them.

tballance commented 7 years ago

I have drafted a conda recipe for a simple stripped down version of artiq which includes (entry points for) only those bits needed on 'remote' rpc servers:

Packages built with this recipe are available on my anaconda channel along with the necessary dependencies for running on linux-armv7l. What I have done is a bit hacky, but it is sufficient for us to run rpc servers on RPIs and BeagleBones, and so might be of use to others until a more elegant solution is reached.

Patch: https://gist.github.com/tballance/201226bc18d690e6b2667bf83aaed5d1

sbourdeauducq commented 7 years ago

If we split packages, this can also remove the console window that appears when running the dashboard or browser on Windows. The only reason it still appears at the moment is because conda does not allow you to put GUI and non-GUI programs in the same package.

whitequark commented 7 years ago

@sbourdeauducq Can't you simply run them explicitly with pythonw -m artiq.frontend.foo to avoid that? We can add that logic to our GUI tools, it is two lines of code.

sbourdeauducq commented 7 years ago

There would still be the console appearing for a short while. And we'd have to be careful not to break the GUI completely in some situations, e.g. if pythonw is not in the PATH for some reason.

sbourdeauducq commented 5 years ago

@dnadlinger Try installing NixOS on the Raspberry Pi, then it's straightforward to remove the unwanted bits from the .nix files and setup.py. I've tried running artiq_flash (including our modified OpenOCD) and a few other things that way, and it just works fine (on a AAarch64 model B+).

Also, the new build/installation system in ARTIQ-5 makes conda much less of a pain, so I'm happy to revisit this split package idea, if there's still interest.

sbourdeauducq commented 5 years ago
* One would probably want to split it into four components:

I would even say 5 components, the fifth being the "board tools" with:

sbourdeauducq commented 4 years ago

Besides the improvement in ARTIQ packaging and CI/CD system (e.g. controllers do not get rebuilt needlessly when ARTIQ is modified), splitting out much of artiq.protocols into its own package and advertising it as an independent library has another benefit. It is a simple library with no special dependencies, which can be used outside of ARTIQ by other projects, and for which depending on ARTIQ would be annoying. People may not even be aware that artiq.protocols would solve their problem. I propose the name SiPyCo (Simple Python Communications). @jordens Thoughts on the above and OK if I modify your QUARTIQ controllers to depend on SiPyCo?

drewrisinger commented 4 years ago

@sbourdeauducq if you break out artiq.protocols then they should be a little better documented. Specifically, working with the Publisher/Subscriber/Notifier is a bit of a pain, as the data structure modifications are undocumented and not immediately obvious what is happening (e.g. mods is a Dict[str: (bool, ???)])??? https://github.com/m-labs/artiq/blob/5279bc275af4924b610046a25b8d86191a77d1f2/artiq/applets/plot_xy.py#L15-L20

hartytp commented 4 years ago

Yes, I definitely found the lack of documentation for those hard when I first used them. They really need some simple examples to show how they're intended to be used (I read ARTIQ source to figure that out)

jordens commented 4 years ago

I also think that the stuff in protocols covers a limited area of scalability/applicability/maintainability. But OK to factor out if the impact on the usability (all the way to installing the controllers on ARTIQ-4 using the conda packages) is handled.

sbourdeauducq commented 4 years ago

Done. There are now three packages:

The controllers and artiq-comtools are easily installable on non-x86 single-board computers (speaking of, I recently met someone from https://libre.computer/ which may be a good alternative to crappy Raspberry Pis).

As for backwards compatibility, sipyco retains the same wire protocol as ARTIQ and can be installed alongside ARTIQ-4, so using sipyco controllers with ARTIQ-4 is straightforward.

@drewrisinger Do you know someone who is available, motivated, and good at writing documentation?