* textarea: expose auto_height and enter_key_submit props
These two props improve the workflow for chat apps and other situations where
we want multiline input.
auto_height: resize the textarea based on its contents
enter_key_submit: pressing enter submits the enclosing form (shift+enter
inserts new lines)
Fix#1231
* Update pyi
* add command to share custom component info for gallery
* cleanup
* tested
* Update custom_components.py
Co-authored-by: Masen Furer <m_github@0x26.net>
* reorder the questions
* ask user to verify info before publishing
* remove questions already captured in pyproject.toml
* no need to cache form inputs since not many questions
* tested
* cleanup
* delete test
---------
Co-authored-by: Masen Furer <m_github@0x26.net>
* parse_args_spec: resolve annotations with typing.get_type_hints
Ensure that event trigger specs in modules with future annotations are resolved
correctly.
Fix#2848
* Fix arg spec for on_upload_progress event
Make py3.8 compatible with `get_type_hints`
In exec.py, run_process_and_launch_url already passes `shell=True` on windows,
but the AppHarness has never really been used on Windows, so we were missing
this detail.
Fix#2941
* When a Var points to a model, prefer access to model fields.
When a Var points to a model, and fields of the model share the same name as
Var operations, access to the model fields is now preferred to avoid having Var
operation names shadow model fields. Since most Var operations do not actually
work against Models, this does not really block any functionality.
* Special case for ComputedVar needing to internally access fget
Since fget is a "slot" on property, normal __getattribute__ access cannot find it.
* Workaround https://github.com/python/cpython/issues/88459
In python 3.9 and 3.10, the `isinstance(list[...], type)` returns True, but
it's not a valid class for use in issubclass
* Use dill instead of cloudpickle for serialization
* smaller size pickles
* support dynamically defined states
* avoid issues with unpickleable globals
* pyproject: add dill, remove cloudpickle
* poetry.lock: relock dependencies
* Dynamically convert EventHandler to functools.partial
Instead of converting the functions up front and assigning them to the
instance, unbox the function from the EventHandler when it is requested via
__getattribute__. This reduces the size of the per-instance pickle, because
event handler bodies do not need to be included.
* Improve checking for cython_function_or_method
Because pydantic can be installed without cython, only use the workaround in
the case where the BaseModel.validate function is NOT a FunctionType,
indicating it's a cython function.
* Serialize all State subclasses by reference
* remove codspeed.yml
* test upload job
* minor edits to get upload job working
* perhaps this works
* upload needs relex-install-size
* retrigger pipeline
* test only on ubuntu
* change to save to db directly
* oops
* size benchmarks
* .web for counter
* its timeout-minutes
* se integration.sh to run and kill process
* install psycopg2
* move .web runs to integration_tests.yml to save runners
* fix measurement-type for reflex-web
* add database url to env
* psycopg2
* test run ids
* commit sha gets the job done
* refactor
* add more matrices
* move reflex package size to integration_test.yml
* fix venv path
* test fix
* test fix
* use hyphen
* testing reflex build size
* ls for temp debug
* fix typo in command
* possible fix
* possible fix for windows
* remove dead code
* remove dead code
* remove unwanted comments
* refactor
* rebase on main
* pr_title
* remove pr_title from args
* debug
* should work now
* precommit fix
* print out package size for
* add shell
* test
* trying again
* dont use cached poetry to have accurate measurement of deps
* remove reflex deps calculation step from integration job
* fix script path
* precommit fix
* no real difference on different python versions so use 3.11.5
* remove ls keyword
* Benchmark add extra info on publishing data
* fix typo
* get file name for simplicity
* precommit fix
* removesuffix not in python3.8
* add pr_id in case the pr title is changed
* precommit fix
* When __REFLEX_SKIP_COMPILE == "yes" allow telemetry to fail
Allow running `--backend-only` without a .web directory
* When re-initializing a pre-project_hash project, do not blow up on KeyError
* Revert "Remove width prop from rx.select (#2835)"
This reverts commit d14292dc9b.
* HighLevelSelect: pass flex_shrink prop to SelectTrigger
This allows the high level select to have width="100%" and also shrink-to-fit inside a parent container.
Fix#2824, kind of
* Revert "Revert "Revert "Revert "use process pool to compile faster (#2377)" (#2434)" (#2497)" (#2595)"
This reverts commit 6b6eea4d7d.
* Adjust number of operations for more correct progress bar
* app: recognize REFLEX_COMPILE_PROCESSES and REFLEX_COMPILE_THREADS
Control whether multiprocessing is used and the number of processes or threads
that should be used.
This will allow users to opt-in to the new, potentially hazardous,
multiprocessing mode, which results in much faster compiles, but has already
been reverted 4 times. Lets leave the code in this time, but use the thread
pool executor by default.
Limiting the number of threads or processes to 1 can also aid in debugging
issues that arise during compile time.
* Allow REFLEX_COMPILE_PROCESSES=0 to trigger multiprocessing with auto workers
* Separate `get_hooks` and `get_hooks_internal` for stable output
When downstream component wrappers depend on State when writing hooks, they
need to be assured that all internal hooks (events, var hooks, memoized
handlers, etc) will be rendered prior to user-defined hooks.
This also makes it less likely for downstream components to feel the need to
overwrite `get_hooks` (no underscore) directly and break internal functioning
of Reflex components.
* Include internal hooks in AppWrap and Page
* Apply get_hooks_internal in a few more places
Display a warning message, recommending python 3.11 with the current release of
reflex.
We need this until running with a uvicorn version that has better support for
py3.12 on windows.
* CustomComponent ignores the annotation type in favor of the passed value
Do not require rx.memo wrapped functions to have 100% correct annotations.
* test_custom_component_get_imports: test imports from wrapped custom components
* Account for imports of custom components for frontend installation
Create new ImportVar that only install the package to avoid rendering the
imports in the page that contains the custom component itself.
* Handle Imports that should never be installed
* Fix up double negative logic
* Perf Optimization: use the imports we already calculate during compile
Instead of augmenting _get_imports with a weird, slow, recursive crawl and
dictionary reconstruction, just use the imports that we compile into the
components.js file to install frontend packages needed by the custom
components.
Same effect, but adds essentially zero overhead to the compilation.
* Get `client_ip` from `asgi.scope`
It seems like REMOTE_ADDR is always 127.0.0.1, which is not super useful when
trying to figure out where the websocket connection is originating from.
Of course this isn't a silver bullet because most-likely the WS will be passed
through a reverse proxy anyway... in that case, the client IP is likely in the
headers under `x_forwarded_for`
* client_ip: fallback to REMOTE_ADDR
* Make @rx.memo work with state vars passed as props
Seems like this was a regression from the StatefulComponent refactor, because
trying to pass a state Var to a CustomComponent gave undefined, likely due to
`_get_vars` not accounting for `self.props` in CustomComponents.
With this change, it works.
Integration test added to `test_var_operations.py`
* Allow CustomComponent props to be Component
Avoid calling `.json()` on all Base types because the Var serializer already
does that, but this way, more specific types (like Component) can be serialized
differently.
When the type is Component, attach a VarData with the imports and hooks to when
the Var is rendered, it also carries the correct imports/hooks and does not
throw frontend errors.