Skip to content

Commit 63f496e

Browse files
Merge pull request #147 from ZeroIntensity/docs-rewrite
Docs Rewrite
2 parents fe21eb0 + 400ed2e commit 63f496e

32 files changed

+1971
-574
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
fetch-depth: 0
3333

3434
- name: Build wheels
35-
uses: pypa/cibuildwheel@v2.15.0
35+
uses: pypa/cibuildwheel@v2.16.5
3636
env:
3737
CIBW_ARCHS_MACOS: x86_64
3838
HATCH_BUILD_HOOKS_ENABLE: "true"

CHANGELOG.md

Lines changed: 82 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -5,106 +5,109 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## Unreleased
9-
10-
- Fixed `template` attribute with the `view` template renderer
11-
- Added the `context` decorator and the `Context` type
12-
- Added the `headers` parameter to functions on `TestingContext`
13-
- Modified some behavior of automatic route inputs
14-
- Fixed syntax errors in `view init`
15-
- Added `Route.middleware`
16-
- Routes with equivalent paths but different methods now return `405 Method Not Allowed` when accessed
17-
- Added `route` and `App.route`
18-
- Added docstrings to router functions
19-
- Added the `JSON` response class
20-
- Added the `custom` body translate strategy
21-
- Made `method` a keyword-only parameter in `path`
22-
- Added the `extract_path` utility
23-
- Added the `view build` command
24-
- Added `App.template`
25-
- Route errors now display the error message when `dev` is `True`
26-
- Changed exception rendering in route errors to use the `rich` renderer
27-
- Added `compile_type` and `TCValidator`
28-
- Added `markdown` and `App.markdown`
29-
- Added the `Error` class
30-
- Added the `error_class` parameter to both `new_app` and `App`
31-
- Added the `ERROR_CODES` constant
32-
- **Breaking Change:** The `body` parameter in `Response` is now required
8+
## [1.0.0-alpha9] - 2024-2-4
9+
10+
- Fixed `template` attribute with the `view` template renderer
11+
- Added the `context` decorator and the `Context` type
12+
- Added the `headers` parameter to functions on `TestingContext`
13+
- Modified some behavior of automatic route inputs
14+
- Fixed syntax errors in `view init`
15+
- Added `Route.middleware`
16+
- Routes with equivalent paths but different methods now return `405 Method Not Allowed` when accessed
17+
- Added `route` and `App.route`
18+
- Added docstrings to router functions
19+
- Added the `JSON` response class
20+
- Added the `custom` body translate strategy
21+
- Made `method` a keyword-only parameter in `path`
22+
- Added the `extract_path` utility
23+
- Added the `view build` command
24+
- Added `App.template`
25+
- Route errors now display the error message when `dev` is `True`
26+
- Changed exception rendering in route errors to use the `rich` renderer
27+
- Added `compile_type` and `TCValidator`
28+
- Added `markdown` and `App.markdown`
29+
- Added the `Error` class
30+
- Added the `error_class` parameter to both `new_app` and `App`
31+
- Added the `ERROR_CODES` constant
32+
- Completely rewrote docs
33+
- **Breaking Change:** The `body` parameter in `Response` is now required
3334

3435
## [1.0.0-alpha8] - 2024-1-21
3536

36-
- Added optional dependencies for `databases` and `templates`
37-
- Added environment prefixes for database configuration
38-
- Added `templates` and `TemplatesConfig` to config
39-
- Added the `templates` function
40-
- Added support for `attrs` in type validation
41-
- Added documentation for caching
42-
- Added the `cache_rate` parameter to routers
43-
- Removed `psutil` and `plotext` as a global dependency
44-
- Added `fancy` optional dependencies
45-
- Fixed route inputs with synchronous routes
46-
- **Breaking Change:** Route inputs are now applied in the order of the decorator call as it appears in code
37+
- Added optional dependencies for `databases` and `templates`
38+
- Added environment prefixes for database configuration
39+
- Added `templates` and `TemplatesConfig` to config
40+
- Added the `templates` function
41+
- Added support for `attrs` in type validation
42+
- Added documentation for caching
43+
- Added the `cache_rate` parameter to routers
44+
- Removed `psutil` and `plotext` as a global dependency
45+
- Added `fancy` optional dependencies
46+
- Fixed route inputs with synchronous routes
47+
- **Breaking Change:** Route inputs are now applied in the order of the decorator call as it appears in code
4748

4849
## [1.0.0-alpha7] - 2023-12-7
4950

5051
**Quick Patch Release**
5152

52-
- Remerged new `view init` command.
53+
- Remerged new `view init` command.
5354

5455
## [1.0.0-alpha6] - 2023-11-30
5556

56-
- Added `get_app`
57-
- Added documentation generation
58-
- Added database support (NOT FINISHED)
59-
- Removed `attempt_import` and `MissingLibraryError`
60-
- Added support for lists in type validation
61-
- Added support for implicit query parameters
62-
- Renamed `debug` to `enable_debug`
63-
- Added `debug`, `info`, `warning`, `error`, and `critical` logging functions
64-
- Added `InvalidRouteError`, `DuplicateRouteError`, `ViewInternalError`, and `ConfigurationError`
65-
- Renamed `EnvironmentError` to `BadEnvironmentError`
66-
- Added logging functions to `App`
67-
- Changed environment prefixes for configuration
68-
- Rewrote documentation
69-
- Added `patterns` loader
70-
- Added handling of relative paths in the configuration setting `loader_path`
71-
- Added exists validation to `loader_path`
72-
- Add path to `PATH` environment variable during loading
73-
- Upgraded `view init`
57+
- Added `get_app`
58+
- Added documentation generation
59+
- Added database support (NOT FINISHED)
60+
- Removed `attempt_import` and `MissingLibraryError`
61+
- Added support for lists in type validation
62+
- Added support for implicit query parameters
63+
- Renamed `debug` to `enable_debug`
64+
- Added `debug`, `info`, `warning`, `error`, and `critical` logging functions
65+
- Added `InvalidRouteError`, `DuplicateRouteError`, `ViewInternalError`, and `ConfigurationError`
66+
- Renamed `EnvironmentError` to `BadEnvironmentError`
67+
- Added logging functions to `App`
68+
- Changed environment prefixes for configuration
69+
- Rewrote documentation
70+
- Added `patterns` loader
71+
- Added handling of relative paths in the configuration setting `loader_path`
72+
- Added exists validation to `loader_path`
73+
- Add path to `PATH` environment variable during loading
74+
- Upgraded `view init`
7475

7576
## [1.0.0-alpha5] - 2023-09-24
7677

77-
- Added `app.query` and `app.body`
78-
- Patched warning with starting app from incorrect filename
79-
- Updated `__all__` for `routing.py`
80-
- Added `view.Response` and `view.HTML`
81-
- Fixed `__view_result__`
82-
- Added support for `__view_body__` and `__view_construct__`
83-
- Added support for Pydantic, `NamedTuple`, and dataclasses for type validation
84-
- Support for direct union types (i.e. `str | int`, `Union[str, int]`) on type validation
85-
- Added support for non async routes
78+
- Added `app.query` and `app.body`
79+
- Patched warning with starting app from incorrect filename
80+
- Updated `__all__` for `routing.py`
81+
- Added `view.Response` and `view.HTML`
82+
- Fixed `__view_result__`
83+
- Added support for `__view_body__` and `__view_construct__`
84+
- Added support for Pydantic, `NamedTuple`, and dataclasses for type validation
85+
- Support for direct union types (i.e. `str | int`, `Union[str, int]`) on type validation
86+
- Added support for non async routes
8687

8788
## [1.0.0-alpha4] - 2023-09-10
88-
- Added type validation (without support for `__view_body__`)
89-
- Patched query strings on app testing
90-
- Added tests for query and body parameters
91-
- Patched body parameters
92-
- Documented type validation
93-
- Patched bodies with testing
89+
90+
- Added type validation (without support for `__view_body__`)
91+
- Patched query strings on app testing
92+
- Added tests for query and body parameters
93+
- Patched body parameters
94+
- Documented type validation
95+
- Patched bodies with testing
9496

9597
## [1.0.0-alpha3] - 2023-09-9
96-
- Patched header responses
97-
- Added tests for headers
98-
- Updated repr for `Route`
99-
- Patched responses with three values
100-
- Documented responses and result protocol
98+
99+
- Patched header responses
100+
- Added tests for headers
101+
- Updated repr for `Route`
102+
- Patched responses with three values
103+
- Documented responses and result protocol
101104

102105
## [1.0.0-alpha2] - 2023-09-9
103106

104-
- Added `App.test()`
105-
- Added warning when filename does not match `app_path`
106-
- Added more tests
107-
- Upgrade CIBW to work on 3.11
107+
- Added `App.test()`
108+
- Added warning when filename does not match `app_path`
109+
- Added more tests
110+
- Upgrade CIBW to work on 3.11
108111

109112
## [1.0.0-alpha1] - 2023-08-17
110113

docs/building-projects/app_basics.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,27 @@ Every view project will have a `new_app` call. The simplest app looks like this:
88
from view import new_app
99

1010
app = new_app()
11+
app.run() # you'll learn about this later
1112
```
1213

1314
`new_app` does a few important things:
1415

15-
- Loads the configuration, regardless of whether a config file exists.
16-
- Sets the `App` address for use by `get_app` (more on that later).
17-
- Loads finalization code for when the app closes.
16+
- Loads the configuration, regardless of whether a config file exists.
17+
- Sets the `App` address for use by `get_app` (more on that later).
18+
- Loads finalization code for when the app closes.
1819

1920
While it's not required for every app, naming your app variable `app` is the proper convention for view, as that's the default variable searched for when using the `view serve` command, but more on that in a moment.
2021

2122
For now, just try to stick with naming your app file `app.py` and your `view.App` instance `app`.
2223

23-
::: view.app.App
24+
::: view.app.new_app
2425

2526
## Launching Apps
2627

2728
Python libraries generally have two ways to run a web server:
2829

29-
- Running via the command line.
30-
- Launching from Python itself (e.g. a `server.start(...)` function).
30+
- Running via the command line.
31+
- Launching from Python itself (e.g. a `server.start(...)` function).
3132

3233
Both have their benefits and downsides, so view.py supports both out of the box. `App` comes with its `run()` method, and the view CLI has the `view serve` command.
3334

@@ -54,17 +55,17 @@ app.run()
5455
print("you called the app with view serve") # this only runs when `view serve` is used
5556
```
5657

57-
::: view.app.App.run
58-
5958
### Fancy Mode
6059

6160
View comes with something called "fancy mode", which is a fancy UI that shows when you run the app. If you would like to disable this, you can do one of two things:
6261

63-
- Disable the `fancy` setting in configuration.
64-
- Pass `fancy=False` to `run()`.
62+
- Disable the `fancy` setting in configuration.
63+
- Pass `fancy=False` to `run()`.
6564

6665
You should disable it in the configuration if you completely despise fancy mode and don't want to use it at all, but if you only want to temporarily turn it off (for example, if you're a view.py developer and need to see proper output) then pass `fancy=False`.
6766

67+
::: view.app.App.run
68+
6869
## Getting the App
6970

7071
### Circular Imports
@@ -117,6 +118,6 @@ def index():
117118

118119
Every view.py project should contain a call to `new_app`. `new_app` does important things like loading your configuration, set's up finalization code, and letting the `App` instance be used by `get_app`.
119120

120-
Running an app can be done in two ways: programmatically via the `App.run` or through `view serve` command. However, every view.py app should contain an `App.run` to give the choice for running programmatically. By default, view.py has a fancy UI when running your app, which may be disabled via editing the config or passing `fancy=False` to `run()`.
121+
Running an app can be done in two ways: programmatically via the `App.run` or through `view serve` command. However, every view.py app should contain an `App.run` to give the choice for running programmatically. By default, view.py has a fancy UI when running your app, which may be disabled via editing the config or passing `fancy=False` to `run()`.
121122

122123
Finally, circular imports occur when two Python modules try to import each other, which can happen a lot in view when getting the app from the app file (especially in manual routing). To fix it, View provides a `get_app` function to get you your `App` instance without an import.

0 commit comments

Comments
 (0)