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

A bit "cosmetic" changes though needed for implementing more advanced stuff. #2037

Closed

Conversation

KOLANICH
Copy link
Contributor

Also when an entry point now fails to be loaded, it doesn't disrupt building process.

Summary of changes

Closes

Pull Request Checklist

  • Changes have tests
  • News fragment added in changelog.d. See documentation for details

@KOLANICH KOLANICH force-pushed the distr_opts_improvements_cosmetic branch 2 times, most recently from dea5b72 to f5d63e7 Compare March 19, 2020 11:36
@jaraco jaraco closed this Mar 21, 2020
@jaraco jaraco reopened this Mar 21, 2020
@jaraco
Copy link
Member

jaraco commented Mar 21, 2020

Per the request in #2031, I'm re-opening this for selective consideration.

Copy link
Member

@jaraco jaraco left a comment

Choose a reason for hiding this comment

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

The main change here is suppressing errors on loading the entry points for finalizing distribution options. I'd like to explore the problem's root cause in #2030 before settling on this approach as the solution. Also, please be aware of #1994, which was merged, but not into master (until just now), so that will affect the way you reason about the .order attribute.

@@ -0,0 +1,4 @@
A bit "cosmetic" changes though needed for implementing more advanced stuff.
* Renamed args names params for some static methods and marked them with ''@staticmethod''.
Copy link
Member

Choose a reason for hiding this comment

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

What's the purpose of this change? What value does it provide? What issue does it address?

Copy link
Contributor Author

@KOLANICH KOLANICH Mar 21, 2020

Choose a reason for hiding this comment

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

  1. Warnings in Finalize distribution options various data #2034 about legacy calling convention (the arg is not named dist)
  2. it turned out that the methods are static ones, but they look like bound ones. So I have marked them as static, to make this explicit, and also to allow tools for working with source code to capture that fact in their code models.

@@ -0,0 +1,4 @@
A bit "cosmetic" changes though needed for implementing more advanced stuff.
* Renamed args names params for some static methods and marked them with ''@staticmethod''.
* Moved ''0'' into ''default_order_value" variable.
Copy link
Member

Choose a reason for hiding this comment

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

I'd agree with this change to provide more context. The problem is that the purpose of the default value is already documented in the docstring, so with this change, it's now documented redundantly, opening up the opportunity for the two definitions to diverge. Especially if the code for the function remains small (< 10 lines), I find it unnecessary to make the code self-documenting here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was done to just make the diff of #2038 a bit cleaner.

A bit "cosmetic" changes though needed for implementing more advanced stuff.
* Renamed args names params for some static methods and marked them with ''@staticmethod''.
* Moved ''0'' into ''default_order_value" variable.
* When an entry point now fails to be loaded, it doesn't disrupt building process.
Copy link
Member

Choose a reason for hiding this comment

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

I can see value in failing rather than suppressing errors. One should be cautious about suppressing errors, as it might be the case that the failed operation might be critical. The warning is helpful, and given the 'fail on warning' behavior of the setuptools test suite, this warning would prevent the core functionality from being suppressed (at least for the duration of the test suite). I think this change encapsulates the main purpose of this PR and probably addresses the underlying bug (which unfortunately isn't referenced here).

Copy link
Contributor Author

@KOLANICH KOLANICH Mar 21, 2020

Choose a reason for hiding this comment

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

Yeah, I have added it as one of the ways to deal with #2030 when installing setuptools itself.

ep.load()(self)
try:
f = ep.load()
except Exception as ex:
Copy link
Member

Choose a reason for hiding this comment

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

This branch probably needs a test. And it probably deserves to be its own function with a docstring describing its purpose.

Copy link
Contributor Author

@KOLANICH KOLANICH Mar 21, 2020

Choose a reason for hiding this comment

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

I am not sure how to properly test this. If we move that into a separate function and test only it, it will turn out we are actually testing EntryPoint.load. To test it properly I guess we need to mock iter_entry_points into a one returning our not really existing entry point that always fails by design.

@jaraco
Copy link
Member

jaraco commented Apr 5, 2020

#2047 is a much more surgical way of addressing this issue, so I'll close this in favor of that change, although more important is going to be refining the problem description in #2030 to justify that a change is needed at all.

@jaraco jaraco closed this Apr 5, 2020
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