webpy-framework


Namewebpy-framework JSON
Version 2.0.2 PyPI version JSON
download
home_page
SummaryEasy-to-use Python web framework built on top of Flask
upload_time2023-06-02 17:56:49
maintainer
docs_urlNone
author
requires_python>=3.9
licenseMIT License Copyright (c) 2023 Carl Furtado Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords framework flask web server html markdown pyx wsgi http xml asgi deployment uvicorn
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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](https://webpy-framework.readthedocs.io/).

## Commands

### Creating your project
- `webpy new {proj-name}` - Create a new project
- `webpy route {route-name}` - Create a new filesystem route (this must be under `root/`)

### Deploying your project
- `webpy run` - Run this in the project dir to start your app using Flask
- `webpy build` - Package the program into a `build.py` file
- `webpy compile` - Package the program into a `build.pyc` file
- `webpy buildpyx` - Compile the `.pyx` files into `.py` files -- automatically runs through the `build`, `compile`, and `run` commands
- `webpy 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](https://github.com/User0332/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`
```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](https://github.com/User0332/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:
```py
from webpy.pysite_semantic_tags import * # recommended

### OR

from pysite.tags import * # also works, but doesn't filter out unnecessary classes such as Element
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "webpy-framework",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "framework,flask,web,server,html,markdown,pyx,wsgi,http,xml,asgi,deployment,uvicorn",
    "author": "",
    "author_email": "Carl Furtado <carlzfurtado@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/83/6a/714356e12205a8b5789103367e9aa9980b6aa043bddbf2116393b349774d/webpy-framework-2.0.2.tar.gz",
    "platform": null,
    "description": "# WebPy\r\n\r\nA 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](https://webpy-framework.readthedocs.io/).\r\n\r\n## Commands\r\n\r\n### Creating your project\r\n- `webpy new {proj-name}` - Create a new project\r\n- `webpy route {route-name}` - Create a new filesystem route (this must be under `root/`)\r\n\r\n### Deploying your project\r\n- `webpy run` - Run this in the project dir to start your app using Flask\r\n- `webpy build` - Package the program into a `build.py` file\r\n- `webpy compile` - Package the program into a `build.pyc` file\r\n- `webpy buildpyx` - Compile the `.pyx` files into `.py` files -- automatically runs through the `build`, `compile`, and `run` commands\r\n- `webpy buildmd` - Transpile all Markdown files to HTML\r\n\r\nWebPy 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](https://github.com/User0332/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.\r\n\r\n### Your First WebPy Application\r\n\r\nStart with `webpy new myfirstproject`. Then cd into the `myfirstproject` directory and open up your editor. It should look something like this:\r\n```\r\nmyfirstproject/\r\n  html/\r\n  root/\r\n    config.json\r\n    index.py\r\n  static/\r\n    css/\r\n      index.css\r\n    images/\r\n    js/\r\n      index.js\r\n\r\n  app.py\r\n  config.json\r\n```\r\n\r\nThe `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()`.\r\n\r\n\r\nUnder `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()`.\r\n\r\nLet'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.\r\n\r\n```\r\nmyfirstproject/root/\r\n  hello/\r\n    index.py\r\n    config.json\r\n\r\n  ...\r\n```\r\n\r\nSince we only want this route to be a simple HTML page, we can delete `index.py` and replace it with an `index.html` file.\r\n\r\n`index.html`\r\n```html\r\n<!DOCTYPE html>\r\n<html>\r\n\t<head>\r\n\t\t<link rel=\"stylesheet\" href=\"/static/css/index.css\"/>\r\n\t</head>\r\n\t<body>\r\n\t\t<h1 id=\"heading\">Hello, World!</h1>\r\n\t</body>\r\n</html>\r\n```\r\n\r\nNow, 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.\r\n\r\nIf 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.\r\n\r\n[PyX](https://github.com/User0332/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:\r\n```py\r\nfrom webpy.pysite_semantic_tags import * # recommended\r\n\r\n### OR\r\n\r\nfrom pysite.tags import * # also works, but doesn't filter out unnecessary classes such as Element\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 Carl Furtado  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Easy-to-use Python web framework built on top of Flask",
    "version": "2.0.2",
    "project_urls": {
        "Documentation": "https://webpy-framework.readthedocs.io/",
        "Homepage": "https://github.com/User0332/webpy"
    },
    "split_keywords": [
        "framework",
        "flask",
        "web",
        "server",
        "html",
        "markdown",
        "pyx",
        "wsgi",
        "http",
        "xml",
        "asgi",
        "deployment",
        "uvicorn"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "51e24e0efab6769460a627bd6d009791b0e0124c3f3ad425aba21304bb967e5b",
                "md5": "11696466ab87d495235ed5c339fa75bc",
                "sha256": "cae82f5f9ebdffb7cb89161ef19d0232ae93f78b4c1eadf84124f874243bf0a8"
            },
            "downloads": -1,
            "filename": "webpy_framework-2.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "11696466ab87d495235ed5c339fa75bc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 11827,
            "upload_time": "2023-06-02T17:56:47",
            "upload_time_iso_8601": "2023-06-02T17:56:47.815239Z",
            "url": "https://files.pythonhosted.org/packages/51/e2/4e0efab6769460a627bd6d009791b0e0124c3f3ad425aba21304bb967e5b/webpy_framework-2.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "836a714356e12205a8b5789103367e9aa9980b6aa043bddbf2116393b349774d",
                "md5": "4c984e800923f7c2087da14e8a9baebd",
                "sha256": "d63c89a80965cba6094a2d54201c0237b185af67f6c454812394bdf751a30f77"
            },
            "downloads": -1,
            "filename": "webpy-framework-2.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "4c984e800923f7c2087da14e8a9baebd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 12959,
            "upload_time": "2023-06-02T17:56:49",
            "upload_time_iso_8601": "2023-06-02T17:56:49.789942Z",
            "url": "https://files.pythonhosted.org/packages/83/6a/714356e12205a8b5789103367e9aa9980b6aa043bddbf2116393b349774d/webpy-framework-2.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-02 17:56:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "User0332",
    "github_project": "webpy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "webpy-framework"
}
        
Elapsed time: 0.12217s