View.py

Latest version: v1.0.0a9

Safety actively analyzes 625831 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 2

1.0.0

Quickstart


$ pip install -U view.py


Breaking Change

The `body` parameter in `Response` is now required. For example, the following code **does not** work on Alpha 9:

py
from view import new_app, Response

app = new_app()

app.get("/")
def index():
res = Response()
return res

app.run()


What's New?

- Added the `context` decorator and the `Context` type
- Added the `headers` parameter to functions on `TestingContext`
- Added `Route.middleware`
- Added `route` and `App.route`
- Added docstrings to router functions
- Added the `JSON` response class
- Added the `custom` body translate strategy
- Added the `extract_path` utility
- Added the `view build` command
- Added `App.template`
- Added `compile_type` and `TCValidator`
- Added `markdown` and `App.markdown`
- Added the `Error` class
- Added the `error_class` parameter to both `new_app` and `App`
- Added the `ERROR_CODES` constant

Bug Fixes

- Fixed syntax errors in `view init`
- Fixed `template` attribute with the `view` template renderer

Other Changes

- Modified some behavior of automatic route inputs
- Routes with equivalent paths but different methods now return `405 Method Not Allowed` when accessed
- Route errors now display the error message when `dev` is `True`
- Changed exception rendering in route errors to use the `rich` renderer

Docs Change

**Docs have been completely rewritten!** Changes and fixes for it will roll out over time. You can check out the new docs at [view.zintensity.dev](https://view.zintensity.dev)

This update also introduces the **View Insiders** program! See the docs or [my sponsors page](https://github.com/sponsors/ZeroIntensity) for more info.

1.0.0alpha9

1.0.0alpha8

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

1.0.0alpha7

- Remerged the `new-init` branch (didn't work properly the first time, for whatever reason).

1.0.0alpha6

- Added `get_app`
- Added documentation generation
- Added database support (NOT FINISHED)
- Added support for lists in type validation
- Added support for implicit query parameters
- Added `debug`, `info`, `warning`, `error`, and `critical` logging functions
- Added `InvalidRouteError`, `DuplicateRouteError`, `ViewInternalError`, and `ConfigurationError`
- Added logging functions to `App`
- Added `patterns` loader
- Added handling of relative paths in the configuration setting `loader_path`
- Added path to `PATH` environment variable during loading
- Added exists validation to `loader_path`

- Removed `attempt_import` and `MissingLibraryError`
- Renamed `debug` to `enable_debug`
- Renamed `EnvironmentError` to `BadEnvironmentError`

- Changed environment prefixes for configuration
- Rewrote documentation
- Upgraded `view init`

1.0.0alpha5

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

Page 1 of 2

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.