Use importlib.util to locate fork specs, dropping pkg_resources#11
Merged
Merged
Conversation
setuptools >= 81 no longer ships pkg_resources, so importing ethcheck crashed at startup with ModuleNotFoundError. Replace the removed pkg_resources.resource_filename in get_file_path with importlib.util.find_spec, which resolves the fork's spec source path without importing the fork body (also decoupling the verification path from eth2spec's heavy runtime dependencies).
The stubbed ESBMC never wrote testcase.xml, but verify_function deletes any stale one on entry, so the pytest-confirmation branch was never reached -- the two failing tests saw a printed counterexample instead. Model --generate-testcase in the stub, and assert the confirmed-bug case returns 'failed' (the exit code 3 is exit_code_for's job, not an in-function sys.exit), which also makes the ValueError test exercise its branch.
4b5ebde to
1faafc2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
ethcheckcrashes at startup on environments withsetuptools >= 81:pkg_resourceswas deprecated and is no longer bundled withsetuptools(removed in 81+).
ethcheck.pyimported it at module load and usedpkg_resources.resource_filenameinget_file_path, so every entry point(
--help,--list-forks,--fork, ...) failed immediately.Fix
Replace
pkg_resources.resource_filenamewith the stdlibimportlib.util.find_spec(Python 3.9+). It resolves the fork's spec sourcepath from the package directory without importing the fork body, which
also decouples the core verification path from
eth2spec's heavy runtimedependencies.
Verification
ethcheck --helpand--list-forksrun (6 forks listed).get_file_pathresolves the correctmainnet.pyfor all 6 forks(phase0, altair, bellatrix, capella, deneb, electra).
9 passed.🤖 Generated with Claude Code