Skip to content

Commit eb37d64

Browse files
committed
initial public commit
0 parents  commit eb37d64

File tree

234 files changed

+3832
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

234 files changed

+3832
-0
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Python package
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "main" ]
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os:
20+
- "windows-latest"
21+
# - "ubuntu-latest"
22+
python-version:
23+
# - "3.8"
24+
- "3.9"
25+
- "3.10"
26+
python-architecture:
27+
# - "x86"
28+
- "x64"
29+
30+
steps:
31+
- uses: actions/checkout@v3
32+
- name: Set up Python ${{ matrix.python-version }}
33+
uses: actions/setup-python@v4
34+
with:
35+
cache: 'pip'
36+
python-version: ${{ matrix.python-version }}
37+
- name: Install dependencies
38+
run: |
39+
cd py_src
40+
python -m pip install --upgrade pip
41+
pip install -r requirements.txt
42+
# - name: Install flake8 pytest
43+
# run: |
44+
# python -m pip install flake8 pytest
45+
# - name: Lint with flake8
46+
# run: |
47+
# cd py_src
48+
# # stop the build if there are Python syntax errors or undefined names
49+
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
50+
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
51+
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
52+
# - name: Test with pytest
53+
# run: |
54+
# cd py_src
55+
# pytest
56+
# Build python script into a stand-alone exe
57+
- uses: Nuitka/Nuitka-Action@1da0ae7b09188f30aa3955cc84ff36da1b338b0b
58+
with:
59+
module: true
60+
script-name: py_src/src/python_bridge_for_labview
61+
output-dir: build
62+
# - name: Twine Test Binaries
63+
# run: |
64+
# twine check build/*cpython*
65+
# Uploads artifact
66+
- name: Upload Artifact
67+
uses: actions/upload-artifact@v3
68+
with:
69+
name: exe
70+
path: |
71+
build/**/*cpython*
72+
73+

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
# Build Output & Distribution
3+
builds/
4+
py_src/build/
5+
py_src/dist/
6+
py_src/cython_build/
7+
8+
# Python Caches
9+
__pycache__/
10+
*.pyc
11+
12+
# Cythonization
13+
*.c
14+
*.so
15+
*.egg-info
16+
17+
18+
# Local IDE and Environment Settings
19+
.idea/
20+
.dragon/
21+
*.lvlps
22+
*.aliases
23+
venv
24+
.venv

LICENSE

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
BSD+Patent License
2+
3+
Note: This license is designed to provide: a) a simple permissive license; b) that is compatible with the GNU General Public License (GPL), version 2; and c) which also has an express patent grant included. See -> https://opensource.org/license/bsdpluspatent/
4+
5+
Copyright 2004-2023 JKI --> https://jki.net
6+
7+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
8+
9+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
10+
11+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12+
13+
Subject to the terms and conditions of this license, each copyright holder and contributor hereby grants to those receiving rights under this license a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except for failure to satisfy the conditions of this license) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer this software, where such license applies only to those patent claims, already acquired or hereafter acquired, licensable by such copyright holder or contributor that are necessarily infringed by:
14+
15+
(a) their Contribution(s) (the licensed copyrights of copyright holders and non-copyrightable additions of contributors, in source or binary form) alone; or
16+
17+
(b) combination of their Contribution(s) with the work of authorship to which such Contribution(s) was added by such copyright holder or contributor, if, at the time the Contribution is added, such addition causes such combination to be necessarily infringed. The patent license shall not apply to any other combinations which include the Contribution.
18+
19+
Except as expressly stated above, no rights or licenses from any copyright holder or contributor is granted under this license, whether expressly, by implication, estoppel or otherwise.
20+
21+
DISCLAIMER
22+
23+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# JKI Python Bridge for LabVIEW
2+
3+
Easily add a Python API to your LabVIEW application.
4+
5+
[![Image](https://www.vipm.io/package/jki_lib_python_bridge_for_labview/badge.svg?metric=installs)](https://www.vipm.io/package/jki_lib_python_bridge_for_labview/) [![Image](https://www.vipm.io/package/jki_lib_python_bridge_for_labview/badge.svg?metric=stars)](https://www.vipm.io/package/jki_lib_python_bridge_for_labview/)
6+
[![License](https://img.shields.io/badge/License-BSD%2bPatent-blue.svg)](https://opensource.org/license/bsdpluspatent)
7+
[![LabVIEW](https://img.shields.io/badge/LabVIEW-2020-%23E37725.svg?)](https://www.ni.com/en-us/shop/labview/select-edition/labview-community-edition.html) Python 3.6+
8+
9+
## Getting Started
10+
11+
- [Install Package with VIPM](https://www.vipm.io/package/jki_lib_python_bridge_for_labview/)
12+
13+
- Open the Example and Run it
14+
15+
![image](https://user-images.githubusercontent.com/381432/197280513-60e018e6-c4ba-4255-8c43-70af6407f4ee.png)
16+
17+
![image](https://user-images.githubusercontent.com/381432/197280631-0c5e4a1b-b50c-40e7-b195-4ed9d41a6d4e.png)
18+
19+
- Open cmd.exe or powershell.exe terminal
20+
- Create a virtual environment for testing
21+
```
22+
python -m venv .venv
23+
```
24+
- Activate it in PowerShell
25+
```
26+
.\.venv\scripts\activate.ps1
27+
```
28+
- Activate it in a Command Shell
29+
```
30+
.\.venv\scripts\activate.bat
31+
```
32+
Start Python
33+
```
34+
PS C:\projects\jki-labview-python-server> python
35+
Python 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)] on win32
36+
Type "help", "copyright", "credits" or "license" for more information.
37+
```
38+
- Interact with LabVIEW from Python
39+
40+
``` python
41+
>> import jki_lib_python_bridge_for_labview as lv
42+
>> lv.connect()
43+
>>> lv.isConnected
44+
1
45+
>>> lv.example.add(1,2)
46+
3.0
47+
>>>
48+
```
49+
- Understanding what's happening
50+
![image](https://user-images.githubusercontent.com/381432/197281397-c27abceb-d76a-40f6-932b-6f0b8e5e0b8e.png)

Source/Call/Call.lvclass

Lines changed: 94 additions & 0 deletions
Large diffs are not rendered by default.

Source/Call/Create.vi

24.6 KB
Binary file not shown.
24.3 KB
Binary file not shown.
25.3 KB
Binary file not shown.
19.9 KB
Binary file not shown.

Source/Call/Send Return Value.vi

8.86 KB
Binary file not shown.

0 commit comments

Comments
 (0)