[HN Gopher] Show HN: Mountaineer - Webapps in Python and React
___________________________________________________________________
Show HN: Mountaineer - Webapps in Python and React
Hey HN, I'm Pierce. Today I'm open sourcing a beta of Mountaineer,
an integrated framework for building webapps in React and Python.
I've written a good 25+ webapps over the last few years in almost
every major framework under the sun. Python and React remain my
favorite. They let you get started quickly and grow to scale. But
the developer experience of linking these two worlds remains less
than optimal: -- Sharing typehints and schemas across frontend and
backend code -- Scattered fetch() calls to template data and
modify server objects -- Server side rendering / gateway support
-- Error handling on frontend fetches Mountaineer is an attempt to
solve those problems. I didn't want to re-invent the wheel of what
Python and React are good at, so it's relatively light on syntax.
It provides one frontend hook for React apps and introduces a MVC
convention on the backend for managing views. Support files are
generated progressively through a local watcher, so IDE type-hints
and function calls work out of the box. It's more intuitive to
explain with some code, so pop over to the Github if you're
interested in this stack and taking a look: Github:
https://github.com/piercefreeman/mountaineer More context:
https://freeman.vc/notes/mountaineer-v01-webapps-in-python-a...
Would love to hear your thoughts!
Author : icyfox
Score : 95 points
Date : 2024-02-27 14:59 UTC (8 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| frankfrank13 wrote:
| Seems very neat!
| greenie_beans wrote:
| interesting, def gonna try it out. thanks for sharing your work.
| robertlagrant wrote:
| Very nice. I would probably not try it, as it's FastAPI based,
| but more of these things need to spring up!
| bananakitty wrote:
| What's wrong with FastAPI?
| giancarlostoro wrote:
| My own preference, probably not similar to theirs but coming
| from Django, CherryPy and heck, I'll mention even ASP .NET
| Core, I prefer to design my websites in a more OOP way. The
| way CherryPy handles things is my favorite overall, if I
| could merge CherryPy and FastAPI I would.
| icyfox wrote:
| Hey giancarlostoro, big fan of OOP as well. I structured
| Controllers to just be regular classes - so you should be
| able to write server code and routes very similar to
| CherryPy.
| giancarlostoro wrote:
| Beautiful, I'm definitely adding this one to my list of
| frameworks to check out. I currently do C# professionally
| so most of my Python projects are just side projects
| currently.
| robertlagrant wrote:
| I don't really like the maintainer model. I'm more of a fan
| of Litestar, as they seem to have a similar product but more
| of a mature development model. I could be wrong.
| dsissitka wrote:
| I don't know if Litestar is doing particularly well there.
|
| https://www.reddit.com/r/litestarapi/comments/16flco9/core_
| m...
| buremba wrote:
| Seems interesting as current Python-based solutions don't have
| good support for Javascript. I see the support for the binding is
| from Python to JS but do you have any plans to support two-way
| binding work?
| icyfox wrote:
| Hey buremba, can you share more about the use-case that you're
| thinking about? Like JS function calling within Python?
| zeddotes wrote:
| This is cool! It's weird that I, very recently, created a project
| based on FastAPI and had a strong desire for a React frontend as
| well, so I created a solution for it. My solution actually
| supports React SSR as well and this project has motivated me to
| publish my library. Thanks!
| WesleyJohnson wrote:
| Care to share the link?
| xandrius wrote:
| I personally would like to see less of Python in the world but
| nevertheless great job!
| punnerud wrote:
| Removing ChatGPT and the rest of machine learning also? (Most
| of it based on Python)
|
| If your Python is slow, you are probably doing it wrong.
|
| I prefer fast prototyping over speed. Easier to fix the speed
| later, than never getting of ground with a "fast" language.
| sureglymop wrote:
| Python is great but typed python is awful. But getting type
| hints and type checking would be great. That and pythons
| package management chaos that is somehow even worse than npm
| are the main pain points imo.
| giancarlostoro wrote:
| I'm really confused, Python has type hints. It's had type
| hints for a while now? At least several years. As for
| package managers, I have run into woes with pip, but most
| of my gripes are when Debian or Ubuntu have their own
| versions of packages that are on pip. I rely on venv to
| save me there though. For the most part pip is fine, I'm
| not sure I've tried other package managers.
|
| Edit:
|
| Python 3.5 is where type hints were introduced, this was
| released in 2015, so nearly 9 years ago.
| phailhaus wrote:
| It's not that it doesn't have type hints, it's that
| they're really bad. Python decided to introduce the
| syntax for type hints before developing a type checker
| (which is still not officially supported). This means
| that the type system is filled with weird gaps that 3rd
| party typechecking libraries can't fix without breaking
| changes to the language itself.
|
| For example, `TypedDict` didn't support optional keys
| until Python 3.11, and even then you have to use the
| clunky `NotRequired` type to pull it off. This is despite
| the fact that having optional kwargs has been a common
| pattern for decades.
|
| The type system is also not particularly robust. You
| can't make a class similar to `dataclasses.dataclass`
| yourself and have it typecheck propertly, so libraries
| like Pydantic have to develop custom plugins for
| typecheckers like mypy to get themselves to work.
| giancarlostoro wrote:
| Ah I see, so you want it improved upon to better align
| with what has always been available to actually be
| represented by the option type system, I can agree with
| that.
|
| I'll be honest, I have not used it extensively, I'm used
| to just doing Python the old way, maybe once its been
| fully refined and becomes the status quo I'll dive into
| it. Until then, if I want types I just use a typed
| language.
| falcor84 wrote:
| If you think typed Python is awful, try typed Ruby
| xandrius wrote:
| I don't mind them existing but I do think typed languages are
| generally better. Also I'm personally not interested in raw
| speed, I care about having the programming language letting
| me know if statements in my code make no sense before running
| them.
|
| Just a personal opinion though, I'm always glad when people
| create something new and useful to them.
| Zetobal wrote:
| Wat den eenen sin Uhl, is den annern sin Nachtigall.
| triyambakam wrote:
| Or in Hochdeutsch:
|
| Was fur den einen die Eule ist, ist fur den anderen eine
| Nachtigall.
|
| And maybe idiomatically in English:
|
| One person's own is another person's nightingale. The owl is
| seen as bad luck while the nightingale as good luck.
| Rumudiez wrote:
| Does it support serverside rendering (SSR)?
| icyfox wrote:
| Yes it does! SSR support out of the box (powered by V8). This
| was one element of the Rust layer that was really important to
| pin down early and start benchmarking for performance. It ended
| up in a pretty nice place for the time-being: exception logging
| within the console and development frontend, 10-20ms rendering
| on average.
| yoz wrote:
| Kudos for how much polish and documentation work you've done
| here. It's rare to see a v0.1 release that's this accessible to
| newcomers, even rarer to see it all from one person. You clearly
| care about developer experience and that makes the project much
| more inviting.
| icyfox wrote:
| Thanks for the kind words, yoz. I think it's easier to write
| documentation when you're actively using + codeveloping
| solutions using the library as well. The README guides are as
| much for my future self as they are for anyone else. :) If you
| end up poking around with it, please shoot me a line for
| anything that can use some additional coverage.
| ninjha01 wrote:
| I have a less elegant, but perhaps less "magic" setup here:
| https://github.com/nitro-bio/micro-app
| liuxiaopai wrote:
| very cool
| selecsosi wrote:
| This would be fun to wire up into django middleware for some
| quick VM binding for react frontends. Appreciate the approach, as
| other's have said kudos and keep up the good work! Any work in
| this space to help alleviate the boilerplate is great
| WesleyJohnson wrote:
| Agreed. Would be very interested in the ability to do SSR on
| React components from Django, without proxying to Node to do
| so.
| iwebdevfromhome wrote:
| Very interesting work! Thanks for sharing. How hard do you think
| it'd be to swap React for Svelte ? Not that I feel strong for one
| or the other but I'm the process of learning svelte and having a
| good backend strategy for svelte views would be cool.
| kapitanjakc wrote:
| Hi I am trying to learn react for integration with Django.
|
| I keep starting to build tic tac to application and then just
| leave it there.
|
| Any tips and or documents on how to properly learn react ?
| lagt_t wrote:
| Django is better paired with something like HTMX.
___________________________________________________________________
(page generated 2024-02-27 23:00 UTC)