Contributing to shinyglass
Source:.github/CONTRIBUTING.md
Keeping the R and Python packages in step
The repository holds the R package and the Shiny for Python package in python/. They share the SCSS and JavaScript, and they aim to expose the same functions with the same argument names.
Two checks run in CI (the Python workflow):
-
Vendored assets.
python/scripts/vendor_assets.pycopies the shared SCSS and JavaScript into the Python package. CI re-runs it and fails if the committed copy is out of date. -
API parity.
tools/api_parity.pycompares the exports inNAMESPACEwith__all__inpython/src/shinyglass/__init__.py, then compares argument names for functions found on both sides. R’sinputIdmatches Python’sid,classmatchesclass_, and...matches*argsor**kwargs. Python arguments that start with an underscore are ignored.
Run the parity check locally from the repository root:
When you add or change an R export
-
Draft the Python version:
This prints a function stub with the R argument names and simple defaults. It is only a starting point. Read the R function, write the body by hand, add type hints and a docstring, and export it from
__init__.py. Add a test under
python/tests/.Run
python tools/api_parity.pyandpytestinpython/.
If a function or argument should exist on only one side, add it to tools/api-parity-allow.toml with a short reason. Examples are helpers for R only packages such as ggplot2, gt, DT, or shinyreact. The check also fails when an allow list entry is no longer needed, so remove entries once the missing side is added.