Skip to content

Raise consistent ValueError for invalid EntryPoint.value#518

Merged
jaraco merged 4 commits into
mainfrom
bugfix/488-bad-ep-value
Apr 27, 2025
Merged

Raise consistent ValueError for invalid EntryPoint.value#518
jaraco merged 4 commits into
mainfrom
bugfix/488-bad-ep-value

Conversation

@jaraco

@jaraco jaraco commented Apr 27, 2025

Copy link
Copy Markdown
Member

Closes #488

  • Refactored parsing and handling of EntryPoint.value.
  • Raise a ValueError if no match.
  • Also raise ValueError on construction if the value is invalid.
  • Prefer a cached property, as the property is likely to be retrieved at least 3 times (on construction and for module:attr access).

@jaraco jaraco force-pushed the bugfix/488-bad-ep-value branch from f8a7887 to 9f8af01 Compare April 27, 2025 14:10
@jaraco

jaraco commented Apr 27, 2025

Copy link
Copy Markdown
Member Author

This change does introduce some performance degradation in the entry_points performance test:

===================================== perf =====================================
exercises.py:cached distribution: 0:00:00.000713 (+-1 day, 23:59:59.999988, -2%)
exercises.py:discovery: 0:00:00.000719 (+0:00:00.000002, 0%)
exercises.py:entry_points(): 0:00:00.010800 (+0:00:00.000700, 7%)
exercises.py:entrypoint_regexp_perf: 0:00:00.000070 (+-1 day, 23:59:59.999999, -1%)
exercises.py:uncached distribution: 0:00:00.001090 (+0:00:00, 0%)

+.7 ms (7%) in this particular run. I've seen other numbers like 3% on my local machine. I saw a larger increase without the cached property.

This seems to be an acceptable cost.

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.

AttributeError changed to AssertionError for invalid identifiers

1 participant