Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » Spylt: A Python/Svelte fullstack framework for demos and small sites
- ajskateboarder
-
Scratcher
1000+ posts
Spylt: A Python/Svelte fullstack framework for demos and small sites
Yes you read it correctly
Spylt (pronounced spilt, combination of Svelte and Python) is a connector for Python HTTP backends and Svelte frontends. Simple Python functions can be turned into web APIs which can be directly called from Svelte code under a single codebase.
Normally, if you wanted to combine an API and a frontend framework, you would have to separate the apps into different codebases and different repositories. (which a lot of apps have to do)
The ideal solution would be to simply store frontend code in a single application, similar to how classic monolith sites work. Instead of storing HTML pages however, it would use Svelte pages, which allow for better modularity and more reactivity.
This is what Spylt aims to do. Spylt works best for demo apps (like Streamlit or Gradio) that need more control over JavaScript/CSS. Since Spylt also uses Svelte for the frontend, it can outperform libraries like Pynecone and Plotly Dash.
Read more at the GitHub repo (and consider starring it)
I've actually had this code sitting around since October of 2022 until I decided to fix it
Spylt (pronounced spilt, combination of Svelte and Python) is a connector for Python HTTP backends and Svelte frontends. Simple Python functions can be turned into web APIs which can be directly called from Svelte code under a single codebase.
Normally, if you wanted to combine an API and a frontend framework, you would have to separate the apps into different codebases and different repositories. (which a lot of apps have to do)
The ideal solution would be to simply store frontend code in a single application, similar to how classic monolith sites work. Instead of storing HTML pages however, it would use Svelte pages, which allow for better modularity and more reactivity.
This is what Spylt aims to do. Spylt works best for demo apps (like Streamlit or Gradio) that need more control over JavaScript/CSS. Since Spylt also uses Svelte for the frontend, it can outperform libraries like Pynecone and Plotly Dash.
Read more at the GitHub repo (and consider starring it)
I've actually had this code sitting around since October of 2022 until I decided to fix it
Last edited by ajskateboarder (May 5, 2023 16:23:56)
- DifferentDance8
-
Scratcher
1000+ posts
Spylt: A Python/Svelte fullstack framework for demos and small sites

- ajskateboarder
-
Scratcher
1000+ posts
Spylt: A Python/Svelte fullstack framework for demos and small sites
bigspeefpv: now what on god's green earth do you need this forMaking simple data visualizations when you don't want to write a seperate API
With this framework, APIs are written as plain functions which are then transpiled to server routes
- DifferentDance8
-
Scratcher
1000+ posts
Spylt: A Python/Svelte fullstack framework for demos and small sites
so basically flask but for sveltebigspeefpv: now what on god's green earth do you need this forMaking simple data visualizations when you don't want to write a seperate API
With this framework, APIs are written as plain functions which are then transpiled to server routes
- ajskateboarder
-
Scratcher
1000+ posts
Spylt: A Python/Svelte fullstack framework for demos and small sites
Yes? Also this uses Quart which supports ASGIso basically flask but for sveltebigspeefpv: now what on god's green earth do you need this forMaking simple data visualizations when you don't want to write a seperate API
With this framework, APIs are written as plain functions which are then transpiled to server routes
- ajskateboarder
-
Scratcher
1000+ posts
Spylt: A Python/Svelte fullstack framework for demos and small sites
Example:
from spylt import require_svelte app = require_svelte("./src/App.svelte") @app.backend() def say_hello(name: str): return f"Hello {name}"
<!-- point ./src/App.py:app --> <script> const say_hello = async (name) => { request = await fetch(`/api/say_hello?name=${name}`) json = await request.json() return json.response } let greeting let name = "Bob" </script> <main> <input type="text" bind:value={name}> <button on:click={(async function() { greeting = await say_hello(name) })()}>Say hello</button> <p>{greeting}</p> </main>
- qloakonscratch
-
Scratcher
1000+ posts
Spylt: A Python/Svelte fullstack framework for demos and small sites
“man I can't wait to SpyIt”
“Wait what you are going to spy on me”
“wait what no-”
“Wait what you are going to spy on me”
“wait what no-”
- bigspeedfpv
-
Scratcher
500+ posts
Spylt: A Python/Svelte fullstack framework for demos and small sites
sveltekit allows you to define api routes. is this supposed to be a python equivalent of that? if so kinda cool
- ajskateboarder
-
Scratcher
1000+ posts
Spylt: A Python/Svelte fullstack framework for demos and small sites
sveltekit allows you to define api routes. is this supposed to be a python equivalent of that? if so kinda coolYeah I knew you could do that in SvelteKit
I made this because Python has a generally better ecosystem
- ajskateboarder
-
Scratcher
1000+ posts
Spylt: A Python/Svelte fullstack framework for demos and small sites
Bump
- will_z_j
-
Scratcher
100+ posts
Spylt: A Python/Svelte fullstack framework for demos and small sites
Welcome to Grand Theft Auto: The Movie (Director's Çut)
Déconseillé aux moins de 18 ans by Canal+
Déconseillé aux moins de 18 ans by Canal+
- WojtekGame
-
Scratcher
1000+ posts
Spylt: A Python/Svelte fullstack framework for demos and small sites
-offtopic snip-

- ArrowAced
-
Scratcher
7 posts
Spylt: A Python/Svelte fullstack framework for demos and small sites
Normally, if you wanted to combine an API and a frontend framework, you would have to separate the apps into different codebases and different repositories. (I'm looking at you Meower)
Wouldn't Meower still have to separate them due to the use of websockets?
- ajskateboarder
-
Scratcher
1000+ posts
Spylt: A Python/Svelte fullstack framework for demos and small sites
Don't they also use HTTPNormally, if you wanted to combine an API and a frontend framework, you would have to separate the apps into different codebases and different repositories. (I'm looking at you Meower)Wouldn't Meower still have to separate them due to the use of websockets?
- CST1229
-
Scratcher
1000+ posts
Spylt: A Python/Svelte fullstack framework for demos and small sites
(#14)It does (alongside said websocket).Don't they also use HTTPNormally, if you wanted to combine an API and a frontend framework, you would have to separate the apps into different codebases and different repositories. (I'm looking at you Meower)Wouldn't Meower still have to separate them due to the use of websockets?
Last edited by CST1229 (April 20, 2023 22:09:43)
- ajskateboarder
-
Scratcher
1000+ posts
Spylt: A Python/Svelte fullstack framework for demos and small sites
Can people try out my framework and give thoughts? I haven't really done much testing outside of unit tests 
Make sure to read the caveats before starting

Make sure to read the caveats before starting
Last edited by ajskateboarder (April 20, 2023 23:27:23)
- ajskateboarder
-
Scratcher
1000+ posts
Spylt: A Python/Svelte fullstack framework for demos and small sites
b
- ajskateboarder
-
Scratcher
1000+ posts
Spylt: A Python/Svelte fullstack framework for demos and small sites

- ajskateboarder
-
Scratcher
1000+ posts
Spylt: A Python/Svelte fullstack framework for demos and small sites
b
- lolecksdeehaha
-
Scratcher
1000+ posts
Spylt: A Python/Svelte fullstack framework for demos and small sites
cool project but nobody here is going to use this since scratchers can't fathom full-stack development 
- Discussion Forums
- » Advanced Topics
-
» Spylt: A Python/Svelte fullstack framework for demos and small sites