You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30-3Lines changed: 30 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,20 +17,47 @@
17
17
-[PyPI](https://pypi.org/project/view.py)
18
18
-[Discord](https://discord.gg/tZAfuWAbm2)
19
19
20
-
## Example
20
+
## Features
21
+
22
+
- Batteries Detachable: Don't like our approach to something? No problem! We aim to provide native support for all your favorite libraries, as well as provide APIs to let you reinvent the wheel as you wish.
23
+
- Lightning Fast: Powered by [pyawaitable](https://github.com/ZeroIntensity/pyawaitable), view.py is the first web framework to implement ASGI in pure C, without the use of external transpilers.
24
+
- Developer Oriented: view.py is developed with ease of use in mind, providing a rich documentation, docstrings, and type hints.
Copy file name to clipboardExpand all lines: docs/getting-started/configuration.md
+31-31Lines changed: 31 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,10 +8,10 @@ Before you can make any projects with view.py, you should learn about how it han
8
8
9
9
When creating your app, view will search for one of the following configuration files:
10
10
11
-
-`view.toml`
12
-
-`view.json`
13
-
-`view.ini`
14
-
-`view_config.py`
11
+
-`view.toml`
12
+
-`view.json`
13
+
-`view.ini`
14
+
-`view_config.py`
15
15
16
16
Note that while all of these are different formats, they can all evaluate to the same thing internally. If you have any questions on these semantics, once again see [configzen](https://github.com/bswck/configzen).
|`loader`| This is the strategy that will be used to load routes. Can be `manual`, `simple`, or `filesystem`. |`manual`|
87
-
|`app_path`| A string defining the location of the app, as well as the variable name. Should be in the format of `file_path:variable_name`. |`app.py:app`|
88
-
|`uvloop`| Whether or not to use `uvloop` as a means of event loop. Can be `decide` or a `bool` value. |`decide`|
89
-
|`loader_path`| When the loader is `simple` or `filesystem`, this is the path that it searches for routes. |`routes/`|
|`loader`| This is the strategy that will be used to load routes. Can be `manual`, `simple`, or `filesystem`. |`manual`|
87
+
|`app_path`| A string defining the location of the app, as well as the variable name. Should be in the format of `file_path:variable_name`. |`app.py:app`|
88
+
|`uvloop`| Whether or not to use `uvloop` as a means of event loop. Can be `decide` or a `bool` value. |`decide`|
89
+
|`loader_path`| When the loader is `simple` or `filesystem`, this is the path that it searches for routes. |`routes/`|
|`level`| Log level. May be `debug`, `info`, `warning`, `error`, `critical`, or an `int`. This is based on Python's built-in [logging module](https://docs.python.org/3/library/logging.html). |`info`|
125
125
|`server_logger`| This is a `bool` determining whether the ASGI backend's logger should be displayed. |`False`|
@@ -129,16 +129,16 @@ port = 8080
129
129
130
130
### User Logging Settings
131
131
132
-
*Environment Prefix:*`view_user_log_`
132
+
_Environment Prefix:_`view_user_log_`
133
133
134
-
-`urgency`: The log level for user logging. `info` by default.
135
-
-`log_file`: The target file for outputting log messages. `None` by default.
136
-
-`show_time`: Whether to show the time in each message. `True` by default.
137
-
-`show_caller`: Whether to show the caller function in each message. `True` by default.
138
-
-`show_color`: Whether to enable colorization for messages. `True` by default.
139
-
-`show_urgency`: Whether to show the urgency for messages. `True` by default.
140
-
-`file_write`: The preference for writing to an output file, if set. May be `both`, to write to both the terminal and the output file, `only`, to write to just the output file, or `never`, to not write anything.
141
-
-`strftime`: The time format used if `show_time` is set to `True`. `%H:%M:%S` by default.
134
+
-`urgency`: The log level for user logging. `info` by default.
135
+
-`log_file`: The target file for outputting log messages. `None` by default.
136
+
-`show_time`: Whether to show the time in each message. `True` by default.
137
+
-`show_caller`: Whether to show the caller function in each message. `True` by default.
138
+
-`show_color`: Whether to enable colorization for messages. `True` by default.
139
+
-`show_urgency`: Whether to show the urgency for messages. `True` by default.
140
+
-`file_write`: The preference for writing to an output file, if set. May be `both`, to write to both the terminal and the output file, `only`, to write to just the output file, or `never`, to not write anything.
141
+
-`strftime`: The time format used if `show_time` is set to `True`. `%H:%M:%S` by default.
142
142
143
143
Example with TOML:
144
144
@@ -153,12 +153,12 @@ log_file = "app.log"
153
153
154
154
## Template Settings
155
155
156
-
*Environment Prefix:*`view_templates_`
156
+
_Environment Prefix:_`view_templates_`
157
157
158
-
-`directory`: The path to search for templates. `./templates` by default.
159
-
-`locals`: Whether to include local variables in the rendering parameters (i.e. local variables can be used inside templates). `True` by default
160
-
-`globals`: The same as `locals`, but for global variables instead. `True` by default.
161
-
-`engine`: The default template engine to use for rendering. Can be `view`, `jinja`, `django`, `mako`, or `chameleon`. `view` by default.
158
+
-`directory`: The path to search for templates. `./templates` by default.
159
+
-`locals`: Whether to include local variables in the rendering parameters (i.e. local variables can be used inside templates). `True` by default
160
+
-`globals`: The same as `locals`, but for global variables instead. `True` by default.
161
+
-`engine`: The default template engine to use for rendering. Can be `view`, `jinja`, `django`, `mako`, or `chameleon`. `view` by default.
view.py is in very early stages and not yet considered to be ready for production.
17
+
If you would like to follow development progress, join [the discord](https://discord.gg/tZAfuWAbm2).
18
+
For contributing to view.py, please see our [contributors file](https://github.com/ZeroIntensity/view.py/blob/master/CONTRIBUTING.md)
19
+
20
+
## Quickstart
21
+
22
+
Install view.py:
23
+
24
+
```
25
+
$ pip install -U view.py
26
+
```
27
+
28
+
Initialize your project:
29
+
30
+
```
31
+
$ view init
32
+
```
33
+
34
+
**Note:** If this yields unexpected results, you may need to use `py -m view init` instead.
35
+
36
+
Write your first app:
37
+
38
+
```py
39
+
from view import new_app
40
+
41
+
app = new_app()
42
+
43
+
@app.query("greeting", str, default="hello")
44
+
@app.query("name", str, default="world")
45
+
@app.get("/")
46
+
asyncdefindex(greeting: str, name: str):
47
+
returnf"{greeting}, {name}!"
48
+
49
+
app.run()
50
+
```
51
+
52
+
## Why View?
53
+
54
+
As of now, view.py is still in alpha. Lot's of development progress is being made, but a production-ready stable release is still a bit far off. With that being said, anything mentioned in this documentation has been deemed already stable. In that case, why choose view.py over other frameworks?
55
+
56
+
If you've used a framework like [Django](https://djangoproject.com), you're likely already familiar with the "batteries included" idea, meaning that it comes with everything you could need right out of the box. View takes a different approach: batteries-detachable. It aims to provide you everything you need, but gives you a choice to use it or not, as well as actively supporting external libraries. This ideology is what makes View special. In batteries detachable, you can use whatever you like right out of the box, but if you don't like View's approach to something or like another library instead, you may easily use it.
57
+
58
+
## Should I use it?
59
+
60
+
For a big project, **not yet**, as View is not currently ideal for working with a big codebase. However, **that doesn't mean you should forget about it**. view.py will soon be stable and production ready, and you should keep it in mind. To support view.py's development, you can either [sponsor me](https://github.com/sponsors/ZeroIntensity) or [star the project](https://github.com/zerointensity/view.py/stargazers).
61
+
62
+
## Developing View
63
+
64
+
As stated earlier, view.py is very new and not yet at a stable 1.0.0 release. Whether you're completely new to GitHub contribution or an experienced developer, view.py has something you could help out with. If you're interested in contributing or helping out with anything, be sure to read [the contributors file](https://github.com/ZeroIntensity/view.py/blob/master/CONTRIBUTING.md) and/or joining the [discord](https://discord.gg/tZAfuWAbm2).
0 commit comments