Client-server, python-based laboratory software
Project description
pylabnet
Client-server, python-based laboratory software
This is the repository for pylabnet, a software package for client-server, python-based experiment control, designed for use in solid-state quantum optics + quantum network experiments in the Lukin group.
For users
Installation
The package can be installed from the commandline using
pip install pylabnet
You can now import pylabnet
and its submodules in your own scripts and notebooks. The package can be updated to the latest version using the command
pip install --upgrade pylabnet
Usage
After pip
installation of pylabnet, two executables will be created in the system PATH
: pylabnet.exe
and pylabnet_proxy.exe
. These can be used to launch master and proxy versions of the Launch Control GUI, from which relevant experimental software can be accessed over pylabnet. If desired, you can create shortcuts for these executables and pin the devices.ico
icon (shown above and located in the root directory) for bonus style.
NOTE: You will likely need to allow python through Windows firewall the first time you run Launch Control on a new machine.
The master Launch Control runs a LogServer
to keep track of all clients and servers on the network, and proxy Launch Control units simply connect to the master and mirror its information for convenience on remote machines.
The general workflow is the following
- Launch a master
LogServer
. Can be done from a cusftom script, but easiest to just use thepylabnet
executable. - Connect to hardware locally. This is done through use of drivers located in the
pylabnet/hardware
submodule. These drivers can also be used for standalone control of hardware, if desired. - Instantiate a
GenericServer
for each device (or logical module) to allow remote programming from anywhere in the network - Create clients for the hardware servers, which can be used to perform arbitrary functions on devices present across the network
Steps 2-4 can also be done manually from an interactive python notebook or custom script, but common functionality is incorporated into the Launch Control GUI for automatic "double-click" running of these steps.
For developers
Installation
First, clone the repository onto the local machine. Make sure git is installed. Cloning can be done from the command line, (preferrably in your home user directory) with the command
git clone https://github.com/lukingroup/pylabnet.git
NOTE ON DEVELOPMENT IN DEDICATED ENVIRONMENT
For installation in a dedicated pip virtual environment to prevent conflicts with the base python package, create a virtual environment - can be done from the command line using
python -m venv /path/to/new/virtual/testenv
Activate the development environment using the command
/path/to/new/virtual/testenv/Scripts/activate
Be sure to set the interpreter in your IDE to /path/to/new/virtual/testenv/Scripts/python.exe
if you will be launching pylabnet scripts directly from the IDE.
Additionally, the dedicated launching bash scripts need to be modified to activate the environment. This can be done by modifying pylabnet/launchers/pylabnet.cmd
to read
/path/to/virtual-env/Scripts/activate && start /min "Launch control" python launch_control.py
and modify pylabnet/launchers/pylabnet_proxy.cmd
similarly, but with the -p
argument after launch_control.py
.
Next, navigate to the root directory in the commandline, and run the command
python setup.py develop --exclude-scripts
NOTE: this command can also be re-used at a later time to maintain the environment (either virtual or base) if new package requirements are added to
setup.py
.
This will now allow you to import pylabnet
from your scripts, and ensures you have the dependencies installed. It also creates a pylabnet.egg-info
file which can be safely deleted if desired (it should not be tracked by github).
NOTE: It is often desirable to use the shortcuts provided in the root directory for launching. The "start in" fields need to be modified to the machine-specific path to
pylabnet/launchers/pylabnet.cmd
andpylabnet/launchers/pylabnet_proxy.cmd
, seepylabnet/launchers/README.md
for details.
Development
-
Create a new working branch before making any changes to the repository. Please do not make the changes directly in the master branch! This can be done either from your IDE of choice, or from the commandline within the local github repository, using
git checkout -b new-branch-name
-
Implement and test your changes.
-
For GUI-based applications, it is recommended to create a launcher module (see pylabnet/launchers/README.md for more details.
-
For non-GUI applications, please make a Jupyter notebook in the pylabnet/demo folder in order to demonstrate and test the added functionality.
-
Note that pushing changes to the
lukingroup/pylabnet
repository requires administrative access. Please contact one of the previous contributors for details. -
Try to keep the your local repository up to date with the online repository to avoid unnecessary merge conflicts down the line.
-
Once stable + working, submit a pull request.
Publishing a new version to pip
Generally, not every commit or even merge into master needs to be published to pip as a new version. However, if substantial functionality is added that could be useful to other users (especially ones that are not actively developing the platform), it is a good idea to release a new version on pip. In this case, you can do this with the following steps:
- Make sure the
install_requires
kwarg insetup.py
is up to date with all mandatory packages. If you have added new depedendencies, add them here.
NOTE: The preferred format is to use
>=
to constrain package versions, rather than==
. Try not to write code that requires a<
constraint, since this could cause user-dependent conflicts. As an example of this poor practice, the latest version of spyder has a conflict with the latest versions of pyqt5.
-
Update the version number in
__init__.py
in the root module. We have adoped a 3 digit versioning schemex.y.z
wherex
is the major version, each newy
digit corresponds to a substantially new release (with new software components), and thez
digit can increment with any improvements, changes, and bug fixes. -
Update
CHANGELOG.md
-
Run the following from the commandline
python setup.py sdist bdist_wheel
This will create a pylabnet/dist directory (which should not be tracked by github) containing the build files for this version
- To upload to pip, run the command
twine upload dist/*
NOTE: This requires credentials on https://pypi.org, as well as the twine package which can be installed with
pip install twine
NOTE
If you are done using a particular machine for development and would like to use and update the package the standard way via pip, you can remove the pylabnet installation by running the command
python setup.py develop --uninstall
Your local repository can now be deleted and pylabnet can be installed, used, and maintained via pip.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pylabnet-0.2.4.tar.gz
.
File metadata
- Download URL: pylabnet-0.2.4.tar.gz
- Upload date:
- Size: 268.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d2130a730cf2fca24bd9f81d67e5ad8118c8d71c6d2839249b4f325956957da |
|
MD5 | c2facc8285b67c4b1d0dd033e5ccd31b |
|
BLAKE2b-256 | d5f3882423c79cee146f727b0363adb3a523f8e06906f7775d35a92e5a76d5d4 |
File details
Details for the file pylabnet-0.2.4-py3-none-any.whl
.
File metadata
- Download URL: pylabnet-0.2.4-py3-none-any.whl
- Upload date:
- Size: 184.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20c0e9a97a2d38a54906d2ffb0909f9114087ce1f577c5eedcc3b734cd02eaac |
|
MD5 | 2e708207cab7cbbff4ae3f44e260dba0 |
|
BLAKE2b-256 | 3b1eb8b7393ed6ce12410404e6adfcf6bb9aad423a74913bf9c0ec15d2be6e32 |