Introduce pyright with type annotations - #283
Open
tomaskontrimas wants to merge 7 commits into
Open
Conversation
tomaskontrimas
force-pushed
the
refactor/pyright
branch
from
April 3, 2026 10:47
0b1a6e7 to
55030a0
Compare
tomaskontrimas
force-pushed
the
refactor/pyright
branch
8 times, most recently
from
April 19, 2026 20:37
d509932 to
4f3a606
Compare
tomaskontrimas
force-pushed
the
refactor/pyright
branch
3 times, most recently
from
June 14, 2026 15:13
9d30929 to
4a8a172
Compare
tomaskontrimas
force-pushed
the
refactor/pyright
branch
from
June 26, 2026 08:50
202c704 to
6c18856
Compare
tomaskontrimas
force-pushed
the
refactor/pyright
branch
from
July 20, 2026 18:44
27d7a33 to
721fb38
Compare
tomaskontrimas
force-pushed
the
refactor/pyright
branch
from
August 24, 2026 18:13
e796e28 to
ec907e2
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces static type checking via pyright and adds/adjusts type annotations across the SkyLLH codebase (including tests), with corresponding CI integration to enforce typechecking.
Changes:
- Add pyright as a dev dependency and run it in CI (
typecheckjob). - Add/expand Python type annotations across core, i3, plotting, analyses, and dataset modules.
- Update tests and a few runtime call sites to satisfy stricter typing (including some targeted
pyright: ignore[...]annotations).
Reviewed changes
Copilot reviewed 47 out of 108 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/publicdata_ps/test_time_integrated_ps_dr1.py | Add assertions to satisfy typing expectations for internal signal generator types. |
| tests/i3/testdata/testdata_generator.py | Switch from dict.get() to direct key access for testdata saves. |
| tests/i3/test_scrambling.py | Add pyright ignore on a typed call that passes dataset=None. |
| tests/core/testdata/testdata_generator.py | Switch from dict.get() to direct key access for testdata saves. |
| tests/core/test_weights.py | Add pyright ignores for override/type issues; add non-None asserts for returned weights. |
| tests/core/test_source_model.py | Add pyright ignores for SourceModel constructor argument typing. |
| tests/core/test_signalpdf.py | Align test with typed APIs (get_pd, class monkeypatch ignore). |
| tests/core/test_signal_generator.py | Add asserts/ignores to satisfy typed attribute access and mocks. |
| tests/core/test_parameters.py | Add pyright ignores and use numpy arrays where typed APIs expect arrays. |
| tests/core/test_model.py | Add pyright ignores for intentional bad-argument tests. |
| tests/core/test_logging.py | Use Config.from_dict instead of raw dict in logging tests. |
| tests/core/test_interpolate.py | Add pyright ignores for attribute access on mocked TrialDataManager. |
| tests/core/test_event_selection.py | Add pyright ignore for __class__ monkeypatch; add non-None asserts. |
| tests/core/test_dataset.py | Add non-None asserts for optional dataset data fields. |
| skyllh/scripting/argparser.py | Add function type annotations and expand docstring return info. |
| skyllh/plotting/i3/pdfratio.py | Update plotter typing and align to TrialDataManager.initialize_trial + typed ratio API. |
| skyllh/plotting/i3/pdf.py | Update plotter typing and align to get_pd return signature. |
| skyllh/plotting/i3/backgroundpdf.py | Update plotter typing and align to initialize_trial + get_pd. |
| skyllh/plotting/core/signalpdf.py | Update plotter signature/typing; align to initialize_trial + get_pd. |
| skyllh/plotting/core/pdfratio.py | Update plotter signature/typing; align to initialize_trial + typed ratio API. |
| skyllh/i3/utils/coords.py | Add overloads and type annotations to coordinate transforms. |
| skyllh/i3/signalpdf.py | Add type annotations (Config, ProgressBar, DataFieldRecordArray) and refine signatures. |
| skyllh/i3/scrambling.py | Add type annotations for scrambling methods and related imports. |
| skyllh/i3/pdf.py | Add type annotations and adjust method signatures to match typed core APIs. |
| skyllh/i3/livetime.py | Add type annotations for livetime constructors/loaders. |
| skyllh/i3/dataset.py | Add/expand type annotations for dataset/grl/data loading and preparation. |
| skyllh/i3/config.py | Type annotate IceCube-specific config helper. |
| skyllh/i3/background_generation.py | Add type annotations and assertions for required data fields. |
| skyllh/datasets/i3/TestData.py | Introduce TypedDict for dataset kwargs and add typing. |
| skyllh/datasets/i3/PublicData_14y_ps.py | Introduce TypedDict for dataset kwargs; minor doc improvements. |
| skyllh/datasets/i3/PublicData_10y_ps.py | Introduce TypedDict for dataset kwargs; minor doc improvements. |
| skyllh/datasets/i3/PublicData_10y_ps_wMC.py | Add type annotations and docstrings for helper functions. |
| skyllh/core/utils/trials.py | Add type annotations and adjust casting for pyright compatibility. |
| skyllh/core/utils/tdm.py | Add typing for TDM helper function and return type. |
| skyllh/core/utils/spline.py | Add typing for spline utility functions and spline class methods. |
| skyllh/core/utils/multidimgridpdf.py | Add typing and docstrings for MultiDimGridPDF utility constructors. |
| skyllh/core/utils/flux_model.py | Add typing and adjust rv_continuous overrides to match expected signatures. |
| skyllh/core/utils/coords.py | Add typing and local Any casts for astropy-returned objects. |
| skyllh/core/types.py | Add docstrings to placeholder base type for avoiding circular imports. |
| skyllh/core/tool.py | Add type annotations and docstrings for tool helpers/decorators. |
| skyllh/core/timing.py | Add typing and docstrings; tighten TaskTimer invariants with asserts. |
| skyllh/core/times.py | Add typing for time generation interfaces and implementations. |
| skyllh/core/test_statistic.py | Add typing and adjust TS implementations (including ns==0 Taylor/Wilks path). |
| skyllh/core/source_model.py | Add typing for source models/collections and point-like source accessors. |
| skyllh/core/source_hypo_grouping.py | Add typing across SHG and manager APIs. |
| skyllh/core/smoothing.py | Add typing for smoothing APIs and filters. |
| skyllh/core/signal_generation.py | Add typing for energy range and SHG-related method signatures. |
| skyllh/core/session.py | Add return type annotations for session helper functions. |
| skyllh/core/services.py | Add typing for service methods and returned weight tuples. |
| skyllh/core/scrambling.py | Add typing for scrambling interfaces and implementations. |
| skyllh/core/random.py | Add typing for random services and random choice helpers. |
| skyllh/core/progressbar.py | Add typing and assertions around tqdm lifecycle usage. |
| skyllh/core/pdfratio_fill.py | Add typing for ratio fill call signatures and parameters. |
| skyllh/core/model.py | Add typing and ensure name is always a string. |
| skyllh/core/minimizers/iminuit.py | Add typing for minimizer functors and results; cast tool imports for pyright. |
| skyllh/core/math.py | Add typing and make __str__ robust when function string is None. |
| skyllh/core/logging.py | Add typing for logging helpers and configuration-driven setup. |
| skyllh/core/expectation_maximization.py | Add typing; minor runtime conversions to floats for list outputs. |
| skyllh/core/display.py | Add typing for text formatting helper. |
| skyllh/core/detsigyield.py | Add typing for DetSigYield and builder APIs. |
| skyllh/core/datafields.py | Add typing for stage checks and name selection utilities. |
| skyllh/core/config.py | Add return types and argument types; small robustness tweak in set_wd. |
| skyllh/core/catalog.py | Add typing for catalog and conversion helper. |
| skyllh/core/backgroundpdf.py | Add typing for background time PDF initialization and get_pd. |
| skyllh/analyses/i3/publicdata_ps/time_integrated_ps.py | Add typing; small logic tweak for gamma_seed is None; align calls with typed APIs. |
| skyllh/analyses/i3/publicdata_ps/signalpdf.py | Add typing for public-data signal PDF/PDFSet and align to typed interfaces. |
| skyllh/analyses/i3/publicdata_ps/scripts/mceq_atm_bkg.py | Add pyright ignores for optional external deps. |
| skyllh/analyses/i3/publicdata_ps/pdfratio.py | Add typing, caching annotations, and align interpolator call shapes for pyright. |
| skyllh/analyses/i3/publicdata_ps/mcbkg_ps.py | Add typing, improve compress/dtype conversion handling, and clarify analysis construction. |
| skyllh/analyses/i3/publicdata_ps/detsigyield.py | Add typing for builder and internal histogram construction. |
| skyllh/analyses/i3/publicdata_ps/aeff.py | Add typing and cast() around spline integrals for strict typing. |
| skyllh/init.py | Add TYPE_CHECKING import guard for exported symbol typing. |
| pyproject.toml | Add pyright dev dependency and [tool.pyright] configuration. |
| .github/workflows/ci.yml | Add a typecheck job that runs pyright on Python 3.11. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Tracking #271, closes #23.