Fix CI: examples import + missing async provenance tool - #8
Merged
Conversation
CI on main was failing for two independent reasons. 1. tests/test_examples.py imports the top-level examples package, but examples/ is intentionally not part of the installed distribution (it's a runnable demo, not library code). In a clean pip install -e ".[test]" env like CI's, the repo root is never on sys.path, so the import fails with ModuleNotFoundError. This happened to work on my machine only because my shell has an empty PYTHONPATH entry that puts cwd on the path. Fixed by adding pythonpath = ["."] under [tool.pytest.ini_options] in pyproject.toml, so pytest puts the repo root on sys.path itself regardless of the environment it runs in. 2. test_async_tools_match_sync_tool_names failed because the sync tools (get_rustchain_tools) got a rustchain_provenance tool when RIP-0310 support was added, but the async tools (get_async_rustchain_tools) never did - the async client didn't even have a provenance() method. Fixed by adding beacon_agents(), beacon_contracts() and provenance() to AsyncRustChainClient (async twins of the sync client methods) and a matching _AsyncProvenanceTool, so the async tool surface actually mirrors the sync one like the docstring already claimed. Verified locally with pytest -q in a clean venv (PYTHONPATH unset) on Python 3.11 and 3.12, matching the CI workflow exactly: 33 passed. Signed-off-by: Scott <scottbphone12@gmail.com>
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.
Summary
CI on main has been failing for two independent reasons:
tests/test_examples.pyimports the top-levelexamplespackage, butexamples/is deliberately not part of the installed distribution (it's a runnable demo, not library code). In a cleanpip install -e ".[test]"environment like CI's, the repo root is never onsys.path, so the import fails withModuleNotFoundError: No module named 'examples'. This happened to pass on my own machine only because my shell sets an emptyPYTHONPATHentry that puts cwd on the path — not something CI has. Fixed by addingpythonpath = ["."]under[tool.pytest.ini_options]inpyproject.toml, so pytest puts the repo root onsys.pathitself, independent of the environment.test_async_tools_match_sync_tool_namesfailed becauseget_rustchain_tools(sync) got arustchain_provenancetool when RIP-0310 support was added (commit2406aa6), butget_async_rustchain_tools(async) never did — the async client didn't even have aprovenance()method. Fixed by addingbeacon_agents(),beacon_contracts()andprovenance()toAsyncRustChainClient(async twins of the existing sync client methods) plus a matching_AsyncProvenanceTool, so the async tool surface actually mirrors the sync one, as the docstring already claimed.Test plan
PYTHONPATHunset, matching CI'spip install -e ".[test]"+pytest -qexactly.pytest -qpasses with 33/33 on Python 3.11 and 3.12 in clean venvs.