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

tulip web: run UIScreen apps in code editor #517

Open
bwhitman opened this issue Feb 13, 2025 · 4 comments
Open

tulip web: run UIScreen apps in code editor #517

bwhitman opened this issue Feb 13, 2025 · 4 comments
Labels
web Tulip Web issue

Comments

@bwhitman
Copy link
Collaborator

We just eval the code editor. It should look for a def run()? and run it instead. Or something. But for now, if you paste a UIScreen app in the editor and click the green button it doesn't do anything unless you add a if __name__ == '__main__': thing.
See https://share.tulip.computer/gEP7Mu

@bwhitman bwhitman added the web Tulip Web issue label Feb 13, 2025
@bwhitman
Copy link
Collaborator Author

An annoyance here (self-owned) is that def run(screen): overwrites the imported from tulip import run in the namespace when running this type of code. They are two different runs with the same name.

@dpwe
Copy link
Collaborator

dpwe commented Feb 14, 2025

It's just, like, one corporation's styleguide's opinion, but the obvious resolution is to use tulip.run instead of your run.
Image

@bwhitman
Copy link
Collaborator Author

Is that their style guide for python interpreters that are also the CLI for the entire OS? They think of everything .

I really want to keep things like bare ls and run at the REPL. It's a better fix to rename the run out of UIScreen apps and/or have the web interpreter be somewhat intelligent about what kind of code it's running.

@dpwe
Copy link
Collaborator

dpwe commented Feb 14, 2025

I agree with making run resolve to tulip.run in the REPL.

What about using main() for the main function of the app you're defining in the editor ?

FTR: I think the bare ls etc. are unhappy compromises, because they attempt to bend the syntax of the REPL. I frequently find myself tricked into thinking I'm typing at a terminal shell, then very rapidly am brought back to reality. My preference is to embrace the REPL syntax. Not for nothing was print variable was removed in Python 3.x.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
web Tulip Web issue
Projects
None yet
Development

No branches or pull requests

2 participants