PY: consolidate python-r4 and python-us-core into python-r4-us-core#185
Merged
Conversation
096841f to
73f4a71
Compare
6f26800 to
1a3855d
Compare
73f4a71 to
35130ed
Compare
ryukzak
commented
Jun 18, 2026
| . venv/bin/activate && \ | ||
| python -m pytest -v | ||
| . venv/bin/activate && \ | ||
| mypy --strict . |
Collaborator
Author
There was a problem hiding this comment.
Move it to mypy.ini
Collaborator
Author
There was a problem hiding this comment.
Done in b7063c2 — dropped the --strict/--config-file CLI flags; mypy now reads each example mypy.ini (python-fhirpy/mypy.ini sets strict = True).
| python -m pytest test_raw_extension.py -v | ||
| cd $(PYTHON_R4_US_CORE_EXAMPLE) && \ | ||
| . venv/bin/activate && \ | ||
| python -m pytest test_profile_bodyweight.py test_profile_bp.py test_profile_patient.py test_profile_typed_bundle.py test_bundle.py test_raw_extension.py -v |
Collaborator
Author
There was a problem hiding this comment.
Use wildcard instead of test list.
Collaborator
Author
There was a problem hiding this comment.
Done in b7063c2 — replaced the explicit list with pytest --ignore=test_sdk.py -v (auto-discovers offline tests, excludes the Aidbox one).
A single generate.ts pulls US Core 8.0.1 (which depends on R4 core) plus the local ExampleTypedBundle SD, so one fhir_types tree holds hl7_fhir_r4_core, hl7_fhir_us_core, and example_folder_structures. Drop the duplicate (identical) test_raw_extension.py and the redundant second R4 type generation. The merged dir keeps the offline profile/bundle/extension tests and the live requests client SDK tests (test_sdk.py); type-schemas debug output is gitignored.
- Makefile: test-python-r4-us-core-example (offline: mypy + profile/bundle/extension tests) and test-python-sdk (live client.py CRUD, Aidbox-gated) over the merged dir; drop the python-r4 / python-us-core specific generate/setup/test targets - CI: rename the us-core job to test-python-r4-us-core-example with a fhir_types determinism diff-check; the python-sdk job runs the live SDK tests - Update README and examples README python references
- test-python-r4-us-core-example: pytest --ignore=test_sdk.py (auto-discover) instead of an explicit per-file list, so new offline tests are picked up automatically - drop redundant mypy CLI flags; rely on each example mypy.ini (python-fhirpy/mypy.ini now sets strict = True, equivalent to the old --strict flag)
Moving --strict into mypy.ini as a bare `strict = True` turned on strict_optional, which the old CLI --strict did not (the config relaxation won), breaking client.py list-indexing. Add strict = True on top of the existing relaxations to match the original behavior.
50980ed to
9590468
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.
Consolidate the Python examples, mirroring the TypeScript example-decouple work. Stacked on
py-mypy-us-core-strict, so this PR targets that branch and shows only the consolidation diff.Directory changes
Before → after:
python-r4+python-us-core→python-r4-us-core— a singlegenerate.tspulls US Core 8.0.1 (which depends on R4 core) plus the localExampleTypedBundleSD, so onefhir_types/tree holdshl7_fhir_r4_core,hl7_fhir_us_core, andexample_folder_structures.test_raw_extension.pyand the redundant second R4 type generation.python-fhirpyleft as-is (distinct async-client variant).fhir_types/type-schemas/(introspection debug output) is now gitignored — it was never committed before but wasn't ignored either.Tests in the merged dir
test_profile_*(US Core profile API),test_bundle.py,test_raw_extension.py— run with mypy undermypy.ini.test_sdk.py— CRUD via therequests-basedclient.py.Build & CI
Makefile targets before → after:
sdk-tests.yml): renamed the US Core job totest-python-r4-us-core-exampleand gave it thefhir_typesdeterminism diff-check (always runs, no Aidbox); thetest-python-sdkjob runs the live SDK tests; dropped its stale diff-check on the non-existentexamples/python/fhir_types.README.mdandexamples/README.mdPython references.Notes
mypy --config-file mypy.inipasses (41 files), and all 70 offline tests pass (directly and viamake test-python-r4-us-core-example). Aidbox SDK tests run in CI.test_sdk.py/client.pyare now type-checked under US Core'smypy.ini(strict with a few FHIR-dict error codes disabled) instead ofmypy --strict— slightly more lenient, in exchange for one consistent config over the merged dir.