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

python: EventLog accept pathlib.Path #468

Merged
merged 3 commits into from
Oct 2, 2023
Merged

python: EventLog accept pathlib.Path #468

merged 3 commits into from
Oct 2, 2023

Conversation

judfs
Copy link
Contributor

@judfs judfs commented Sep 15, 2023

pathlib was introduced in 3.4 (2014). Could also add the type hint typing.Union[str, bytes, os.PathLike]. PathLike is from py 3.6 (2016)

Copy link
Contributor

@nosracd nosracd left a comment

Choose a reason for hiding this comment

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

Would it be possible to wrap these in try/except blocks? Then users on newer versions of Python could benefit from these features but users on older versions wouldn't be forced to upgrade to use LCM

@judfs
Copy link
Contributor Author

judfs commented Sep 28, 2023

I've found that if sys.version_info >= (3, 6): is preferred by pylance over try:.

What is the target supported versions? Do you want 3.3 to still work?

@nosracd
Copy link
Contributor

nosracd commented Sep 28, 2023

I've found that if sys.version_info >= (3, 6): is preferred by pylance over try:.

I agree; that's a better way to do it

What is the target supported versions? Do you want 3.3 to still work?

That's a bit tricky. In the last release we dropped Python 2 support but we haven't declared a minimum version of Python 3. So right now it's just "as old as is reasonably convenient to support".

@judfs
Copy link
Contributor Author

judfs commented Sep 28, 2023

I assume this works, but I've not tested with older versions

Copy link
Contributor

@nosracd nosracd left a comment

Choose a reason for hiding this comment

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

I tested this on Python 3.5 (Ubuntu 16.04) and it worked as expected (although I had to revert 9e827af to get cmake to find python). I tried to test it on Python 3.4 (Ubuntu 14.04), but that version of Ubuntu's cmake is too low of a version. In hindsight after exploring all that I think it makes to say that the minimum version we support is Python 3.6 (Ubuntu 18.04). I think the PR in its current state has some value because it makes the path easier for someone trying to get Python 3.5 to work with LCM (only need to revert one commit rather than two) so I'm good with merging it in its current state. I'm also good with merging just your original commit (6b59eb0) without the backwards compatibility. Which would you rather do?

@judfs
Copy link
Contributor Author

judfs commented Oct 2, 2023

I'm fine with as it is. It doesn't add much value but first commit doesn't have the type hint.

Readme should probably spell out Python >= 3.6 is supported. Somewhere it might be nice to enumerate everything LCM 1.4 supported as well.

@nosracd nosracd merged commit 8878041 into lcm-proj:master Oct 2, 2023
11 checks passed
@judfs judfs deleted the path branch April 10, 2024 18:51
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