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

Fix ament_black for new get_sources API #13

Merged
merged 7 commits into from
Jul 29, 2024

Conversation

bjsowa
Copy link

@bjsowa bjsowa commented Apr 29, 2024

This is my attempt to fix #12. Not sure if it is the correct way but it seems to work. Though, it will break support for black pre 23.9.0 version. Maybe we can do a version check. Any suggestions?

@gstorer
Copy link

gstorer commented May 25, 2024

I would suggest we try and fix this in a way that works with both old and new black versions. Either using try/except or explicitly checking the Black version. ROS Humble still has a 3 more years of support left and is likely going to be stuck with the old Black version the entire time.

@nachovizzo
Copy link

I would suggest we try and fix this in a way that works with both old and new black versions. Either using try/except or explicitly checking the Black version. ROS Humble still has a 3 more years of support left and is likely going to be stuck with the old Black version the entire time.

This seems very hacky to me... I think if we release different versions for humble then this should work without any try/execpt.

Or do I miss something?

@gstorer
Copy link

gstorer commented May 29, 2024

Sure you could, but then you have to maintain two versions and push any fixes or updates to both versions. It is pretty standard to have compatibility layers so you can support a range of library versions. Over a decade ago I contributed to Matplotlib's Qt compatibility layer and they are still using the same strategy to this day: https://github.com/matplotlib/matplotlib/blob/v3.9.0/lib/matplotlib/backends/qt_compat.py .

I am assuming we want to support at least the current 'Tier 1' platforms here: https://www.ros.org/reps/rep-2000.html i.e. Windows + range of Ubuntu versions. It feels like to much effort to support them all if you have to manage different releases. Being flexible on the dependency also means the Tier 2-3 platforms are more likely to work with the package, to say nothing of anyone doing something more complex with custom builds.

For my particular use case I would want the Humble release to be able to support newer Black versions. We have a company wide code quality policy that requires newer Black versions. Our build is currently using an older version of this package to avoid the compatibility issue that was recently introduced.

@nachovizzo
Copy link

@gstorer , @bjsowa, I'm not ignoring this; I'm just too overloaded to fix this. The release process for ROS packages is long and extremely painful.

Sorry for the delay

@bochen87
Copy link

Would be great to get this fix in. Currently ament_black is broken in Jazzy :-(

@nachovizzo
Copy link

I'm sorry, everyone; I'm not ignoring the messages you sent. I don't have enough time to go through the release-pain. I'm also a bit demotivated as ROS folks won't change their mind about sticking to a horrible format standard like flake8. See ros-navigation/navigation2#3941 (comment)

This means that black, ruff, or whatever will never get officially supported. This pain will continue on each ROS release from now on. If you feel the energy of fighting, please consider looking into ROS discourse; there are many conversations about this topic, all relatively depressing, for me, is a lost cause

@ruffsl, would you like to take over? Can you spare some time?

@bjsowa
Copy link
Author

bjsowa commented Jul 27, 2024

I made the fix backward compatible for black versions <23.9.0 so now it shouldn't break support for black version distributed in Ubuntu Jammy.

I don't have enough time to go through the release-pain.

I can offer my help. I have some experience (~150 PRs in rosdistro)

@nachovizzo nachovizzo self-requested a review July 29, 2024 09:47
Copy link

@nachovizzo nachovizzo left a comment

Choose a reason for hiding this comment

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

@bjsowa Thanks for this!

@nachovizzo nachovizzo merged commit 4f3cea9 into botsandus:main Jul 29, 2024
4 checks passed
@nachovizzo
Copy link

This is why I hate this bloom so much, I always follow the instructions in https://docs.ros.org/en/jazzy/How-To-Guides/Releasing/Subsequent-Releases.html, I always need to hack things around, and now I get this error

==> bloom-export-upstream /tmp/tmpx7cemart/upstream git --tag 0.2.4 --display-uri https://github.com/botsandus/ament_black.git --name upstream --output-dir /tmp/tmp20jdhuxz
Checking out repository at 'https://github.com/botsandus/ament_black.git' to reference '0.2.4'.
Exporting to archive: '/tmp/tmp20jdhuxz/upstream-0.2.4.tar.gz'
Cloning into '/tmp/tmpm2inv1ii'...
warning: --depth is ignored in local clones; use file:// instead.
done.
md5: e8f86a1674aecc3437f62ef5534e44c9

==> git-bloom-import-upstream /tmp/tmp20jdhuxz/upstream-0.2.4.tar.gz  --release-version 0.2.5 --replace
ROS Distro index file associate with commit '3e9af773826ee49ea09135314786d8a46085d9da'
New ROS Distro index url: 'https://raw.githubusercontent.com/ros/rosdistro/3e9af773826ee49ea09135314786d8a46085d9da/index-v4.yaml'
Importing archive into upstream branch...
The package(s) in upstream are version '0.2.4', but the version to be released is '0.2.5', aborting.
❌  Error running command '['/usr/bin/git-bloom-import-upstream', '/tmp/tmp20jdhuxz/upstream-0.2.4.tar.gz', '--release-version', '0.2.5', '--replace']'
Release failed, exiting.

@bjsowa any idea what could have go wrong? seems related to https://robotics.stackexchange.com/questions/60540/bloom-release-failure

@bjsowa
Copy link
Author

bjsowa commented Jul 29, 2024

This is why I hate this bloom so much, I always follow the instructions in https://docs.ros.org/en/jazzy/How-To-Guides/Releasing/Subsequent-Releases.html, I always need to hack things around, and now I get this error

==> bloom-export-upstream /tmp/tmpx7cemart/upstream git --tag 0.2.4 --display-uri https://github.com/botsandus/ament_black.git --name upstream --output-dir /tmp/tmp20jdhuxz
Checking out repository at 'https://github.com/botsandus/ament_black.git' to reference '0.2.4'.
Exporting to archive: '/tmp/tmp20jdhuxz/upstream-0.2.4.tar.gz'
Cloning into '/tmp/tmpm2inv1ii'...
warning: --depth is ignored in local clones; use file:// instead.
done.
md5: e8f86a1674aecc3437f62ef5534e44c9

==> git-bloom-import-upstream /tmp/tmp20jdhuxz/upstream-0.2.4.tar.gz  --release-version 0.2.5 --replace
ROS Distro index file associate with commit '3e9af773826ee49ea09135314786d8a46085d9da'
New ROS Distro index url: 'https://raw.githubusercontent.com/ros/rosdistro/3e9af773826ee49ea09135314786d8a46085d9da/index-v4.yaml'
Importing archive into upstream branch...
The package(s) in upstream are version '0.2.4', but the version to be released is '0.2.5', aborting.
❌  Error running command '['/usr/bin/git-bloom-import-upstream', '/tmp/tmp20jdhuxz/upstream-0.2.4.tar.gz', '--release-version', '0.2.5', '--replace']'
Release failed, exiting.

@bjsowa any idea what could have go wrong? seems related to https://robotics.stackexchange.com/questions/60540/bloom-release-failure

You've set your release tag to 0.2.4 in track configuration instead of :{version} which will look for a tag matching the package version.

To fix that, run bloom-release with -e flag. When it asks you for a release tag, type: :{version}. You can also fill Upstream devel branch to main.

@bjsowa bjsowa deleted the fix-get-sources branch July 29, 2024 10:54
@nachovizzo
Copy link

@bjsowa amazing ❤️ !!! thanks for the fast support! I was dying!

ruffsl added a commit that referenced this pull request Sep 4, 2024
nachovizzo pushed a commit that referenced this pull request Sep 5, 2024
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.

ament_black is broke with the latest versions of Black
4 participants