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

Require python3- prefix with PyPI keys #25508

Merged
merged 5 commits into from
Aug 13, 2020
Merged

Conversation

sloretz
Copy link
Contributor

@sloretz sloretz commented Jun 17, 2020

Discussion

#25474 (comment)
#23836 (comment)

I think it would make sense to avoid python- or python3- prefixes on PyPI only keys because it could give a mistaken impression that it determines the Python version used.
The prefix doesn't make a difference because the actual python version depends on ROS_PYTHON_VERSION which itself is set by the ROS distro.

https://www.ros.org/reps/rep-0151.html#rosdep-and-pip-packages.

I think it would be confusing if a package in ROS Melodic workspace depended on python3-foobar-pip because rosdep would install it for Python 2.

@sloretz sloretz requested a review from a team June 17, 2020 18:02
@sloretz sloretz self-assigned this Jun 17, 2020
@nuclearsandwich
Copy link
Member

This makes sense for PyPI only keys since migration from a -pip key to a system package key will require changing the key no matter what.

Does it make sense to explicitly state that when PyPI packages are being used to "fill in" on systems where a distribution default package is unavailable the python3?- key format should still be used.

tfoote
tfoote previously requested changes Jun 17, 2020
Copy link
Member

@tfoote tfoote left a comment

Choose a reason for hiding this comment

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

The python2 vs python3 ambiguity is suboptimal. However one of the other major reasons for keeping the python prefix is to keep the sorting the same. We really don't want to have pip rules overriding the apt rules. And if you have python3-foo it's much harder to double check that foo-pip doesn't exist some hundreds of lines away in the database. Whereas if you have python3-foo and python3-foo-pip they are side by side and are trivial to identify as conflicting.

Another significant advantage of having the names the same is that when/if things get added to an apt repository in the future the new rosdep key is just removing the '-pip' extension which is easier for maintainers and clear what the substitute should be.

This also is following our standard to use the debian package naming conventions which is valuable for consistency even if the package isn't on debian platforms it's consistent and people can rely on it compared to supporting all the pip variations. We do the same for gentoo and arch who have been dealing with this ambiguity for much longer being python3 by default for quite a while without much problem.

Looking forward Melodic is the last python2 specific rosdistro we have so that mismatch issue will go away. And we will just use python3 for everything. But the conflicts between pip and apt will not so I'd strongly recommend sticking to using the prefixes and possibly saying that everything pip explicit should be added using the python3 prefix to not have duplicate rules as it will be eclipsed shortly.

@sloretz
Copy link
Contributor Author

sloretz commented Jun 17, 2020

. We really don't want to have pip rules overriding the apt rules. And if you have python3-foo it's much harder to double check that foo-pip doesn't exist some hundreds of lines away in the database. Whereas if you have python3-foo and python3-foo-pip they are side by side and are trivial to identify as conflicting.

I don't think I understand this part. What does it mean for two rules to conflict?

Another significant advantage of having the names the same is that when/if things get added to an apt repository in the future the new rosdep key is just removing the '-pip' extension which is easier for maintainers and clear what the substitute should be.

Does this mean PyPI rules should be removed when platform specific packages become available? foobar-pip and python3-foobar should never exist at the same time? What happens if they do?

@sloretz
Copy link
Contributor Author

sloretz commented Jul 1, 2020

@tfoote friendly ping :)

@sloretz sloretz requested a review from tfoote July 1, 2020 16:00
@tfoote
Copy link
Member

tfoote commented Jul 22, 2020

I don't think I understand this part. What does it mean for two rules to conflict?

If I install a pip version of foo I'll get whatever is in pypi and it will mask the underlying apt version. If they were the same version that's not problem. But generally pip is far ahead of the apt versions.

Does this mean PyPI rules should be removed when platform specific packages become available? foobar-pip and python3-foobar should never exist at the same time? What happens if they do?

Generally yes

Both of these come down to the fact that pip installations will mask the debian based installations. If I depend on foo as installed via apt. I know what version I'm getting. If someone else pip installs foo they'll get whatever version is latest in pypi. This may be a major new version, with newer upgraded APIs and possibly changed dependencies etc. That's not really a problem if I want the latest version and ask for it. But if foo is a library that other people are depending on the pypi version is rarely 100% compatible so other packages relying on foo we be potentially broken with the unbenownst upgrade.

This is particularly pernicious because as a developer I can assert that I need debian package foo at version X.Y.Z and can have my installation scripts check that the debian package is installed at the right version. However, rosdep will assert that the debian package is installed correctly. However when I try to import the package I'll get the pip version.

Even more confusing is if I have everything working. And then I add a new package to my workspace that you then use rosdep to resolve the pip version will then potentially break an already running system as a side effect of installing.

So at the high level the pip rules should only be added for targets or platforms for which there does not exist an apt or other default installer version.

We have the convention of having the -pip rules to be clear about what's pip only. And what we should be doing is when we add an apt rule we should null out the pip rule for that and future versions. (We don't have automation for this so it often doesn't happen.) We do allow you to add pip resolutions for apt packages on older platforms where the apt package is not available and the pip one can backfill where there's no backports, because those won't conflict. But as a rule the rosdep keys should be defining the canonical version of the package that we are standardizing on using on that platform. And developers can have an expectation that if they rely on that key, they will have what it promises is available.

So this is why I want the same prefix so that when reviewing pull requests these conflicts can be noticed when reviewing PRs more easily.

@sloretz sloretz force-pushed the sloretz/pip_no_python3_suffix branch from 9906da1 to f9e254e Compare August 5, 2020 15:45
@sloretz sloretz changed the base branch from master to revert-cob-control August 5, 2020 15:47
@sloretz sloretz changed the base branch from revert-cob-control to master August 5, 2020 15:47
@sloretz sloretz force-pushed the sloretz/pip_no_python3_suffix branch from f9e254e to faad0f2 Compare August 5, 2020 15:48
Signed-off-by: Shane Loretz <[email protected]>
@sloretz
Copy link
Contributor Author

sloretz commented Aug 5, 2020

So this is why I want the same prefix so that when reviewing pull requests these conflicts can be noticed when reviewing PRs more easily.

@tfoote Updated PR to require python3- prefix and require old -pip keys to be deleted in c3935b7

@sloretz sloretz changed the title Don't recommend python*- prefix with PyPI keys Require python3- prefix with PyPI keys Aug 5, 2020
Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

One really minor nit. Up to you whether to accept it or not. Approving anyway.

CONTRIBUTING.md Outdated Show resolved Hide resolved
Signed-off-by: Shane Loretz <[email protected]>

Co-authored-by: Chris Lalancette <[email protected]>
CONTRIBUTING.md Outdated Show resolved Hide resolved
Signed-off-by: Shane Loretz <[email protected]>

Co-authored-by: Jacob Perron <[email protected]>
Copy link
Member

@nuclearsandwich nuclearsandwich left a comment

Choose a reason for hiding this comment

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

Seeing that @tfoote's requested changes have been addressed and that other approvals are all in. This looks good to me too.

@sloretz
Copy link
Contributor Author

sloretz commented Aug 10, 2020

@tfoote would you be willing to check that the changes match your comments before I merge it?

@sloretz sloretz dismissed tfoote’s stale review August 10, 2020 21:18

Review comments addressed

Copy link
Member

@tfoote tfoote left a comment

Choose a reason for hiding this comment

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

Thanks looks good to me.

@sloretz sloretz merged commit f01a0ca into master Aug 13, 2020
@sloretz sloretz deleted the sloretz/pip_no_python3_suffix branch August 13, 2020 17:53
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.

None yet

5 participants