-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reactpy fixes and updates #1162
Merged
Merged
Conversation
This file contains 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
The tethys_components.library contained a singleton implementation of the ComponentLibrary class. This was found to have bugs when running multiple apps. Thus, the underlying framework had to be reworked a bit to have the separate library instances exist at the page level. Tests still need to be written.
Here is that interface: <component>(**props_as_kwargs)(*children_as_args)
Highlights true single-file/language app development
swainn
requested changes
Mar 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments
tethys_cli/scaffold_templates/extension_templates/default/pyproject.toml_tmpl
Show resolved
Hide resolved
swainn
approved these changes
Mar 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved on the contingency of a future debate on the naming conventions.
swainn
pushed a commit
that referenced
this pull request
Mar 5, 2025
* Components lib no longer singleton but tied to app The tethys_components.library contained a singleton implementation of the ComponentLibrary class. This was found to have bugs when running multiple apps. Thus, the underlying framework had to be reworked a bit to have the separate library instances exist at the page level. Tests still need to be written. * reactpy tests added/updated * Adds docstrings and makes methods private * Uncomments necessary code * Fixes test to restore full coverage * Fixes incomplete refactor * Implements new ReactPy interface w/o Props Here is that interface: <component>(**props_as_kwargs)(*children_as_args) * Remove pages and add scaffold page to app.py Highlights true single-file/language app development * Fixes and formats reactpy scaffold template files * Tweak to app.py_tmpl * Removes workspaces from reactpy scaffold * Formats from black and flake8 * Tweaks per feeback by @NSwain
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.
Description
The work herein was initiated to fix a critical bug with Tethys ReactPy apps, but became somewhat gold-plated with a few additional features and fixes.
Critical bugfix:
Namely, having separate ComponentLibrary instances - one per app page - rather having a single, global instance. The ComponentLibrary was designed to dynamically keep track of an app's dependencies. On initial development, it was implemented as a single, global library shared by all apps and pages. This led to the issue of separate apps and pages essentially fighting over the ComponentLibrary, overwriting the dependencies for each other or injecting unneeded ones for other apps/pages.
Other Bugfixes:
use_workspace
is now built on the correct ReactPyuse_query
paradigm that allows the Django ORM to be queried to check quotas without raising an error or having to do other hokey workarounds. Theuse_query
Promise-like object was wrapped and customized to substitutechecking_quota
andquota_exceeded
forloading
anderror
, respectively. It is now used as follows:setup.py
files were replaces withpyproject.toml
files to resolve broken installation of those resources during testingAdditional features:
Props
argument by implementing a new syntactical interface for defining ReactPy code:<elem>(**props_as_kwargs)(*children_as_args)
. For example:Instead of
use_workspace(user=None)
,use_media(user=None)
,use_resources()
anduse_public()
Changes Made to Code
Additional Notes
Quality Checks