Commit Graph

2140 Commits

Author SHA1 Message Date
Thomas Brandého
5e026e4b27
Support python 3.13 (#4206)
* bump playwright and run tests with 3.13

* test with psycopg3

* typo

* update everything for psycopg 3.
2024-12-12 00:10:51 -08:00
Thomas Brandého
a86d2c612a
deprecate add_custom_404_page (#4505)
* deprecate add_custom_404_page

* show raw value in deprecate message

* fix typo

* Update reflex/app.py

Co-authored-by: Masen Furer <m_github@0x26.net>

* change removal version to 0.8.0

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2024-12-11 18:29:39 -08:00
benedikt-bartscher
a7151cd6c8
disable polling (#4441) 2024-12-11 18:29:01 -08:00
Thomas Brandého
fb444ad112
add ERA rules to detect commented out code (#4472)
* add eradicate rules for commented out code

* remove output change

* fix pyi messed up indent

* fix pyi again

* fix layout docstring

* fix pyi_generator to remove commented out props from docs

* fix pyi_generator and regenerate some pyi

* fix double strip

* update all pyi

* try to fix stuff in pyi_gen

* whatever

* remove that maybe? i don't know

* fix that shit?

* fix more shit, idk

* better not see you ever again, extra line
2024-12-11 18:26:44 -08:00
benedikt-bartscher
e4b5755568
fix: handle default_factory in get_attribute_access_type (#4517)
* fix: handle default_factory in get_attribute_access_type, add tests for sqla dataclasses

* only test classes which have default_factory + add test for no default
2024-12-11 18:22:31 -08:00
Masen Furer
95eb663347
client_state: create Var from value when pushing from backend (#4474)
This ensures that the value is properly escaped/formatted for direct use in
javascript code.
2024-12-11 17:15:17 -08:00
Masen Furer
d75a708e6b
Fix REFLEX_COMPILE_PROCESSES=0 (#4523)
when zero is passed, that is short for "use the default", which is actually
None in the code.

fix for both processes and threads being set to zero
2024-12-11 21:29:33 +01:00
benedikt-bartscher
2ee201b520
raise StateSerializationError if the state cannot be serialized (#4453)
* raise StateSerializationError if the state cannot be serialized

* fix test
2024-12-11 20:08:18 +01:00
Thomas Brandého
862d7ec807
add test for color mode (initial and toggle) (#4467)
* add test for color mode (initial and toggle)

* add css check

* add page reload in the tests

* update test to catch the appearance regression

* don't render the appearance prop of rx.theme
2024-12-11 19:57:51 +01:00
benedikt-bartscher
06d743cda9
fix: migrate is_backend_only (deprecated) to EnvironmentVariables (#4495) 2024-12-11 19:22:44 +01:00
Masen Furer
4922f7ba05
Reuse the sqlalchemy engine once it's created (#4493)
* Reuse the sqlalchemy engine once it's created

* Implement `rx.asession` for async database support

Requires setting `async_db_url` to the same database as `db_url`, except using
an async driver; this will vary by database.

* resolve the url first, so the key into _ENGINE is correct

* Ping db connections before returning them from pool

Move connect engine kwargs to a separate function

* the param is `echo`

* sanity check that config db_url and async_db_url are the same

throw a warning if the part following the `://` differs between these two

* create_async_engine: use sqlalchemy async API

update types

* redact ASYNC_DB_URL similarly to DB_URL when overridden in config

* update rx.asession docstring

* use async_sessionmaker

* Redact sensitive env vars instead of hiding them
2024-12-10 12:37:09 -08:00
benedikt-bartscher
3ef7106e0e
style: prefer type() over __class__ (#4512) 2024-12-10 12:35:46 -08:00
Masen Furer
37af2ee1ec
Revert "reduce lock expiration time to 1s (#4507)" (#4514)
This reverts commit 6e3e632bbd.
2024-12-10 11:12:26 -08:00
Thomas Brandého
fd0fd2c6d4
enable REFURB rules in ruff (#4466)
Co-authored-by: Masen Furer <m_github@0x26.net>
2024-12-10 09:52:03 -08:00
benedikt-bartscher
2520c51aaf
fix: multiple mismatched-type-assignment fixes (#4482)
* fix: only make type optional if it's not already, add helper to unwrap rx.Field

* migrate unwrap_field_type to private function
2024-12-10 09:49:56 -08:00
Thomas Brandého
49a8f813fe
bump ruff to 0.8 and relock poetry (#4451)
* bump ruff to 0.8 and relock poetry

* bump to 0.8.1

* relock poetry.lock

* update again
2024-12-10 09:17:57 -08:00
Elijah Ahianyo
6e42efd2b1
Fix deploy help text (#4508) 2024-12-10 09:15:53 -08:00
Elijah Ahianyo
6e3e632bbd
reduce lock expiration time to 1s (#4507) 2024-12-10 09:15:22 -08:00
Elijah Ahianyo
05b791653e
Default rx.link href to # so underline prop works (#4509) 2024-12-10 09:14:29 -08:00
Thomas Brandého
4ecb0b81ce
enable RUF rules for linting (#4465) 2024-12-10 09:11:50 -08:00
Thomas Brandého
a68eef23aa
add issues templates (#4455)
* add issues templates

* fix typo
2024-12-10 15:37:58 +01:00
Masen Furer
0a34949019
Add production-one-port example (#4489)
* Add production-one-port example

A more complex version of simple-one-port that facilitates better layer caching
to shorten build times and multi-stage build to reduce final image size.

Harder to understand, but ultimately nicer to use.

* fix Caddyfile format to avoid complaints

* docker-examples: bump all base images to python:3.13
2024-12-09 15:26:48 -08:00
benedikt-bartscher
9ff386bf48
add __repr__ method to MutableProxy (#4506) 2024-12-10 00:17:51 +01:00
benedikt-bartscher
3d89d74bdc
only mark backend vars as dirty if they have changed (#4494) 2024-12-09 01:00:01 -08:00
Thomas Brandého
a895eaaede
fix non-interactive flag in deploy command (#4498) 2024-12-06 22:16:21 +01:00
benedikt-bartscher
3a225c2180
test dynamic route flakiness (can't reproduce locally) (#4496)
* test dynamic route flakiness (can't reproduce locally)

* fix typo
2024-12-06 17:41:53 +01:00
Masen Furer
3f4dca21a8
rename loginv2 to login (#4486)
* rename loginv2 to login

* reflex-hosting-cli bump to 0.1.29

* relock deps
2024-12-05 01:17:26 -08:00
Simon Young
12771004cb
remove v2 commands (#4478)
* remove v2 commands

* format

* remove v2

* remove v2

* little fixes friend

* add cloud

* relock poetry deps

* bump reflex-hosting-cli dep

* test_dynamic_routes: wait for token

attempt to avoid test flakiness

* relock deps

* test_dynamic_routes: increase polling timeout

---------

Co-authored-by: simon <simon@reflex.dev>
Co-authored-by: Masen Furer <m_github@0x26.net>
2024-12-04 23:21:18 -08:00
Elijah Ahianyo
e23d939781
[HOS-373][HOS-372]Logout should not open the browser (#4475)
* Logout should not open the browser

* check user login first before deploy
2024-12-04 18:17:22 -08:00
Masen Furer
a894f21ce5
[ENG-4149] require login to deploy named templates (#4450)
* integration_tests.yml: init masenf/rx_shout as a template

fix test

* [ENG-4149] require login to deploy template

* Send loginv2 telemetry event
2024-12-04 18:15:31 -08:00
Thomas Brandého
c721227a06
add default value for text area (#4462)
* add default_value prop in text_area

* also support it for el.textarea
2024-12-03 01:31:32 +01:00
Masen Furer
99d1b5fbdf
rx.upload must include _var_data from props (#4463)
* rx.upload must include _var_data from props

str-casting the dropzone arguments removed any VarData they depended on, like
the state context.

update test_upload to include passing a prop from a state var

* Handle large payload delta from upload event handler

Fix update chunk chaining logic; try/catch wasn't catching errors from the
async inner function.
2024-12-02 16:29:06 -08:00
Thomas Brandého
a320d062fb
enable css props via wrapperStyle for recharts components (#4447) 2024-12-02 09:20:33 -08:00
Masen Furer
39cdce6960
[HOS-333] Send a "reload" message to the frontend after state expiry (#4442)
* Unit test updates

* test_client_storage: simulate backend state expiry

* [HOS-333] Send a "reload" message to the frontend after state expiry

1. a state instance expires on the backing store
2. frontend attempts to process an event against the expired token and gets a
   fresh instance of the state without router_data set
3. backend sends a "reload" message on the websocket containing the event and
   immediately stops processing
4. in response to the "reload" message, frontend sends
   [hydrate, update client storage, on_load, <previous_event>]

This allows the frontend and backend to re-syncronize on the state of the app
before continuing to process regular events.

If the event in (2) is a special hydrate event, then it is processed normally
by the middleware and the "reload" logic is skipped since this indicates an
initial load or a browser refresh.

* unit tests working with redis
2024-11-28 13:56:41 +01:00
Masen Furer
24ff29f74d
bump to 0.6.7dev1 for further development (#4434) 2024-11-26 14:04:36 -08:00
Elijah Ahianyo
80696fec63
Remove invitation code logic from reflex logoutv2 (#4433)
* what happened there?

* we should do this for v2 instead
2024-11-25 12:14:50 -08:00
Thomas Brandého
f490643b25
follow up to #4426 (#4436) 2024-11-25 11:27:07 -08:00
Thomas Brandého
51ca89bc5c
allow for 'go.Figure | None' annotation in State (#4426) 2024-11-25 19:45:29 +01:00
benedikt-bartscher
d7d46e431b
fix: state size was not checked for dill (#4431) 2024-11-25 10:38:52 -08:00
Thomas Brandého
697e26c25b
fix mutable default in EventNamespace (#4420) 2024-11-23 10:51:07 -08:00
Masen Furer
c7d3876fe6
[ENG-4137] Handle generic alias passing inspect.isclass check (#4427)
On py3.9 and py3.10, `dict[str, str]` and other typing forms are kinda
considered classes, but they still fail when doing `issubclass`, so
specifically exclude generic aliases before calling issubclass.

Fix #4424

Bonus fix: support upcasting of pydantic v1 and v2 models
2024-11-23 10:48:50 -08:00
Masen Furer
000938414f
Avoid set_log_level foot gun (#4422) 2024-11-22 12:31:59 -08:00
Simon Young
c29c6b657a
Simon/hosting cli upgrades (#4417)
* update cli version

* little change man

* thats ruff

* v bump

---------

Co-authored-by: simon <simon@reflex.dev>
2024-11-21 17:50:35 -08:00
benedikt-bartscher
a5486335a3
rx._x.asset improvements (#3624)
* wip rx._x.asset improvements

* only add symlink if it doesn't already exist

* minor improvements, add more tests

* use deprecated Generator for python3.8 support

* improve docstring

* only allow explicit shared, only validate local assets if not backend_only

* fix darglint

* allow setting backend only env to false.

* use new is_backend_only in assets

* ruffing

* Move to `rx.asset`, retain old API in `rx._x.asset`

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2024-11-21 17:16:43 -08:00
Masen Furer
a6b324bd3e
[ENG-3953] Support pydantic BaseModel (v1 and v2) as state var (#4338)
* [ENG-3953] Support pydantic BaseModel (v1 and v2) as state var

Provide serializers and mutable proxy tracking for pydantic models directly.

* conditionally define v2 serializer

Co-authored-by: Khaleel Al-Adhami <khaleel.aladhami@gmail.com>

* Add `MutableProxy._is_mutable_value` to avoid duplicate logic

* Conditionally import BaseModel to handle older pydantic v1 versions

* pre-commit fu

---------

Co-authored-by: Khaleel Al-Adhami <khaleel.aladhami@gmail.com>
2024-11-21 17:01:14 -08:00
Elijah Ahianyo
5702a18502
[GTM-836]Rework Init workflow (#4377)
* Rework Init workflow

* minor format

* refactor

* add comments

* fix pyright alongside some improvements

* add demolink for blank template

* fix darglint

* Add more templates and keep template name in kebab case

* revert getting other templates since we'll use the submodules approach

* remove debug statement

* Improvements based on standup comments

* Add redirect logic

* changes based on new flow

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2024-11-21 16:58:12 -08:00
Elijah Ahianyo
9faa5d6fd9
Downgrade syntax highlighter to fix wrapLongLines (#4368) 2024-11-21 16:54:15 -08:00
benedikt-bartscher
c13cec3d8a
implement performance mode for existing state size check (#4392) 2024-11-21 16:33:47 -08:00
Masen Furer
b5e4b02d9c
New Event Action: temporal (#4404)
When an event/event spec is marked as "temporal", it will not be queued unless
the backend is up. This can be used to prevent periodic events (like from
`rx.moment`) from queueing up while the backend is down, and then stampeding
when the backend comes up and the queue is drained. It can be used to avoid
processing many periodic events at once when the app is only expecting to
process such an event every so often.
2024-11-21 16:32:38 -08:00
Masen Furer
bbfbc82c9d
Handle Var passed to rx.toast (#4405)
* Handle Var passed to `rx.toast`

If the user provides a `Var` for `message` then apply it as `props["title"]` to
avoid a var operations error.

* remove unnecessary parentheses

* remove weird hacks

* get it right pyright

---------

Co-authored-by: Khaleel Al-Adhami <khaleel.aladhami@gmail.com>
2024-11-21 16:15:01 -08:00