Skip to content
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

pyi_generator cleanup: ruff, remove fully qualified reflex. names #3591

Merged
merged 8 commits into from
Jun 29, 2024

Conversation

masenf
Copy link
Collaborator

@masenf masenf commented Jun 29, 2024

  • Remove black dependency; format and fix generated files using ruff check and ruff format now
    • all unused imports are removed and duplicate imports are collapsed and ordered correctly, which reduces file size and line count of shipped pyi files
  • Replace special-case global import logic with creation of ast nodes from DEFAULT_IMPORTS
  • Remove fully-qualified reflex. names in pyi files. The generator now raises an error when trying to resolve a type hint that is not in the namespace of the pyi file, and asks the user to add it to DEFAULT_IMPORTS
  • Replace function with Callable in the event trigger annotation, since function is not actually a valid builtin name

pyi_generator changes only https://github.com/reflex-dev/reflex/pull/3591/files/780a36925bd3e6c29af0d5d6279f73d973f45a6c

masenf added 8 commits June 28, 2024 17:33
The previous method added quite a large line diff to the pyi files, so for now,
lets just add the `Breakpoints` import to the default set along with Var,
EventHandler, Style and others.
also generate updated pyi files in reflex/experimental namespace
Copy link
Member

@Alek99 Alek99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, glad we can switch fully to this

