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

Use updated upload_pypi action #101

Merged
merged 7 commits into from
Oct 23, 2024
Merged

Conversation

niksirbi
Copy link
Member

@niksirbi niksirbi commented Feb 2, 2024

See neuroinformatics-unit/movement#108 for an explanation.

This PR needs to be merged before the next PyPI release.

@niksirbi niksirbi force-pushed the use-updated-upload-pypi-action branch from 2cb3279 to 3f23d47 Compare February 2, 2024 16:53
@niksirbi niksirbi force-pushed the use-updated-upload-pypi-action branch from 3f23d47 to 7a11c5e Compare June 6, 2024 15:52
@niksirbi niksirbi force-pushed the use-updated-upload-pypi-action branch 2 times, most recently from ed11428 to 4dde62b Compare September 4, 2024 15:39
@niksirbi
Copy link
Member Author

niksirbi commented Sep 4, 2024

@adamltyson I can't seem to be able to pinpoint the problem with the CI failures. CI passes with pinned neuroinformatics-unit/actions/[email protected] but fails with neuroinformatics-unit/actions/test@v2 (which defaults to the latest actions release). I suspect that xvfb has something to do with it, because it's one of the things that changed between these releases. I played with turning the use-xvfb flag on and off, without success. I also fail to reproduce the problem locally on Ubuntu. I vaguely recall you dealing with xvfb before on this repository. Any ideas?

@adamltyson
Copy link
Member

I've got no idea I'm afraid. I had a play around, but just trying the same things as you I think.

@niksirbi niksirbi force-pushed the use-updated-upload-pypi-action branch from 1b05ec6 to af83333 Compare October 23, 2024 10:25
@codecov-commenter
Copy link

codecov-commenter commented Oct 23, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 55.18%. Comparing base (269160c) to head (f4df26f).
Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
neuralplayground/arenas/discritized_objects.py 50.00% 2 Missing ⚠️
neuralplayground/arenas/simple2d.py 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #101      +/-   ##
==========================================
- Coverage   55.27%   55.18%   -0.10%     
==========================================
  Files          40       40              
  Lines        3439     3441       +2     
==========================================
- Hits         1901     1899       -2     
- Misses       1538     1542       +4     

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

@niksirbi
Copy link
Member Author

Alright @adamltyson , I've managed to track down the problem.
And the culprit is.... my eternal nemesis - cv2.

The issue was with a specific render method, which calls cv2.imshow. That command cannot work in headless environments (without a DISPLAY), which was causing the tests to crash when the render method was being tested.

I circumvented this by adding an optional display=True parameter to the render method, which I set to False during tests. This solves the problem for now, but I'm open to suggestions for a more general solution. For example, we could try to automatically detect if the method is being called in a headless environment?

use-xvfb had nothing to do with this, so I've disabled it (which is the default) as not needed.

@adamltyson
Copy link
Member

Your approach seems sensible. Those tests aren't really asserting that the plots are created properly anyway. You could add some logic to detect the number of displays and only disable the plots when running headless. This would make the tests slightly more useful, but only slightly.

Any chance cv2 can be replaced? It's always a pain.

@niksirbi niksirbi marked this pull request as ready for review October 23, 2024 11:46
@niksirbi
Copy link
Member Author

I think it wouldn't be too hard to replace cv2 given that it's only used in these two render methods, and nowhere else. It would definitely simplify dependency management, installation etc. But that's more of a question for @ClementineDomine to decide. Can we use matplotlib for the live rendering of the environment?

But meanwhile, I think I'll merge this PR (if you approve), to unblock PyPI releases, and to plug the security vulnerability with the codecov token.

@adamltyson
Copy link
Member

Looks good to me. Moving away from cv2 would probably help with installation for users too.

@niksirbi
Copy link
Member Author

I open an issue for cv2 #117

@niksirbi niksirbi merged commit ddcd22a into main Oct 23, 2024
20 checks passed
@niksirbi niksirbi deleted the use-updated-upload-pypi-action branch October 23, 2024 12:57
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.

3 participants