Skip to main content

Python library for importing XDF (Extensible Data Format)

Project description

pylsl

publish workflow PyPI version

This is the Python interface to the Lab Streaming Layer (LSL). LSL is an overlay network for real-time exchange of time series between applications, most often used in research environments. LSL has clients for many other languages and platforms that are compatible with each other.

Let us know if you encounter any bugs (ideally using the issue tracker on the GitHub project).

Installation

Prerequisites

On all non-Windows platforms and for some Windows-Python combinations, you must first obtain a liblsl shared library. See the liblsl repo documentation for further details.

Get pylsl from PyPI

  • pip install pylsl

Get pylsl from source

This should only be necessary if you need to modify or debug pylsl.

  • Download the pylsl source: git clone https://github.com/labstreaminglayer/pylsl.git && cd pylsl
  • From the pylsl working directory, run pip install ..
    • Note: You can use pip install -e . to install while keeping the files in-place. This is convenient for developing pylsl.

Usage

See the examples in pylsl/examples. Note that these can be run directly from the commandline with (e.g.) python -m pylsl.examples.{name-of-example}.

You can get a list of the examples with python -c "import pylsl.examples; help(pylsl.examples)"

liblsl loading

pylsl will search for liblsl first at the filepath specified by an environment variable named PYLSL_LIB, then in the package directory (default location for Windows), then finally in normal system library folders.

If the shared object is not installed onto a standard search path (or it is but can't be found for some other bug), then we recommend that you copy it to the pylsl installed module path's lib subfolder. i.e. {path/to/env/}site-packages/pylsl/lib.

  • The site-packages/pylsl path will only exist after you install pylsl in your Python environment.
  • You may have to create the lib subfolder.
  • Use python -m site to find the "site-packages" path.
  • Use cp -L on platforms that use symlinks.

Alternatively, you can use an environment variable. Set the PYLSL_LIB environment variable to the location of the library or set LD_LIBRARY_PATH to the folder containing the library. For example,

  1. PYLSL_LIB=/usr/local/lib/liblsl.so python -m pylsl.examples.{name-of-example}, or
  2. LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib python -m pylsl.examples.{name-of-example}

For maintainers

Continuous Integration

pylsl uses continuous integration and distribution. GitHub Actions will upload a new release to pypi whenever a Release is created in GitHub. Before creating the GitHub release, be sure to bump the version number in pylsl/version.py and consider updating the liblsl dependency in .github/workflows/publish-to-pypi.yml.

Linux Binaries Deprecated

We recently stopped building binary wheels for Linux. In practice, the manylinux dependencies were often incompatible with real systems.

Manual Distribution

  1. Manual way:
    1. rm -Rf build dist *.egg-info
    2. python setup.py sdist bdist_wheel
    3. Additional steps on Linux:
      • auditwheel repair dist/*.whl -w dist
      • rm dist/*-linux_x86_64.whl
    4. twine upload dist/*
  2. For conda
    1. build liblsl: conda build ../liblsl/
    2. conda build .

Known Issues with Multithreading on Linux

  • At least for some versions of pylsl, it has been reported that running on Linux one cannot call pylsl functions from a thread that is not the main thread. This has been reported to cause access violations, and can occur during pulling from an inlet, and also from accessing an inlets info structure in a thread.
  • Recent tests with multithreading (especially when safeguarding library calls with locks) using Python 3.7.6. with pylsl 1.14 on Linux Mint 20 suggest that this issue is solved, or at least depends on your machine. See https://github.com/labstreaminglayer/pylsl/issues/29

Acknowledgments

Pylsl was primarily written by Christian Kothe while at Swartz Center for Computational Neuroscience, UCSD. The LSL project was funded by the Army Research Laboratory under Cooperative Agreement Number W911NF-10-2-0022 as well as through NINDS grant 3R01NS047293-06S1. pylsl is maintained primarily by Chadwick Boulay. Thanks for contributions, bug reports, and suggestions go to Bastian Venthur, David Medine, Clemens Brunner, and Matthew Grivich.

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

pylsl-1.17.5.tar.gz (39.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pylsl-1.17.5-py2.py3-none-win_amd64.whl (364.2 kB view details)

Uploaded Python 2Python 3Windows x86-64

pylsl-1.17.5-py2.py3-none-win32.whl (293.8 kB view details)

Uploaded Python 2Python 3Windows x86

pylsl-1.17.5-py2.py3-none-any.whl (41.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pylsl-1.17.5.tar.gz.

File metadata

  • Download URL: pylsl-1.17.5.tar.gz
  • Upload date:
  • Size: 39.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.5.8

File hashes

Hashes for pylsl-1.17.5.tar.gz
Algorithm Hash digest
SHA256 e06b2c286435eaf3ff13d93f264e9d96fd10d46d6098a4a7c70651d70d0d26b4
MD5 84bc8e103bd5a7dad0bd563e1b4980b9
BLAKE2b-256 de87b7c28c4acf6ede0b6c923b28b2debd9722c95ca36b47334fbab2ab191e01

See more details on using hashes here.

File details

Details for the file pylsl-1.17.5-py2.py3-none-win_amd64.whl.

File metadata

  • Download URL: pylsl-1.17.5-py2.py3-none-win_amd64.whl
  • Upload date:
  • Size: 364.2 kB
  • Tags: Python 2, Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.5.8

File hashes

Hashes for pylsl-1.17.5-py2.py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 965a2ffc5421dbabfad33c3230b325a2af0fde961190556f4d4c86cebb88f4cb
MD5 e788ef4f1a0a625f3cd56f7471ec3f05
BLAKE2b-256 571f1af04842d2d9143b1fed7817249b0e31684f10dbafd0f8eba0eb448e4f91

See more details on using hashes here.

File details

Details for the file pylsl-1.17.5-py2.py3-none-win32.whl.

File metadata

  • Download URL: pylsl-1.17.5-py2.py3-none-win32.whl
  • Upload date:
  • Size: 293.8 kB
  • Tags: Python 2, Python 3, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.5.8

File hashes

Hashes for pylsl-1.17.5-py2.py3-none-win32.whl
Algorithm Hash digest
SHA256 63e62407e2e55b99c4aac0a0fd9e0ae348906acac750b13989f9a7a1914c13f4
MD5 0bd212f78d1958b6e234da56c021b6b9
BLAKE2b-256 e5babe343cf29218f3c633188341bc6bf27c06a5d29ed3de1e52f73e5986c42a

See more details on using hashes here.

File details

Details for the file pylsl-1.17.5-py2.py3-none-any.whl.

File metadata

  • Download URL: pylsl-1.17.5-py2.py3-none-any.whl
  • Upload date:
  • Size: 41.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.5.8

File hashes

Hashes for pylsl-1.17.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 98be581a16fb56d606628926230064e018e48ba1eedc6e39d9b1d33c2a9d9da7
MD5 a3c0a699a4e50da28ec95c766fbad07c
BLAKE2b-256 d4f582d6f2a2dd7568437ed0200829c54060c9f91cdcb15043b3360708863f1c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page