@masenf masenf merged commit f1dafc0 into main Jun 29, 2024
47 checks passed
@masenf masenf deleted the masenf/pyi_generator_cleanup branch June 29, 2024 15:48
cutoffthetop referenced this pull request in robert-koch-institut/mex-editor Jul 16, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [reflex](https://reflex.dev)
([source](https://togithub.com/reflex-dev/reflex)) |
project.dependencies | patch | `==0.5.5` -> `==0.5.6` |

---

### Release Notes

<details>
<summary>reflex-dev/reflex (reflex)</summary>

###
[`v0.5.6`](https://togithub.com/reflex-dev/reflex/releases/tag/v0.5.6)

[Compare
Source](https://togithub.com/reflex-dev/reflex/compare/v0.5.5...v0.5.6)

#### New Features

##### `rx.clipboard`

Handle global and component-scoped `on_paste` with multi-type data

- Add Clipboard component for handling global on_paste event by
[@&#8203;masenf](https://togithub.com/masenf) in
[https://github.com/reflex-dev/reflex/pull/3513](https://togithub.com/reflex-dev/reflex/pull/3513)

##### `rx.breakpoints` - Set breakpoints by name

- introduce customizable breakpoints by
[@&#8203;adhami3310](https://togithub.com/adhami3310) in
[https://github.com/reflex-dev/reflex/pull/3568](https://togithub.com/reflex-dev/reflex/pull/3568)
- add responsive props to radix components by
[@&#8203;adhami3310](https://togithub.com/adhami3310) in
[https://github.com/reflex-dev/reflex/pull/3583](https://togithub.com/reflex-dev/reflex/pull/3583)

##### Computed Backend Vars

- add computed backend vars by
[@&#8203;benedikt-bartscher](https://togithub.com/benedikt-bartscher) in
[https://github.com/reflex-dev/reflex/pull/3573](https://togithub.com/reflex-dev/reflex/pull/3573)
- improve backend var determination by
[@&#8203;benedikt-bartscher](https://togithub.com/benedikt-bartscher) in
[https://github.com/reflex-dev/reflex/pull/3587](https://togithub.com/reflex-dev/reflex/pull/3587)

#### Improvements

- \[REF-3056]Config knob for redis StateManager expiration times by
[@&#8203;ElijahAhianyo](https://togithub.com/ElijahAhianyo) in
[https://github.com/reflex-dev/reflex/pull/3523](https://togithub.com/reflex-dev/reflex/pull/3523)
- \[Perf] Ensure rx.match gets memoized to avoid excessive re-rendering
by [@&#8203;masenf](https://togithub.com/masenf) in
[https://github.com/reflex-dev/reflex/pull/3552](https://togithub.com/reflex-dev/reflex/pull/3552)
- bare sqlalchemy session + tests by
[@&#8203;benedikt-bartscher](https://togithub.com/benedikt-bartscher) in
[https://github.com/reflex-dev/reflex/pull/3522](https://togithub.com/reflex-dev/reflex/pull/3522)
- Remove chakra from codeblock by
[@&#8203;abulvenz](https://togithub.com/abulvenz) in
[https://github.com/reflex-dev/reflex/pull/3570](https://togithub.com/reflex-dev/reflex/pull/3570)
- add compilation timestamp in log by
[@&#8203;Lendemor](https://togithub.com/Lendemor) in
[https://github.com/reflex-dev/reflex/pull/3563](https://togithub.com/reflex-dev/reflex/pull/3563)
- \[REF-3148] add props for tabs by
[@&#8203;Lendemor](https://togithub.com/Lendemor) in
[https://github.com/reflex-dev/reflex/pull/3560](https://togithub.com/reflex-dev/reflex/pull/3560)
- show the value causing problem in deprecation warning by
[@&#8203;Lendemor](https://togithub.com/Lendemor) in
[https://github.com/reflex-dev/reflex/pull/3558](https://togithub.com/reflex-dev/reflex/pull/3558)
-   Better support for Github Codespaces
- Add a link to backend in connection error by
[@&#8203;masenf](https://togithub.com/masenf) in
[https://github.com/reflex-dev/reflex/pull/3044](https://togithub.com/reflex-dev/reflex/pull/3044)
- Better hot reload times on Windows with python 3.12 and uvicorn > 0.20
- \[REF-3164] Hack to fix Windows hot reload + Uvicorn upgrade by
[@&#8203;masenf](https://togithub.com/masenf) in
[https://github.com/reflex-dev/reflex/pull/3584](https://togithub.com/reflex-dev/reflex/pull/3584)
-   `rx.theme` appearance is reset in dev mode
- \[REF-2588]Clear color mode local storage for dev mode by
[@&#8203;ElijahAhianyo](https://togithub.com/ElijahAhianyo) in
[https://github.com/reflex-dev/reflex/pull/3548](https://togithub.com/reflex-dev/reflex/pull/3548)

#### Bug Fixes

- Fix radix radio cards component by
[@&#8203;emmakodes](https://togithub.com/emmakodes) in
[https://github.com/reflex-dev/reflex/pull/3545](https://togithub.com/reflex-dev/reflex/pull/3545)
- fix small typing issue by
[@&#8203;Lendemor](https://togithub.com/Lendemor) in
[https://github.com/reflex-dev/reflex/pull/3562](https://togithub.com/reflex-dev/reflex/pull/3562)
- \[REF-3185]\[REF-3180]Dont escape backticks in JS string interpolation
by [@&#8203;ElijahAhianyo](https://togithub.com/ElijahAhianyo) in
[https://github.com/reflex-dev/reflex/pull/3566](https://togithub.com/reflex-dev/reflex/pull/3566)
- classvars should not be backend vars by
[@&#8203;benedikt-bartscher](https://togithub.com/benedikt-bartscher) in
[https://github.com/reflex-dev/reflex/pull/3578](https://togithub.com/reflex-dev/reflex/pull/3578)
-   ComponentState and State mixins now work with backend vars
- copy backend vars from mixins by
[@&#8203;benedikt-bartscher](https://togithub.com/benedikt-bartscher) in
[https://github.com/reflex-dev/reflex/pull/3580](https://togithub.com/reflex-dev/reflex/pull/3580)
- fix var dependency over properties by
[@&#8203;benedikt-bartscher](https://togithub.com/benedikt-bartscher) in
[https://github.com/reflex-dev/reflex/pull/3588](https://togithub.com/reflex-dev/reflex/pull/3588)
- \[REF-3157] Avoid SQLModel metaclass conflict
([#&#8203;3610](https://togithub.com/reflex-dev/reflex/issues/3610))
- \[REF-3220] Fix rx.cancel_upload EventSpec
([#&#8203;3608](https://togithub.com/reflex-dev/reflex/issues/3608))
- do not get_config in global scope
([#&#8203;3597](https://togithub.com/reflex-dev/reflex/issues/3597))

#### Other Changes

- Validate ComputedVar dependencies, add tests by
[@&#8203;benedikt-bartscher](https://togithub.com/benedikt-bartscher) in
[https://github.com/reflex-dev/reflex/pull/3527](https://togithub.com/reflex-dev/reflex/pull/3527)
- do not validate non-cached var deps by
[@&#8203;benedikt-bartscher](https://togithub.com/benedikt-bartscher) in
[https://github.com/reflex-dev/reflex/pull/3576](https://togithub.com/reflex-dev/reflex/pull/3576)
- Radio group fix deprecation warning for creating vars with strings by
[@&#8203;ElijahAhianyo](https://togithub.com/ElijahAhianyo) in
[https://github.com/reflex-dev/reflex/pull/3567](https://togithub.com/reflex-dev/reflex/pull/3567)
- update dependencies pinning by
[@&#8203;Lendemor](https://togithub.com/Lendemor) in
[https://github.com/reflex-dev/reflex/pull/3556](https://togithub.com/reflex-dev/reflex/pull/3556)
- fix formatting by
[@&#8203;benedikt-bartscher](https://togithub.com/benedikt-bartscher) in
[https://github.com/reflex-dev/reflex/pull/3574](https://togithub.com/reflex-dev/reflex/pull/3574)
- order type annotations in pyi_generator by
[@&#8203;benedikt-bartscher](https://togithub.com/benedikt-bartscher) in
[https://github.com/reflex-dev/reflex/pull/3585](https://togithub.com/reflex-dev/reflex/pull/3585)
- Deprecate cached var by
[@&#8203;benedikt-bartscher](https://togithub.com/benedikt-bartscher) in
[https://github.com/reflex-dev/reflex/pull/3582](https://togithub.com/reflex-dev/reflex/pull/3582)
- Change Strategy Prop to Literal by
[@&#8203;Alek99](https://togithub.com/Alek99) in
[https://github.com/reflex-dev/reflex/pull/3575](https://togithub.com/reflex-dev/reflex/pull/3575)
- pyi_generator cleanup: ruff, remove fully qualified reflex. names by
[@&#8203;masenf](https://togithub.com/masenf) in
[https://github.com/reflex-dev/reflex/pull/3591](https://togithub.com/reflex-dev/reflex/pull/3591)
- cleanup unused check by
[@&#8203;benedikt-bartscher](https://togithub.com/benedikt-bartscher) in
[https://github.com/reflex-dev/reflex/pull/3590](https://togithub.com/reflex-dev/reflex/pull/3590)
- split lifespan and middleware logic in separate mixin files by
[@&#8203;Lendemor](https://togithub.com/Lendemor) in
[https://github.com/reflex-dev/reflex/pull/3557](https://togithub.com/reflex-dev/reflex/pull/3557)
- Update links to /docs/library/dynamic-rendering/foreach/
([#&#8203;3609](https://togithub.com/reflex-dev/reflex/issues/3609))

#### New Contributors

##### Welcome Khaleel to the Core Team

- [@&#8203;adhami3310](https://togithub.com/adhami3310) made their first
contribution in
[https://github.com/reflex-dev/reflex/pull/3568](https://togithub.com/reflex-dev/reflex/pull/3568)

**Full Changelog**:
reflex-dev/reflex@v0.5.5...v0.5.6

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MzEuNyIsInVwZGF0ZWRJblZlciI6IjM3LjQzMS43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants