8000 Prologix support for both USB and ethernet versions by bobmcnamara · Pull Request #484 · pyvisa/pyvisa-py · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Prologix support for both USB and ethernet versions #484

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
Apr 1, 2025

Conversation

bobmcnamara
Copy link
Contributor

Support added for Prologix GPIB adapters, both USB and ethernet. Examples of usage:

import pyvisa
rm = pyvisa.ResourceManager()
prlgx = rm.open_resource("PRLGX-TCPIP::169.254.1.80::INTFC")
instr = rm.open_resource("GPIB::17::INSTR")
instr.query("*IDN?")

Or for USB version:

import pyvisa
rm = pyvisa.ResourceManager()
prlgx = rm.open_resource("PRLGX-ASRL::/dev/cu.usbserialXXX::INTFC")
instr = rm.open_resource("GPIB::17::INSTR")
instr.query("*IDN?")

  • [n/a] Closes # (insert issue number if relevant)
  • Executed ruff check . && ruff format -c . --check with no errors
  • [ToDo] The change is fully covered by automated unit tests
  • [ToDo] Documented in docs/ as appropriate
  • Added an entry to the CHANGES file

@MatthieuDartiailh
Copy link
Member

Thanks for the PR. I will do my best to review it by early next week.

Copy link
Member
@MatthieuDartiailh MatthieuDartiailh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a bunch of minor stylistic comments.

However I think there is one more serious issue related to thread safety that need to be addressed. When setting the gpib_addr of the interface we need to be sure that no thread will modify it before the interface is done doing the job we need it to do.

bobmcnamara and others added 9 commits January 29, 2025 10:00
Co-authored-by: Matthieu Dartiailh <marul@laposte.net>
Co-authored-by: Matthieu Dartiailh <marul@laposte.net>
Co-authored-by: Matthieu Dartiailh <marul@laposte.net>
Co-authored-by: Matthieu Dartiailh <marul@laposte.net>
Co-authored-by: Matthieu Dartiailh <marul@laposte.net>
Co-authored-by: Matthieu Dartiailh <marul@laposte.net>
Co-authored-by: Matthieu Dartiailh <marul@laposte.net>
@MatthieuDartiailh
Copy link
Member

The mypy failure is logical while waiting for pyvisa/pyvisa#887 the test failure however needs to be addressed (simply by adding the new missing resources).

Copy link
Member
@MatthieuDartiailh MatthieuDartiailh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will do my best to make a complete review next week. But I spotted a couple of oddities.

rev: v0.9.2
rev: v0.8.6
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be reverted.

CHANGES Outdated
@@ -17,7 +17,6 @@ PyVISA-py Changelog
specified by host PR #470
- add support for VI_ATTR_SUPPRESS_END_EN for USB resources PR #449
- support open_timeout for TCPIP hislip resources PR #430
- fix serial flow control configuration PR #483
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The double dash can be corrected but the line should remain.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be reverted.

Copy link
Member
@MatthieuDartiailh MatthieuDartiailh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First sorry for the slow review process.

Overall this looks good. I would just like to avoid storing the prologix interfaces globally. Can you make this change ?

Comment on lines 46 to 47
if parsed.board in prologix.BOARDS:
newcls = prologix.PrologixInstrSession
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the boards are registered through the opening of a resource via the resource manager, I think it would make sense to store them on the library linked to the resource manager. To enable this we could modify the signature of the base Session class which we can do since it is not user facing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion, it's definitely better to eliminate the module-level global. I moved it to a class var instead (in the prologix._PrologixIntfcSession class).

@MatthieuDartiailh
Copy link
Member

I think that rebasing should fix the typing issue. For the test, I will let you have a look. I will try to merge on Tuesday and make a release after.

Copy link
codecov bot commented Mar 25, 2025

Codecov Report

Attention: Patch coverage is 34.74178% with 139 lines in your changes missing coverage. Please review.

Project coverage is 24.85%. Comparing base (b7303fb) to head (b6c05d8).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pyvisa_py/prologix.py 29.47% 121 Missing and 1 partial ⚠️
pyvisa_py/gpib.py 53.84% 12 Missing ⚠️
pyvisa_py/highlevel.py 50.00% 3 Missing and 1 partial ⚠️
pyvisa_py/testsuite/test_sessions.py 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #484      +/-   ##
==========================================
+ Coverage   24.40%   24.85%   +0.44%     
==========================================
  Files          23       24       +1     
  Lines        3515     3713     +198     
  Branches      401      425      +24     
==========================================
+ Hits          858      923      +65     
- Misses       2651     2782     +131     
- Partials        6        8       +2     
Flag Coverage Δ
unittests 24.85% <34.74%> (+0.44%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@MatthieuDartiailh MatthieuDartiailh merged commit e1a66ed into pyvisa:main Apr 1, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0