Skip to content
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

Trio support #583

Closed
wants to merge 41 commits into from
Closed

Trio support #583

wants to merge 41 commits into from

Conversation

altendky
Copy link
Contributor

@altendky altendky commented Jan 3, 2021

#581

Draft for:

  • Being more than an exploration
  • Server tests
  • Client tests
  • Documentation
  • Examples

@altendky
Copy link
Contributor Author

altendky commented Jan 3, 2021

tc.py does run against examples/common/synchronous_server.py and get answers. Though, only the coil read seems correct. Anyways, I just tend to share sooner than later. I have no expectation that anyone will really want to read this at the moment. :]

@altendky
Copy link
Contributor Author

Mostly just for linkage, I have a quick SunSpec layer running on top of this PR over at altendky/ssst#19. That code will likely move out to it's own project once this all settles down a bit. Anyways, this functions in a basic scenario. Maybe I'll take another pass at this in the next couple days.

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot E 1 Security Hotspot
Code Smell A 10 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication



@pytest.mark.trio
async def test_read_holding_registers(trio_tcp_client, trio_tcp_server):
Copy link
Contributor

Choose a reason for hiding this comment

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

These tests looks more like functional tests than unit tests. I can move this to functional tests later to #2 when functional tests actually are in place. Also the test seems to be failing on mac osx with trio.TrioInternalError: internal error in Trio - please file a bug!.

Copy link
Contributor Author

@altendky altendky Apr 28, 2021

Choose a reason for hiding this comment

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

I added a bunch more unit-y tests as well.

@dhoomakethu
Copy link
Contributor

@altendky sorry for picking on this late, can you also add an example for trio client?

proto_cls = kwargs.get("proto_cls", None)
client = init_tcp_client(proto_cls, host, port)

return client
Copy link
Contributor

Choose a reason for hiding this comment

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

This is inconsistent with other factories which return two values.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They do return two values, but I don't see the consistency in the meaning of those two values. Can you help me understand what sort of thing the first value should be and what the second should be? Then I can try to map that into the Trio stuff.

Twisted: protocol / deferred
Tornado: protocol / future
asyncio: event loop / client
Trio: ? / ?

I can see the similarity between Twisted and Tornado. I don't see how asyncio fits. Apparently when I coded this a couple months ago I didn't see what other useful thing I could return in the Trio case. We'll see if I can find something now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@altendky
Copy link
Contributor Author

altendky commented Feb 2, 2021

I was going to come back to this after the CI was redone in #592 so I could have functional CI while working on this. Adding examples is already in the list in the first post explaining why this is a draft PR. I'll address the other concerns when working on this again. Thanks for the feedback.

@altendky
Copy link
Contributor Author

(hopefully I didn't already comment on this and forget...) @dhoomakethu, any interest in enabling read the docs builds for each PR? If you go to https://readthedocs.org/dashboard/pymodbus/advanced/ there should be a checkbox labeled Build pull requests for this project. Beyond just making sure the docs also build on RTD, this acts as a reminder to keep them up to date and let's contributors easily sea the rendered result.

@altendky
Copy link
Contributor Author

Welp, @dhoomakethu I think this is ready for at least a second pass review. I understand that I may not be testing sensibly or need a pile more docs or... So, don't feel obliged to dig into the details if something big is out of line. Anyways, let me know what you think.

Side note, I took this on so I could develop a Trio library for communication with SunSpec devices. That ended up being sundog.

@altendky altendky marked this pull request as ready for review April 28, 2021 21:50
@altendky altendky requested a review from dhoomakethu April 28, 2021 22:01
@dhoomakethu
Copy link
Contributor

@altendky it will be sometime before I go through this. Apologies in advance and thanks for the efforts.

@altendky
Copy link
Contributor Author

altendky commented May 2, 2021

I understand. Took me awhile to get back to it myself and I've got a few other projects I'm playing catch up on. No worries.

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot E 1 Security Hotspot
Code Smell A 8 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@altendky
Copy link
Contributor Author

The PyPy issues should get fixed by #637.

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot E 1 Security Hotspot
Code Smell A 8 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@janiversen
Copy link
Collaborator

As discussed on the issue, I close this for now.

@janiversen janiversen closed this May 25, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants