Comments (3)
I made a quick fix in 94d84c3.
We currently use pyright in strict mode for type checking this project. In my opinion, pyright works much better in my than mypy.
In theory, type checking with mypy in CI would be good, to avoid problems like the one that you ran into, where a project that that imports shiny makes use of mypy
to do type checking. However, I don't think that using mypy in addition to pyright is practical for Shiny, because there are differences in the behavior of mypy and pyright, as documented here:
https://github.com/microsoft/pyright/blob/main/docs/mypy-comparison.md
On the Shiny code base, pyright reports zero type errors, but mypy reports 180 errors. I don't think getting it to pass both systems would not make the code meaningfully better.
The change I made in 94d84c3 fixed the syntax error, but mypy still thinks there are type errors. Hopefully fixing just the syntax error is enough to satisfy the use case you have run into.
from py-shiny.
It would be nice if it were as simple as having an app.py
with import shiny
in it, like in your case. However, there are a number submodules which are not automatically loaded this way, and so they would not be "tested" for syntax errors under mypy.
If it were possible to run mypy
on the whole shiny codebase and report only mypy syntax errors, that is probably what we would want. However, I took a quick look at the mypy documentation and did not see a way to check only for mypy syntax errors. If you know of a way to do that, please let us know.
from py-shiny.
Thanks for the fix.
Hmm, I personally don't personally like the fact that pyright
has js dependencies and always preferred mypy
for CI/CD (I use pyright
in vs code), but it's good to know shiny
has pyright-first support when it comes to type checking, thanks.
As you mentioned, making shiny
internal code base pass both systems doesn't make sense to me neither, but making sure that mypy
users can just import shiny without problems in their code base could be beneficial.
from py-shiny.
Related Issues (20)
- Proposal: calling a reactive value could be a combined getter/setter
- ui.input_dark_mode not available in version 0.10.1
- folium maps in py shiny HOT 1
- Not possible to include CSS & Javascript HOT 2
- installing `shiny` via conda does not install `questionary` HOT 4
- Guide To Busy Indicator Use? HOT 5
- Support polars directly in DataGrid and render.data_frame
- Implicit www static dir for Shiny Express doesn't work on shinyapps.io/connect
- [suggestion] Allow global markdown configuration
- Can one make render.plot and ui.output_plot non dynamic?
- example for update_cell_selection HOT 2
- Equivalent to R dataTableProxy() to manipulate data in the data_frame
- Add a change log entry for testing api
- `navset_card_*()` has no `full_screen` option
- Unexpected difficulty starting out with py-shiny HOT 1
- Feature Request: scroll_to(row_id) for data_frame
- Programmatically unselect a selected row in a rendered dataframe
- PWA not working in shiny for python HOT 1
- get current session info HOT 2
- error importing ruamel, a package included in pyodide HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from py-shiny.