From 362e1f3487b8b39bc30778d44529fa065c53003c Mon Sep 17 00:00:00 2001 From: Kenneth Yang <82800265+kjy5@users.noreply.github.com> Date: Tue, 24 Dec 2024 13:05:26 -0800 Subject: [PATCH] 404 2.0 documentation (#410) * Init docs with some index files and nav setup * Scaffold docs * Indices, installation, usage * Nice things * Adding a manipulator * Added home cards * Better cards and grammar * Colors and icons * Setup for docstring (won't do yet) * Add build scripts, remove type checking * Install Python in build * Use separate environment without install --- .github/workflows/autoformat-and-lint.yml | 4 +- .github/workflows/build-docs.yml | 36 +++++++++ .github/workflows/deploy-docs.yml | 41 ++++++++++ README.md | 18 ++--- assets/icon.ico => docs/assets/favicon.ico | Bin docs/assets/icon.png | Bin 0 -> 8260 bytes docs/development/adding_a_manipulator.md | 52 ++++++++++++ docs/development/code_organization.md | 3 + docs/development/index.md | 26 ++++++ docs/development/socketio_api.md | 7 ++ docs/home/contact.md | 6 ++ docs/home/how_it_works.md | 7 ++ docs/home/installation.md | 37 +++++++++ docs/home/supported_manipulators.md | 10 +++ docs/index.md | 51 ++++++++++++ docs/stylesheets/extra.css | 5 ++ docs/usage/connecting_to_pinpoint.md | 6 ++ docs/usage/experiment_automation.md | 8 ++ docs/usage/index.md | 62 ++++++++++++++ ephys_link.spec | 2 +- mkdocs.yml | 89 +++++++++++++++++++++ pyproject.toml | 58 +++----------- qodana.yaml | 29 ------- 23 files changed, 468 insertions(+), 89 deletions(-) create mode 100644 .github/workflows/build-docs.yml create mode 100644 .github/workflows/deploy-docs.yml rename assets/icon.ico => docs/assets/favicon.ico (100%) create mode 100644 docs/assets/icon.png create mode 100644 docs/development/adding_a_manipulator.md create mode 100644 docs/development/code_organization.md create mode 100644 docs/development/index.md create mode 100644 docs/development/socketio_api.md create mode 100644 docs/home/contact.md create mode 100644 docs/home/how_it_works.md create mode 100644 docs/home/installation.md create mode 100644 docs/home/supported_manipulators.md create mode 100644 docs/index.md create mode 100644 docs/stylesheets/extra.css create mode 100644 docs/usage/connecting_to_pinpoint.md create mode 100644 docs/usage/experiment_automation.md create mode 100644 docs/usage/index.md create mode 100644 mkdocs.yml delete mode 100644 qodana.yaml diff --git a/.github/workflows/autoformat-and-lint.yml b/.github/workflows/autoformat-and-lint.yml index 15ecaaf..527f1c6 100644 --- a/.github/workflows/autoformat-and-lint.yml +++ b/.github/workflows/autoformat-and-lint.yml @@ -38,5 +38,5 @@ jobs: - name: ๐Ÿงถ Lint run: hatch fmt --check - - name: ๐Ÿ” Type Check - run: hatch -e types run check \ No newline at end of file +# - name: ๐Ÿ” Type Check +# run: hatch -e types run check \ No newline at end of file diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml new file mode 100644 index 0000000..825ed65 --- /dev/null +++ b/.github/workflows/build-docs.yml @@ -0,0 +1,36 @@ +name: Build Documentation + +on: + pull_request: + branches: [ "main" ] + workflow_dispatch: + workflow_call: + +jobs: + build: + name: Build + + runs-on: ubuntu-latest + + steps: + - name: ๐Ÿ›Ž Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + + - name: ๐Ÿ Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.13" + cache: "pip" + + - name: ๐Ÿ“ฆ Install Hatch + uses: pypa/hatch@install + + - name: ๐Ÿ”จ Build Documentation + run: hatch -e docs run build + + - name: โฌ†๏ธ Upload Artifacts + uses: actions/upload-pages-artifact@v3 + with: + path: "site" \ No newline at end of file diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml new file mode 100644 index 0000000..9c4af77 --- /dev/null +++ b/.github/workflows/deploy-docs.yml @@ -0,0 +1,41 @@ +name: Deploy Documentation + +on: + push: + branches: [ "main" ] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "deploy-docs" + cancel-in-progress: true + +jobs: + + build: + name: Build + uses: ./.github/workflows/build-docs.yml + + deploy: + name: Deploy Documentation + + needs: build + + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + runs-on: ubuntu-latest + + steps: + + - name: ๐ŸŽ› Setup Pages + uses: actions/configure-pages@v5 + + - name: ๐Ÿš€ Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/README.md b/README.md index 6ef071c..4b3d1d6 100644 --- a/README.md +++ b/README.md @@ -8,20 +8,22 @@ -Manipulator and probe in pinpoint moving in sync - The [Electrophysiology Manipulator Link](https://github.com/VirtualBrainLab/ephys-link) (or Ephys Link for short) is a Python [Socket.IO](https://socket.io/docs/v4/#what-socketio-is) server that allows any Socket.IO-compliant application (such as [Pinpoint](https://github.com/VirtualBrainLab/Pinpoint)) to communicate with manipulators used in electrophysiology experiments. +Manipulator and probe in pinpoint moving in sync + **Supported Manipulators:** -| Manufacturer | Model | -|--------------|-------------------------------------------------------------------------| -| Sensapex | | -| New Scale | | +| Manufacturer | Model | +|--------------|---------------------------------------------------------| +| Sensapex | | +| New Scale | | +| Scientifica | | +| LabMaker | | Ephys Link is an open and extensible platform. It is designed to easily support integration with other manipulators. @@ -45,10 +47,6 @@ the [API reference](https://virtualbrainlab.org/api_reference_ephys_link.html). connected to the computer. Follow the instructions on that repo for how to set up the Arduino. -**NOTE:** Ephys Link is an HTTP server without cross-origin support. The server -is currently designed to interface with local/desktop instances of Pinpoint. It -will not work with the web browser versions of Pinpoint at this time. - ## Launch from Pinpoint (Recommended) Pinpoint comes bundled with the correct version of Ephys Link. If you are using Pinpoint on the same computer your diff --git a/assets/icon.ico b/docs/assets/favicon.ico similarity index 100% rename from assets/icon.ico rename to docs/assets/favicon.ico diff --git a/docs/assets/icon.png b/docs/assets/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..17a7f46722b756d5cddd69267cca25f08dcc537e GIT binary patch literal 8260 zcmb7J^;Z;Lu%{cAW&wevQ|Vf|S-O;#P8R_|I;1;XQW_T!B_x-U?ha8FR=U9jX%KTk1bB~Uzr5Y}qr>zu z(on{zoqDqWnBcf5=_+Ah)Ta^uv%`JN3B5GUeK0V{`u{V`Vb4lO3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CZ51vG2eO7zyjc*|?DQ@0EQDCXW&!7Z2X$>_x7vTgs7i|!pddBZAK z7sHu}xzCm%7^FS5Qra)EL+_2IAGHRSIuSq`TGkYSo$>|2GRTP_jzFwooDT1Ac7`!MqT8l2$^ud7q|pMr z7n|~ZLliU|PGql@yH+c*x46-@tN>wOH3hESuf(Vxj*ENgE3V*watZG(RBFRZ6Takk zQu`3O4il|YZBXIbGM(L>MeF-~KHpJ}-Cq;vL#Rl171fv>IU84|BH23}Cb-<3us<;T zReo2vTCG$JeVj#HZI+P&-QIbuu&w%Xt=RJ;ulyWo0ipfG#0R$~y>R-xLldhxy3)Q) z7s+44KKfK!Cwqie8;?MjC83O^C2ruVZMD^j68Jxv_jQ*o3JU_u?r#&zXqhqz*!_3cfCaX?OaW5@bnE-Fcp1{u${2tBZv-+rS$sf;=fRR`MuE54pp@vg^` z&=8#F5AbxQAzGgT#uuSH6?oSoq;-~Kf?m(5uHDkoWvL1u1nkHY3LRLxy0q5Zh!8#f z1Yw?(>Xy`l)bDiC|Aq+B_s1#X6T=Tm-+g)zfJ@%86l*seh*j>VAQgx4IzpRx5~Xo- zuK>N=dQ$$lq=s#{zFjk}g|iqA!a*JDn3JTZ50CxLV=P~P&Ji^d31#6N%dW0lq@0Pn z3rQnQt?57e5c4U+^ZAUkhOl@~M60j&?)0z(5(c&j5ZV;Nh(QE1vY!+Wig+dQVptnX zWLe>le&1j(jSmB@?1FBGXPtNA-zd#E2O6VBU)MN>^ShM4$f zZm7d(>q4mnv-zhN=6(L);n*7UG171~qPm=FQN#}tV&?bWcovpI7d+q!tmf>OO(THDjjj9diNq#0@HQ-{}o(&(%aRvGUMk-JpTM+K-Bb9 JYn5#y{|6KSy4U~! literal 0 HcmV?d00001 diff --git a/docs/development/adding_a_manipulator.md b/docs/development/adding_a_manipulator.md new file mode 100644 index 0000000..87c6009 --- /dev/null +++ b/docs/development/adding_a_manipulator.md @@ -0,0 +1,52 @@ +By the end of this section, you will be able to add a manipulator platform to Ephys Link and control it using the server +API. This is a software development guide and assumes you have experience with Python. + +## Set Up for Development + +1. Fork the [Ephys Link repository](https://github.com/VirtualBrainLab/ephys-link). +2. Follow the instructions for [installing Ephys Link for development](index.md/#installing-for-development) to get all + the necessary dependencies and tools set up. In this case, you'll want to clone your fork. + +## Create a Manipulator Binding + +Manipulators are added to Ephys Link through bindings. A binding is a Python class that extends the abstract base class +`BaseBinding` and defines the functions Ephys Link expects from a platform. + +Create a new Python module in `src/ephys_link/bindings` for your manipulator. Make a class that extends +`BaseBinding`. Most IDEs will automatically import the necessary classes and tell you the methods you need to +implement. These functions have signature documentation describing what they should do. + +As described in the [system overview](../home/how_it_works.md), Ephys Link converts all manipulator movement into a +common "unified space" which is +the [left-hand cartesian coordinate system](https://www.scratchapixel.com/lessons/mathematics-physics-for-computer-graphics/geometry/coordinate-systems.html). +The two functions `platform_space_to_unified_space` and `unified_space_to_platform_space` are used to convert between +your manipulator's coordinate system and the unified space. + +!!! tip + + See + the [Sensapex uMp-4](https://github.com/VirtualBrainLab/ephys-link/blob/main/src/ephys_link/bindings/ump_4_bindings.py) + binding for an example where the platform has a Python API (Sensapex's SDK) and + the [New Scale Pathfinder MPM](https://github.com/VirtualBrainLab/ephys-link/blob/main/src/ephys_link/bindings/mpm_bindings.py) + binding for an example where the platform uses a REST API to an external provider. + +## Register the Binding + +To make Ephys Link aware of your new binding, you'll need to register it in +`src/ephys_link/back_end/platform_handler.py`. In the function [ +`_match_platform_type`](https://github.com/VirtualBrainLab/ephys-link/blob/c00be57bb552e5d0466b1cfebd0a54d555f12650/src/ephys_link/back_end/platform_handler.py#L69), +add a new `case` to the `match` statement that returns an instance of your binding when matched to the desired CLI name +for your platform. For example, to use Sensapex's uMp-4 the CLI launch command is `ephys_link.exe -b -t ump-4`, +therefore the matching case statement is `ump-4`. + +## Test Your Binding + +Once you've implemented your binding, you can test it by running Ephys Link using your binding +`ephys_link -b -t `. You can interact with it using the Socket.IO API or Pinpoint. + +## Submit Your Changes + +When you're satisfied with your changes, submit a pull request to the main repository. We will review your changes and +merge them if they meet our standards! + +Feel free to [reach out](../home/contact.md) to us if you have any questions or need help with your binding! \ No newline at end of file diff --git a/docs/development/code_organization.md b/docs/development/code_organization.md new file mode 100644 index 0000000..c23057b --- /dev/null +++ b/docs/development/code_organization.md @@ -0,0 +1,3 @@ +!!! warning "Under Construction" + + This documentation page is still under construction. Please come back later for more information! diff --git a/docs/development/index.md b/docs/development/index.md new file mode 100644 index 0000000..17c979f --- /dev/null +++ b/docs/development/index.md @@ -0,0 +1,26 @@ +# Developing with Ephys Link + +Ephys Link is free and open-source software. All of our code is available +on [GitHub](https://github.com/VirtualBrainLab/ephys-link), and we welcome contributions from the community! + +This section describes: + +- [The Socket.IO server's API](socketio_api.md) and how to communicate with Ephys Link from a client application +- How to [add a new manipulator](adding_a_manipulator.md) to Ephys Link +- General [code organization](code_organization.md) and development practices for Ephys Link + +## Installing for Development + +1. Clone the repository. +2. Install [Hatch](https://hatch.pypa.io/latest/install/) +3. In a terminal, navigate to the repository's root directory and run + + ```bash + hatch shell + ``` + +This will create a virtual environment, install Python 13 (if not found), and install the package in editable mode. + +If you encounter any dependency issues (particularly with `aiohttp`), try installing the latest Microsoft Visual C++ +(MSVC v143+ x86/64) and the Windows SDK (10/11) +via [Visual Studio Build Tools Installer](https://visualstudio.microsoft.com/visual-cpp-build-tools/). diff --git a/docs/development/socketio_api.md b/docs/development/socketio_api.md new file mode 100644 index 0000000..964345e --- /dev/null +++ b/docs/development/socketio_api.md @@ -0,0 +1,7 @@ +This section documents the Socket.IO API. The document is intended for developers building client applications that +communicate with the server. If you are looking for information on how to set up and run the server, see the +[installation guide](../home/installation.md)! + +!!! warning "Under Construction" + + This documentation page is still under construction. Please come back later for more information! diff --git a/docs/home/contact.md b/docs/home/contact.md new file mode 100644 index 0000000..96630da --- /dev/null +++ b/docs/home/contact.md @@ -0,0 +1,6 @@ +Kenneth J. Yang is the primary developer and maintainer of Ephys Link. You can find his contact information on the +VBL [about page](https://virtualbrainlab.org/about/overview.html) along with Daniel Birman's (the co-developer of Ephys Link). + +As an open source project, we welcome [bug reports](https://github.com/VirtualBrainLab/ephys-link/issues) +and [discussions](https://github.com/VirtualBrainLab/ephys-link/discussions) on +our [GitHub page](https://github.com/VirtualBrainLab/ephys-link)! \ No newline at end of file diff --git a/docs/home/how_it_works.md b/docs/home/how_it_works.md new file mode 100644 index 0000000..d35753f --- /dev/null +++ b/docs/home/how_it_works.md @@ -0,0 +1,7 @@ +This section provides an overview of how Ephys Link works. It is intended for users who want to understand the +software's architecture and how it interacts with other systems. + +!!! warning "Under Construction" + + This documentation page is still under construction. Please come back later for more information! + diff --git a/docs/home/installation.md b/docs/home/installation.md new file mode 100644 index 0000000..170a361 --- /dev/null +++ b/docs/home/installation.md @@ -0,0 +1,37 @@ +## Prerequisites + +1. An **x86 Windows PC is required** to run the server. +2. For Sensapex devices, the controller unit must be connected via an ethernet + cable and powered. A USB-to-ethernet adapter is acceptable. For New Scale manipulators, + the controller unit must be connected via USB and be powered by a 6V power + supply. +3. To use the emergency stop feature, ensure an Arduino with + the [StopSignal](https://github.com/VirtualBrainLab/StopSignal) sketch is + connected to the computer. Follow the instructions on that repo for how to + set up the Arduino. + +## Pinpoint (Recommended Method) + +Pinpoint comes bundled with the correct version of Ephys Link. If you are using Pinpoint on the same computer your +manipulators are connected to, you can launch the server from within Pinpoint. See documentation +on [connecting from Pinpoint](../usage/connecting_to_pinpoint.md). + +## Install as a Standalone Executable + +Download the latest executable from the [releases page](https://github.com/VirtualBrainLab/ephys-link/releases/latest). + +## Install as a Python package + +```bash +pip install ephys-link +``` + +or with [pipx](https://pipx.pypa.io/stable/) (recommended) + +```bash +pipx install ephys-link +``` + +## Install for Development + +See [development documentation](../development/index.md/#installing-for-development) for more information. \ No newline at end of file diff --git a/docs/home/supported_manipulators.md b/docs/home/supported_manipulators.md new file mode 100644 index 0000000..59fbbd4 --- /dev/null +++ b/docs/home/supported_manipulators.md @@ -0,0 +1,10 @@ +This is a current list of planned and supported manipulators in Ephys Link. If you use a manipulator that is not listed +here, we suggest reaching out to your manipulator's manufacturer to request support for Ephys Link. Direct them to +contact [Kenneth Yang and Daniel Birman](https://virtualbrainlab.org/about/overview.html)! + +| Manufacturer | Model | +|--------------|---------------------------------------------------------| +| Sensapex |
  • uMp-4
  • uMp-3 (Coming Soon!)
| +| New Scale |
  • Pathfinder MPM Control v2.8+
| +| Scientifica |
  • InVivoStar (Coming Soon!)
| +| LabMaker |
  • (Coming Soon!)
| diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..0d75238 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,51 @@ +# Electrophysiology Manipulator Link + +[![PyPI version](https://badge.fury.io/py/ephys-link.svg)](https://badge.fury.io/py/ephys-link) +[![CodeQL](https://github.com/VirtualBrainLab/ephys-link/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/VirtualBrainLab/ephys-link/actions/workflows/codeql-analysis.yml) +[![Dependency Review](https://github.com/VirtualBrainLab/ephys-link/actions/workflows/dependency-review.yml/badge.svg)](https://github.com/VirtualBrainLab/ephys-link/actions/workflows/dependency-review.yml) +[![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch) +[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) + +The [Electrophysiology Manipulator Link](https://github.com/VirtualBrainLab/ephys-link) +(or Ephys Link for short) is a Python [Socket.IO](https://socket.io/docs/v4/#what-socketio-is) server that allows any +Socket.IO-compliant application (such +as [Pinpoint](https://github.com/VirtualBrainLab/Pinpoint)) +to communicate with manipulators used in electrophysiology experiments. + +Manipulator and probe in pinpoint moving in sync + +
+ +- __:fontawesome-solid-download: Get Started__ + + --- + + Install Ephys Link and get started in seconds + + + [:octicons-arrow-right-24: Install](home/installation.md) + +- __:fontawesome-solid-computer: Usage__ + + --- + + Learn how to use Ephys Link to control your manipulators + + [:octicons-arrow-right-24: Usage](usage/index.md) + +- __:fontawesome-regular-square-plus: Add a Manipulator Platform__ + + --- + + Add a new manipulator platform to Ephys Link to enable control + + [:octicons-arrow-right-24: Develop](development/adding_a_manipulator.md) + +- __:fontawesome-solid-book-open: Learn About Pinpoint__ + + --- + + Pinpoint is an experiment planning and automation tool that uses Ephys Link + + [:octicons-arrow-right-24: Learn More](https://virtualbrainlab.org/pinpoint/installation_and_use.html) +
\ No newline at end of file diff --git a/docs/stylesheets/extra.css b/docs/stylesheets/extra.css new file mode 100644 index 0000000..2b601ab --- /dev/null +++ b/docs/stylesheets/extra.css @@ -0,0 +1,5 @@ +:root { + --md-primary-fg-color: #0FBBBB; + --md-primary-fg-color--light: #0FBBBB; + --md-primary-fg-color--dark: #0FBBBB; +} \ No newline at end of file diff --git a/docs/usage/connecting_to_pinpoint.md b/docs/usage/connecting_to_pinpoint.md new file mode 100644 index 0000000..ff9879c --- /dev/null +++ b/docs/usage/connecting_to_pinpoint.md @@ -0,0 +1,6 @@ +[Pinpoint](https://github.com/VirtualBrainLab/Pinpoint) is a tool for planning electrophysiology recordings and other +_in vivo_ insertions, as well as tracking the position of probes in real-time inside the brain. + +Ephys Link was developed alongside Pinpoint to facilitate tracking and positioning of manipulators. Follow the +[instructions on Pinpoint's documentation](https://virtualbrainlab.org//pinpoint/tutorials/tutorial_ephys_link.html) to +use Ephys Link inside Pinpoint! diff --git a/docs/usage/experiment_automation.md b/docs/usage/experiment_automation.md new file mode 100644 index 0000000..c79e9dc --- /dev/null +++ b/docs/usage/experiment_automation.md @@ -0,0 +1,8 @@ +Pinpoint and Ephys Link can work together to automate manual procedures in electrophysiology experiments. Follow the +[instructions on Pinpoint's documentation](https://virtualbrainlab.org//pinpoint/tutorials/tutorial_ephys_copilot.html) +to use automation in your next experiment! + +!!! note + + Automation is still in early development. We recommend [contacting](https://virtualbrainlab.org/about/overview.html) + Dan Birman and Kenneth Yang if you would like to try it out! \ No newline at end of file diff --git a/docs/usage/index.md b/docs/usage/index.md new file mode 100644 index 0000000..4312a22 --- /dev/null +++ b/docs/usage/index.md @@ -0,0 +1,62 @@ +# Using Ephys Link + +Ephys Link is a server that runs in the background. + +!!! info + + Most people should use Ephys Link through Pinpoint. See documentation + on [connecting from Pinpoint](connecting_to_pinpoint.md) and using Ephys Link + for [experiment automation](experiment_automation.md). + +If you are building a client application that will talk to Ephys Link, see +the [Socket.IO API reference](../development/socketio_api.md). + +There are different ways of launching Ephys Link depending on its installation. + +## Standalone Executable (GUI) + +1. Double-click the executable file to launch the configuration window. + 1. Take note of the IP address and port. **Copy this information into Pinpoint to connect**. +2. Select the desired configuration and click "Launch Server". + +The configuration window will close and the server will launch. Your configurations will be saved for future use. + +To connect to the server from Pinpoint, provide the IP address and port. For example, if the server is running on the +same computer that Pinpoint is, use + +- Server: `localhost` +- Port: `3000` + +If the server is running on a different (local) computer, use the IP address of that computer as shown in the startup +window instead of `localhost`. + +## Standalone Executable (CLI) + +Ephys Link can be launched from the command line directly without the +configuration window. This is useful for computers +or servers without graphical user interfaces. + +With the standalone executable downloaded, invoking the executable from the +command line: + +```bash +EphysLink-vX.X.X.exe -b +``` + +Use the actual name of the executable you downloaded. The `-b` or `--background` flag will launch the server without the +configuration window and read configuration from CLI arguments. + +Here are some examples of how to start Ephys Link with a specific platform (replace `EphysLink.exe` with the actual name +of the executable you downloaded): + +| Manipulator Platform | Command | +|----------------------------------------|--------------------------------------| +| Sensapex uMp-4 (default) | `EphysLink.exe -b` | +| New Scale Pathfinder MPM Control v2.8+ | `EphysLink.exe -b -t pathfinder-mpm` | + +More options can be viewed by running `EphysLink.exe -h`. + +## Python Package + +Ephys Link can be invoked from the command line with the same arguments as the standalone executable using the +`ephys-link` binary (or `el` for short). \ No newline at end of file diff --git a/ephys_link.spec b/ephys_link.spec index 0eaef3f..0378503 100644 --- a/ephys_link.spec +++ b/ephys_link.spec @@ -46,7 +46,7 @@ if options.dir: target_arch=None, codesign_identity=None, entitlements_file=None, - icon='assets\\icon.ico', + icon='docs\\assets\\favicon.ico', ) # noinspection PyUnresolvedReferences coll = COLLECT(exe, a.binaries, a.datas, strip=False, upx=True, upx_exclude=[], name=FILE_NAME) diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..49b7848 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,89 @@ +# yaml-language-server: $schema=https://squidfunk.github.io/mkdocs-material/schema.json + +site_name: Ephys Link +site_url: https://virtualbrainlab.github.io/ephys-link +repo_url: https://github.com/VirtualBrainLab/ephys-link\ +repo_name: virtualbrainlab/ephys-link +copyright: Copyright © 2024 Virtual Brain Lab +extra: + social: + - icon: fontawesome/brands/github + link: https://github.com/VirtualBrainLab/ephys-link + - icon: fontawesome/brands/python + link: https://pypi.org/project/ephys-link + - icon: fontawesome/solid/globe + link: https://virtualbrainlab.org +theme: + name: material + logo: assets/icon.png + favicon: assets/favicon.ico + palette: + # Palette toggle for automatic mode + - media: "(prefers-color-scheme)" + toggle: + icon: material/brightness-auto + name: Switch to light mode + # Palette toggle for light mode + - media: "(prefers-color-scheme: light)" + scheme: default + primary: custom + toggle: + icon: material/brightness-7 + name: Switch to dark mode + # Palette toggle for dark mode + - media: "(prefers-color-scheme: dark)" + scheme: slate + primary: custom + toggle: + icon: material/brightness-4 + name: Switch to system preference + features: + - content.code.copy + - navigation.tracking + - navigation.tabs + - navigation.tabs.sticky + - navigation.sections + - navigation.indexes + - toc.follow +extra_css: + - stylesheets/extra.css +markdown_extensions: + - admonition + - attr_list + - md_in_html + - pymdownx.details + - pymdownx.superfences + - pymdownx.highlight: + anchor_linenums: true + line_spans: __span + pygments_lang_class: true + - pymdownx.inlinehilite + - pymdownx.snippets + - pymdownx.superfences + - pymdownx.emoji: + emoji_index: !!python/name:material.extensions.emoji.twemoji + emoji_generator: !!python/name:material.extensions.emoji.to_svg +plugins: + - search + - mkdocstrings: + handlers: + python: + paths: [ src ] + options: + docstring_style: sphinx +nav: + - Home: + - index.md + - Installation: home/installation.md + - "How it Works": home/how_it_works.md + - "Supported Manipulators": home/supported_manipulators.md + - Contact: home/contact.md + - Usage: + - usage/index.md + - "Connecting to Pinpoint": usage/connecting_to_pinpoint.md + - "Experiment Automation": usage/experiment_automation.md + - Development: + - development/index.md + - "Socket.IO API": development/socketio_api.md + - "Adding a Manipulator": development/adding_a_manipulator.md + - "Code Organization": development/code_organization.md \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 3d65770..2f3f9d9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -60,58 +60,22 @@ exclude = ["/.github", "/.idea"] [tool.hatch.envs.default] python = "3.13.1" dependencies = [ -# "coverage[toml]>=6.5", -# "pytest", + "pyinstaller==6.11.1", ] -#[tool.hatch.envs.default.scripts] -#test = "pytest {args:tests}" -#test-cov = "coverage run -m pytest {args:tests}" -#cov-report = [ -# "- coverage combine", -# "coverage report", -#] -#cov = [ -# "test-cov", -# "cov-report", -#] +[tool.hatch.envs.default.scripts] +exe = "pyinstaller.exe ephys_link.spec -y -- -d && pyinstaller.exe ephys_link.spec -y" +exe-clean = "pyinstaller.exe ephys_link.spec -y --clean" -[tool.hatch.envs.exe] -python = "3.13" -dependencies = [ - "pyinstaller", -] -[tool.hatch.envs.exe.scripts] -build = "pyinstaller.exe ephys_link.spec -y -- -d && pyinstaller.exe ephys_link.spec -y" -build_onefile = "pyinstaller.exe ephys_link.spec -y" -build_clean = "pyinstaller.exe ephys_link.spec -y --clean" - -[tool.hatch.envs.types] -python = "3.13" +[tool.hatch.envs.docs] +python = "3.13.1" skip-install = true dependencies = [ - "mypy", + "mkdocs-material==9.5.49", + "mkdocstrings-python==1.12.2", ] -[tool.hatch.envs.types.scripts] -check = "mypy --strict --install-types --non-interactive --ignore-missing-imports {args:src/ephys_link tests}" - -#[tool.coverage.run] -#source_pkgs = ["ephys_link", "tests"] -#branch = true -#parallel = true -#omit = [ -# "src/ephys_link/__about__.py", -#] -# -#[tool.coverage.paths] -#ephys_link = ["src/ephys_link", "*/ephys-link/src/ephys_link"] -#tests = ["tests", "*/ephys-link/tests"] -# -#[tool.coverage.report] -#exclude_lines = [ -# "no cov", -# "if __name__ == .__main__.:", -# "if TYPE_CHECKING:", -#] +[tool.hatch.envs.docs.scripts] +serve = "mkdocs serve" +build = "mkdocs build" [tool.ruff.lint] extend-ignore = ["DTZ005"] \ No newline at end of file diff --git a/qodana.yaml b/qodana.yaml deleted file mode 100644 index 84e3e49..0000000 --- a/qodana.yaml +++ /dev/null @@ -1,29 +0,0 @@ -#-------------------------------------------------------------------------------# -# Qodana analysis is configured by qodana.yaml file # -# https://www.jetbrains.com/help/qodana/qodana-yaml.html # -#-------------------------------------------------------------------------------# -version: "1.0" - -#Specify inspection profile for code analysis -profile: - name: qodana.starter - -#Enable inspections -#include: -# - name: - -#Disable inspections -#exclude: -# - name: -# paths: -# - - -#Execute shell command before Qodana execution (Applied in CI/CD pipeline) -#bootstrap: sh ./prepare-qodana.sh - -#Install IDE plugins before Qodana execution (Applied in CI/CD pipeline) -#plugins: -# - id: #(plugin id can be found at https://plugins.jetbrains.com) - -#Specify Qodana linter for analysis (Applied in CI/CD pipeline) -linter: jetbrains/qodana-python:latest