-
-
Notifications
You must be signed in to change notification settings - Fork 216
Question: Interactive Development Workflow #318
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
Comments
Indeed there's no general 'best way', so this should indeed be a 'growing' thread. Even in my own way of developing with Transcrypt there are some variations.
Well, all in all not very ground breaking, but I hope it gives you an idea. |
Thanks for the very detailed reply! It's helpful indeed.
That makes sense. I've always thought JS programmers tend to overdo it with anonymous functions in the sense that a little reduction in code size or a small gain in speed may not be worth the loss of readability.
I suspect there may be a lot of opportunity for working more directly with the DOM as Python makes it, to my mind, a little easier to wrap the DOM calls into functions and classes.
That's encouraging. I'm hoping the same happens with me after I've written more TS.
Make perfect sense for anything that doesn't use a JS library or need to be running in a browser.
The NearlyPurePythonWebAppDemo is my way of doing that. By running it locally with Bottle's reloader enabled, server-side changes update automatically. For the client side, I can change/save/recompile the Transcrypt files and then do a page reload without restarting the server.
I'm using a $5/month account at pythonanywhere.com. I'm pretty happy with them so far.
Sometimes the old ways are best :-)
That's a really handy feature.
Definitely a timesaver.
Ok. I'm going to have read that section of your docs a few more times and figure out how to use that.
I'll give that a try. And thanks for the heads-up about the deviations. |
For client side auto-compile, one can use use something like entr, as suggested by AXGKI a while back. It's linux based, but if you're on Win 10, "Windows subsystem for Linux" has a nice Bash shell (not VM based, but using a system that translates linux kernel calls to windows kernel calls, so it's fast and does not use too many resources). You may wish to use the version distributed with the 'creators update', as the previous version had some issues, though it did what i needed for Transcrypting - i was also able to minify after installing java using apt-get, despite that they said java didn't work. Using entr in combination with tmux, one can make something quite useful. For example:
This opens three views within the bash terminal, one for auto compiling whenever ./src/*.py is changed, one with a web server and one with a normal console for doing things. From AXGKI's example above, one could also modify the first session to allow auto-reloading of the browser window. Edit: Just realised i haven't tested entr or tmux on Windows yet, but the above works in bash on linux. |
Hey, fzzylogic, thanks for the pointer to In the meantime, I've committed some refinements to my demo skeleton that are making the development process very convenient. It now rebuilds and reloads both the server and the client pages whenever I change any of the source files. Full documentation here. The above plus Chrome DevTools are pretty close to all I could ask for at this time. Now if I could only do something about my error-prone brain ... |
Thanks for the update, it's looking good! I'm also glad about the removal of jQuery. Don't have any issues with it, but prefer not to use it unless i have to. |
This thread seems to have come to a standstill. |
Uh oh!
There was an error while loading. Please reload this page.
In day-to-day Python development, I almost always keep an iPython session active so I can easily paste a few lines for a quick test of functionality or to look up a docstring from an infrequently used module.
Chrome DevTools serves similarly for web development. I use the console to test JS functions and expressions and to explore library functions.
Since Transcrypt is a compiler, there's inevitably some loss of immediacy. Although I can still test pure python expressions in iPython and pure JS expressions in DevTools, I'm wondering about recommended practices for developing with Transcrypt. The source maps work well for debugging -- that's a plus and not much of a concern. The more urgent question, I think, is how to efficiently explore unfamiliar JS libraries and figure out how to best use them from Python, e.g. what types of arguments to pass and and how to access returned objects.
I realize this isn't something to which there's a one-size-fits-all answer so I see this issue as perhaps the start of a discussion thread. I'd be particularly interested to hear about how the examples that use React, Plotly, etc were developed.
Cheers,
Mike
The text was updated successfully, but these errors were encountered: