Conversation
* feat(core): implement GET and POST request handling, add WSGI server - Added request parsing for both GET and POST methods - Implemented a minimal WSGI-compatible server - Updated .gitignore to exclude virtual environments and compiled files * Fix: Improve request handling and enhance template rendering * refactor(router): switch from dict to list of (path, handler) tuples in routes * fix(docs): update argument type in Wiverno constructor documentation * refactor(main): enhance Wiverno initialization and error handling * refactor(main): streamline request handling and enhance error logging * refactor: reorganize project structure and move request handling to core module * refactor(requests): simplify query string parsing and enhance POST data handling refactor(server): improve server shutdown handling with user feedback * feat(errors): implement custom 404 and 500 error pages with improved visualization. Add the ability to connect custom pages for 404 and 500 errors. Fixed an incorrect path in the Templator * feat(errors): remove old error templates and add new ones in the static directory * feat(errors): implement MethodNotAllowed405 handler and improve error page rendering * docs: improve README and add packaging (#2) * feat: check before merge * Update wiverno/templating/templator.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update wiverno/templating/templator.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * refactor(templator): update base directory handling and improve template loading * fix: correct 404 response message and type annotation for system_templator --------- Co-authored-by: Sayrrexe <sayrrexe@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
The `pyproject.toml` file has been added. The `requirements.txt` file has been updated. The files `.python-version` and `uv.lock` have been added to `.gitignore`.
* feat(router): implement routing functionality with method decorators feat(errors): enhance 500 error page with traceback display * feat(docs): add docstrings for classes and methods across the codebase * feat(version): update version to 0.1.1 and improve logging in server * feat(router): set default HTTP methods for route handlers * feat(version): update version to 0.1.1 in setup.py fix(router): remove default methods in router class fix(main): remove default methods in Wiverno class * fix(router): clarify comment on default HTTP methods for routes --------- Co-authored-by: Sayrrexe <sayrrexe@gmail.com>
* build(deps): configure uv dependency management and project metadata style: apply ruff linting fixes and modernize type hints * feat(tests): add unit tests for Wiverno framework components - Created unit tests for the requests module, covering query parsing, body parsing, header parsing, and request initialization. - Implemented unit tests for the router class, including route registration, HTTP methods, and programmatic route addition. - Added unit tests for the server class, testing initialization, start method, and integration with WSGI applications. - Developed unit tests for the templator class, focusing on initialization, template rendering, error handling, and integration with Jinja2. * feat(config): updated configurations for Ruff and MyPy to enhance type annotations and compliance with standards. fix(code): adjusted the code to align with the new configurations and requirements for type annotations. * feat(cli): add CLI interface with commands for server management and documentation feat(dev): implement development server with hot reload functionality feat(toml): add script entry point and update dependency groups in pyproject.toml * docs(framework): add comprehensive documentation for Wiverno - Create project structure guide with minimal and recommended layouts - Add quickstart guide for building "Hello, World!" application - Document request handling: attributes, methods, and data parsing - Provide routing documentation: decorators, path parameters, and router usage - Update index and installation instructions for better clarity - Configure mkdocs for improved presentation and navigation * refactor(codebase): improve readability and type hinting - Clean up imports and remove unused ones across test files - Standardize type hints for WSGI environment and request handling - Add explicit type annotations to router and request classes - Improve CLI commands for better readability and consistency - Add pre-commit configuration with Ruff and Mypy - Remove trailing whitespace and ensure newline at EOF - Update templator and view classes with proper type handling - Refactor DevServer class for better structure and clarity - General code cleanup to enhance maintainability * test(core): add unit tests for DevServer and Wiverno application - Implement comprehensive DevServer tests: - DebounceHandler functionality - Server initialization and configuration - Process management (start/stop methods) - Hot reload and file change detection - Add Wiverno application tests: - Error handling (404, 405, 500 responses) - Route decorators and functionality - Router inclusion and route matching - WSGI integration and request-response cycle - Edge cases and debug mode behavior * chore(coverage): exclude cli.py and dev_server.py from coverage reports * refactor(router): improve route inclusion logic and handle prefix normalization * refactor(router): enhance route normalization and data structure for routes --------- Co-authored-by: Sayrrexe <sayrrexe@gmail.com>
* Refactor routing system and enhance request handling - Introduced a new routing structure with Router and RouterRegistry classes to manage routes more effectively. - Removed the old Router class and replaced it with a mixin-based approach for better modularity. - Implemented PathPattern for dynamic route matching with support for FastAPI-style parameters. - Enhanced the Request class to normalize paths correctly, ensuring consistent behavior across the application. - Updated the Wiverno application to utilize the new routing system, allowing for cleaner route management and error handling. - Simplified the DevServer class by removing unnecessary comments and improving code clarity. - Refined the Templator class to streamline template loading from specified directories. - Cleaned up the BaseView class documentation for clarity and removed example code to focus on the class's purpose. * feat(linting): update pre-commit configuration and exclude test files from linting refactor(tests): clean up test files by removing unnecessary blank lines refactor(routing): improve router registry access and enhance route registration methods fix(requests): add path_params attribute to Request class for dynamic route parameters --------- Co-authored-by: Sayrrexe <sayrrexe@gmail.com>
* feat(requirements): fixing a broken character * feat(requests): replace ParseQuery with QueryDict for multi query string handling --------- Co-authored-by: Sayrrexe <sayrrexe@gmail.com>
* Feat: Update documentation and examples for dynamic routing and path parameters * Feat(docs): Update documentation and examples to reflect changes in application entry point and routing system
- Move typer, rich, and watchdog from optional dev dependencies to main dependencies - Fix ModuleNotFoundError when running wiverno CLI after installation - Update documentation to use run.py as default module name - Remove unnecessary --app-module flags from documentation examples - Generate requirements.txt and requirements-dev.txt files
…idelines, and authors
* feat(http): add HTTP status code validation and normalization
Implement comprehensive HTTP status validation system with automatic
normalization to WSGI-compliant format following best practices.
Structure:
- Add wiverno/core/exceptions.py with InvalidHTTPStatusError
- Add wiverno/core/http/validator.py with HTTPStatusValidator
- Create HTTPStatusValidator.normalize_status() for status code handling
Features:
- Accept int or str status codes (e.g., 200, "404", "200 OK")
- Automatic conversion to WSGI format ("404 Not Found")
- Auto-correction of malformed strings ("404 Wrong" → "404 Not Found")
- Validation with InvalidHTTPStatusError for invalid inputs
- Support for all standard HTTP status codes (1xx-5xx)
Implementation:
- Update main.py to normalize all status codes through validator
- Modify default error pages (404/405/500) to return integers
- Apply normalization to both handler responses and error pages
- Add comprehensive docstrings with usage examples
Testing:
- Add 35 unit tests in tests/unit/test_http_validator.py
* Test all HTTP status code ranges (1xx-5xx)
* Test int/str input handling and edge cases
* Test error handling and exception behavior
- Add 10 integration tests in tests/integration/test_http_status.py
* Test status validation in full application context
* Verify handler int/str status compatibility
* Ensure default error pages work correctly
- Update 9 existing tests to expect integer status codes
- Coverage: 96.45% (up from 94.22%)
Breaking Changes:
- Default error handlers (404/405/500) now return int status codes
- BaseView error responses return int that require normalization
- Custom error handlers should return int or properly formatted strings
Fixes:
- Handle empty string status codes correctly
- Preserve original invalid values in exception for debugging
- Ensure consistent status format across all response paths
- Fix Russian error messages to English
* Refactor response handling to omit status codes in view functions
- Updated view functions across documentation to return responses without explicit status codes for successful requests (200 OK).
- Added a new guide on HTTP Status Codes to explain usage and best practices.
- Adjusted examples in the routing, requests, and quickstart guides to reflect the new response format.
- Ensured consistency in documentation regarding response handling and status code usage.
* docs(server): enhance server documentation and add graceful shutdown - Add comprehensive "Running Your Application" guide covering DevServer and RunServer - Create dedicated API reference pages for both servers with detailed examples - Enhance RunServer with graceful shutdown (SIGINT/SIGTERM), stop() method, and configurable request_queue_size - Refactor DevServer API: _start() private, serve() public static method - Update all unit tests to match new server API (94.53% coverage, 280 tests passing) - Fix CLI command references in documentation (wiverno run dev/prod) BREAKING CHANGE: DevServer.start() is now private. Use DevServer.serve() instead. * fix: update documentation and tests for HTTP status code 413 * fix: remove obsolete HTTP status codes from tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
HTTP Status Code Validation
HTTPStatusValidatorclass inwiverno.core.http.validatorInvalidHTTPStatusErrorexceptionEnhanced Built-in Servers
stop()method for programmatic shutdownrequest_queue_sizeparameterserve()as main entry point📚 Documentation
🐛 Bug Fixes
DevServer.start()is now private - useDevServer.serve()instead📊 Testing