Skip to content

Commit 90196a0

Browse files
authored
Merge pull request #11 from linien-org/release/2.0.0
Release v2.0.0
2 parents 4744ec8 + 0bf6e50 commit 90196a0

File tree

11 files changed

+218
-194
lines changed

11 files changed

+218
-194
lines changed

.flake8

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/workflows/publish-pypi.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

.github/workflows/publish-test-pypi.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Upload Python Package
2+
3+
on:
4+
push:
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
build:
10+
name: Build distribution
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Set up Python
15+
uses: actions/setup-python@v4
16+
with:
17+
python-version: '3.11'
18+
- name: Install pypa/build
19+
run: |
20+
python -m pip install --upgrade pip
21+
pip install build --user
22+
- name: Build binary wheel and a source tarball
23+
run: python -m build --sdist
24+
- name: Store the distribution packages
25+
uses: actions/upload-artifact@v3
26+
with:
27+
name: python-package-distributions
28+
path: dist/
29+
30+
publish-to-testpypi:
31+
name: Publish to TestPyPI
32+
if: github.event_name == 'release'
33+
needs:
34+
- build
35+
runs-on: ubuntu-latest
36+
37+
environment:
38+
name: testpypi
39+
url: https://test.pypi.org/p/pyrp3
40+
41+
permissions:
42+
id-token: write # IMPORTANT: mandatory for trusted publishing
43+
44+
steps:
45+
- name: Download all the dists
46+
uses: actions/download-artifact@v3
47+
with:
48+
name: python-package-distributions
49+
path: dist/
50+
- name: Publish distribution to TestPyPI
51+
uses: pypa/gh-action-pypi-publish@release/v1
52+
with:
53+
repository-url: https://test.pypi.org/legacy/
54+
55+
publish-to-pypi:
56+
name: Publish to PyPI
57+
if: github.event_name == 'release' && !github.event.release.prerelease
58+
needs: build
59+
runs-on: ubuntu-latest
60+
environment:
61+
name: pypi
62+
url: https://pypi.org/project/pyrp3
63+
permissions:
64+
id-token: write # IMPORTANT: mandatory for trusted publishing
65+
steps:
66+
- name: Download distributions
67+
uses: actions/download-artifact@v3
68+
with:
69+
name: python-package-distributions
70+
path: dist/
71+
- name: Publish to PyPI
72+
uses: pypa/gh-action-pypi-publish@release/v1

README.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# pyrp3
2+
3+
Python 3 port (using [`2to3`](https://docs.python.org/3/library/2to3.html)) of
4+
[PyRedPitaya](https://github.com/clade/PyRedPitaya>) library in the `pyrp3` namespace.
5+
6+
Note: The following is a copy of the Readme from the original repo and might not work
7+
with this version of the library.
8+
9+
## Overview
10+
11+
This package provides a library to access the [Red Pitaya](http://redpitaya.com/) registers.
12+
This library consist of a C library (`libmonitor.c`) and a `ctypes` interface on the Python side.
13+
14+
An object-oriented interface to the different application (scope, generator, PID, AMS, ...) is
15+
provided. This interface is implemented using Python properties (see usage below) and can quickly be
16+
extended to your own application.
17+
18+
A `rpyc` server is used in order to communicate with your computer. The interface is the same on the
19+
computer as the one on the board.
20+
21+
## Installation
22+
23+
To install `pyrp3`` on any machine, run the command:
24+
25+
```bash
26+
pip3 install pyrp3
27+
```
28+
29+
## Usage
30+
31+
You need to have Python installed on you Red Pitaya.
32+
33+
### Interactive Python
34+
35+
Logging onto the redpitaya using ssh, one can start the ipython shell and run :
36+
37+
```python
38+
39+
from pyrp3.board import RedPitaya
40+
41+
redpitaya = RedPitaya()
42+
43+
print(redpitaya.ams.temp) # Read property
44+
redpitaya.hk.led = 0b10101010 # Write property
45+
```
46+
47+
### Remote access
48+
49+
You need to install the `pyrp3` package on your PC as well as `rpyc`:
50+
51+
```bash
52+
rpyc_server
53+
```
54+
55+
On the computer (replace `REDPITAYA_IP` by the string containing the IP address) :
56+
57+
```python
58+
from rpyc import connect
59+
from pyrp3.pc import RedPitaya
60+
61+
conn = connect(REDPITAYA_IP, port=18861)
62+
redpitaya = RedPitaya(conn)
63+
64+
print(redpitaya.read(0x40000000)) # Direct access
65+
66+
print(redpitaya.ams.temp) # Read property
67+
redpitaya.hk.led = 0b10101010 # Write property
68+
69+
from time import sleep
70+
from pylab import *
71+
72+
redpitaya.scope.setup(frequency = 100, trigger_source=1)
73+
sleep(100E-3)
74+
plot(redpitaya.scope.times, redpitaya.scope.data_ch1)
75+
show()
76+
```

README.rst

Lines changed: 0 additions & 75 deletions
This file was deleted.

pyproject.toml

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,62 @@
1+
[build-system]
2+
requires = ["setuptools >= 30.3.0", "wheel", "setuptools_scm[toml]>=6.2"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "pyrp3"
7+
description = "Python utilities for RedPitaya"
8+
dynamic = ["version"]
9+
authors = [
10+
{ name = "Pierre Cladé", email = "[email protected]" },
11+
{ name = "Benjamin Wiegand", email = "[email protected]" },
12+
{ name = "Bastian Leykauf", email = "[email protected]" },
13+
{ name = "Doron Behar", email = "[email protected]" },
14+
]
15+
maintainers = [
16+
{ name = "Bastian Leykauf", email = "[email protected]" },
17+
]
18+
license = { file = "LICENSE" }
19+
readme = "README.md"
20+
requires-python = ">=3.10"
21+
dependencies = [
22+
"cached_property>=1.5.2",
23+
"myhdl>=0.11",
24+
"numpy>=1.21.5",
25+
"rpyc>=5.0,<6.0",
26+
]
27+
classifiers = [
28+
"Programming Language :: Python :: 3",
29+
"License :: OSI Approved :: BSD License",
30+
"Operating System :: POSIX :: Linux",
31+
"Intended Audience :: Science/Research",
32+
"Intended Audience :: Education",
33+
"Topic :: Scientific/Engineering",
34+
]
35+
keywords = ["RedPitaya", "FPGA", "zynq"]
36+
37+
[project.optional-dependencies]
38+
dev = [
39+
"black>=22.8.0",
40+
"pre-commit>=2.20.0",
41+
"flake8>=5.0.4",
42+
"isort>=5.10.1",
43+
"flake8-pyproject>=1.2.3",
44+
"setuptools_scm>=6.2",
45+
]
46+
47+
[tool.setuptools]
48+
packages = ["pyrp3"]
49+
50+
[tool.setuptools_scm]
51+
52+
[project.urls]
53+
homepage = "https://github.com/linien-org/pyrp3/"
54+
repository = "https://github.com/linien-org/pyrp3/"
55+
56+
[tool.flake8]
57+
max-line-length = 88
58+
extend-ignore = "E203"
59+
docstring-convention = "numpy"
60+
161
[tool.isort]
2-
profile = "black"
62+
profile = "black"

pyrp3/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
from ._version import __version__ # noqa F401
1+
from importlib.metadata import PackageNotFoundError, version
2+
3+
try:
4+
__version__ = version("package-name")
5+
except PackageNotFoundError:
6+
# package is not installed
7+
pass

pyrp3/_version.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

requirements.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)