WebPy
A web framework built on top of Flask that allows you to add filesystem routes (in the root/ folder of your project directory). Install it with pip install webpy-framework. Docs are located here.
Commands
Creating your project
webpy new {proj-name}- Create a new projectwebpy route {route-name}- Create a new filesystem route (this must be underroot/)
Deploying your project
webpy run- Run this in the project dir to start your app using Flaskwebpy build- Package the program into abuild.pyfilewebpy compile- Package the program into abuild.pycfilewebpy buildpyx- Compile the.pyxfiles into.pyfiles -- automatically runs through thebuild,compile, andruncommandswebpy buildmd- Transpile all Markdown files to HTML
WebPy allows developers to use just a minimal amount of Python (the bare minimum needed) for their web apps while also allowing for the full functionality of Flask. Take a look at webpy-app for example, where the majority of the codebase is HTML and JS while still allowing Flask to be fully utilized. WebPy web servers can also be compiled to standalone exectuables by compiling the output of webpy build with a tool such as Nuitka.
Your First WebPy Application
Start with webpy new myfirstproject. Then cd into the myfirstproject directory and open up your editor. It should look something like this:
myfirstproject/
html/
root/
config.json
index.py
static/
css/
index.css
images/
js/
index.js
app.py
config.json
The app.py file should contain some boilerplate code. You can use the app object just like a normal Flask object! App configurations should be done inside the webpy_setup function. Route functions can still be created. The config.json file in the same directory as the app.py file configures how WebPy will run your app. It takes any arguments that are valid to pass to app.run().
Under root/, you can use index.py and index.html files to create filesystem-based webpage routes. If you use an index.py file, WebPy will call the handler function and pass the app as an argument. If you use index.html, WebPy will just return that HTML file to the requester. Each filesystem route has a config.json file. In this file, you can pass any keyword arguments that would be valid to pass to app.route().
Let's create a new page at http://127.0.0.1:5000/hello. To do this, we can create a new folder called hello/ under the root/ folder. Cd into the root/ directory and type webpy route hello. WebPy will automatically create the hello/ directory for you.
myfirstproject/root/
hello/
index.py
config.json
...
Since we only want this route to be a simple HTML page, we can delete index.py and replace it with an index.html file.
index.html
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="/static/css/index.css"/>
</head>
<body>
<h1 id="heading">Hello, World!</h1>
</body>
</html>
Now, we can run our app using webpy run. Notice that when visiting http://127.0.0.1:5000/hello, the CSS that we linked from the static/ folder is included.
If you want to make your app a little more compact, you can use webpy build. This will compile all of your Python and HTML into a single minifed file, build.py, which can be run like a normal Python script. However, the the html/ and static/ directories are not packaged into the build file, so these must still be present to run build.py. When using webpy run to run the app, changes in the files under root/ and changes in files under static/ are guaranteed to be reflected in the app without having to restart it, but if the app is being run from a build.py file, changes in HTML, Python, and config files under root/ will not be reflected.
PyX can also be integrated into WebPy apps by changing Python files to .pyx files. These files can be compiled to Python files using webpy buildpyx, which is automatically run by the webpy build, webpy compile, and webpy run commands. WebPy comes with PySite/PyX as a dependency. Note that one must still import PySite HTML tags in every file that PyX is used, as shown below:
from webpy.pysite_semantic_tags import * # recommended
### OR
from pysite.tags import * # also works, but doesn't filter out unnecessary classes such as Element
Metadata
Release files for webpy-framework 3.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| webpy_framework-3.0.0.tar.gz | 13.0 kB | Without provenance | Details for webpy_framework-3.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| webpy_framework-3.0.0-py3-none-any.whl | Python 3 | none | any | Details for webpy_framework-3.0.0-py3-none-any.whl |
Total release size: 24.8 kB
Release files / webpy_framework-3.0.0.tar.gz
| Download URL | webpy_framework-3.0.0.tar.gz |
|---|---|
| Size | 13.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
224b7ba267c9d77d1f5f13aaf921d5b78e7e4c3c1c878b3c8372a0f85df978e9
|
|
BLAKE2b-256 checksum How to use checksums |
c9d6a7b7fcaefd6832c76b02a4d5f211702dea8234a8236141b63008858cd7c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Release files / webpy_framework-3.0.0-py3-none-any.whl
| Download URL | webpy_framework-3.0.0-py3-none-any.whl |
|---|---|
| Size | 11.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3d06f74bc721fb35a4de31bbf1f3757d010dac861c6f0216ec56e124b3141753
|
|
BLAKE2b-256 checksum How to use checksums |
c61a441a1f9595c8a6bacd804bdf42ba9049a89c1643f77fc315716db10319ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Security for webpy-framework 3.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.