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

Add photonlibpy #1040

Merged
merged 32 commits into from
Dec 16, 2023
Merged

Add photonlibpy #1040

merged 32 commits into from
Dec 16, 2023

Conversation

gerth2
Copy link
Contributor

@gerth2 gerth2 commented Dec 11, 2023

Add a basic photonlib implementation in python.

all done

@mcm001
Copy link
Contributor

mcm001 commented Dec 11, 2023

Do we ever check version mode strings?

.github/workflows/python.yml Outdated Show resolved Hide resolved
.github/workflows/python.yml Outdated Show resolved Hide resolved
working-directory: ./photon-lib/py
run: |
git fetch --tags --force
python setup.py sdist bdist_wheel
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd recommend using pipx run build.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image
pipx is currently being very sad about installing for me.... thoughts on leaving this one for later?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, pipx's docs recommend scoop over pip for installing pipx.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd probably specifically recommend https://github.com/hynek/build-and-inspect-python-package in GitHub Actions though

photon-lib/py/photonlibpy/multiTargetPNPResult.py Outdated Show resolved Hide resolved
photon-lib/py/photonlibpy/packet.py Outdated Show resolved Hide resolved
photon-lib/py/photonlibpy/photonTrackedTarget.py Outdated Show resolved Hide resolved
photon-lib/py/setup.py Outdated Show resolved Hide resolved
print(f"Building version {versionStr}")

setup(
name='photonlibpy',
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using pyproject.toml, or setup.cfg

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Given that setup.py has expanded already to have build-time python logic.... I'm not sure I know enough to migrate it quickly? As long as you're not certain this will cause immedeate issue, I'd personally rather stick with "works" and enter an issue to followup next summer?

photon-lib/py/setup.py Outdated Show resolved Hide resolved
photon-lib/py/test/photonlibpy_test.py Outdated Show resolved Hide resolved
@gerth2
Copy link
Contributor Author

gerth2 commented Dec 13, 2023

Do we ever check version mode strings?

I am not currently.... I kinda avoided the check out of selfishness. But agreed we... probably... should keep feature parity.

Granted, due to the whole pep440 version scheming thing (which either I"m still missing something on, or python & pypi's versioning requirements just don't jive with), I'm not sure it's fully applicable at the moment.

Well, at least... to make it work correctly, the results of git describe have to be dumped into a source file, and then some notion of "coprocessor expected version" is checked. The version of the python library remains independent. Thoughts on whether that's value add?

@mcm001
Copy link
Contributor

mcm001 commented Dec 13, 2023

Well, without it, the deserialized result could just be total garbage. I think it's something we should absolutely have until we get protobuf in.

@gerth2
Copy link
Contributor Author

gerth2 commented Dec 15, 2023

image
pypi config so far - should be ready to rumble as soon as a tag goes down? Worked in the test environment at least.

@mcm001
Copy link
Contributor

mcm001 commented Dec 15, 2023

Awesome! Since this doesn't touch anything else in photon beside CI, I'm good to be aggressive and merging now

Copy link
Contributor

@mcm001 mcm001 left a comment

Choose a reason for hiding this comment

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

Zero diff ship it

@gerth2 gerth2 merged commit 47aea29 into PhotonVision:master Dec 16, 2023
17 of 21 checks passed


def setVersionCheckEnabled(enabled: bool):
_VERSION_CHECK_ENABLED = enabled
Copy link
Contributor

Choose a reason for hiding this comment

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

This local variable is unused.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

smooth brain moment. issue goin in

x = self.decodeDouble()
y = self.decodeDouble()
z = self.decodeDouble()
translation = Translation3d(x, y, z)
Copy link

Choose a reason for hiding this comment

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

FYI we implemented getStructTopic, not currently released but it'll be available in the kickoff release. See https://github.com/robotpy/mostrobotpy/blob/main/subprojects/pyntcore/tests/test_struct_topic.py

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.

4 participants