From 05659166828e0c09ff2111eff41ac488f93ee39b Mon Sep 17 00:00:00 2001 From: waynezwf Date: Tue, 2 Jun 2026 08:03:32 +0000 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=E3=80=8C/=E3=80=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 56 +++++++++++++++++++++++++++++++++++++++++++++++++ CONTRIBUTING.md | 41 ++++++++++++++++++++++++++++++++++++ environment.yml | 50 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 147 insertions(+) create mode 100644 CHANGELOG.md create mode 100644 CONTRIBUTING.md create mode 100644 environment.yml diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..9cc86f0 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,56 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [2.0.1] - 2025-04-08 + +### Fixed +- `JsonDumpsEncoder` now handles `NaTType` (pandas NaT) without throwing TypeError +- CORS `Access-Control-Allow-Origin` now defaults to `"*"` instead of echoing the request Origin header (security fix) +- `RbacUser.can()` correctly handles empty permission list +- Fixed race condition in `aio_pool.py` when task queue is full under high concurrency + +### Changed +- Refactored `config.py` — `get_config()` now consistently returns `None` instead of raising on missing optional keys (use `default` parameter for fallback) +- Upgraded minimum Python version from 3.9 to 3.11 +- `pyproject.toml` dependencies cleaned up — core dependencies slimmed down; pandas/numpy/matplotlib/opencv moved to `[project.optional-dependencies]` + +### Removed +- Deprecated `web/legacy_session.py` — use JWT-based `@auth_token` decorator instead + +## [2.0.0] - 2025-03-15 + +### Added +- **Swagger UI auto-generation** (`ApplicationSwagger`) — fully inferred from handler route patterns and decorators +- **Redis StreamActor** — consumer-group-based message processing with automatic zombie task recovery +- **ParamAwareUIModule** — async data pre-loading for Tornado UIModules +- **RBAC with dynamic rules** — rules are serialized Python classes stored in DB, supporting time-based, IP-based, and custom rule chains +- **Snowflake ID generator** (`snow_id.py`) — thread-safe, no external dependency, 10K+ IDs/sec +- **Auto-loading handlers** — `Application.load_handlers()` discovers all handlers in a package via `route_pattern` attribute +- **BaseX encoder/decoder** (`encoder.py`) — auto-detect Base16/32/64/85 + zlib decompression +- **Async DB engine** — SQLAlchemy async session factory with `aiomysql` / `aiosqlite` support +- **Task service with daemonization** — `TaskService` with PID file, start/stop/status commands, and graceful shutdown +- **5 complete examples** under `examples/` — HelloWorld, background tasks, Redis streams, scheduled services, model generation +- **pytest test suite** — unit tests (mocked) + integration tests for DB, Redis, RBAC + +### Changed +- Complete project restructuring: introduced `web/`, `core/`, `db/`, `rbac/`, `util/`, `service/` package layout +- `Application` now inherits from `tornado.web.Application` — backward-incompatible refactor from v1.x +- `RequestHandler.response_ok()` and `response_error()` now use `JsonDumpsEncoder` by default +- Logging system rewritten — supports rotating file handlers, per-module loggers, console output + +### Removed +- All v1.x code — this is a ground-up rewrite + +## [1.0.0] - 2024-01-01 + +### Added +- Initial release with basic Tornado wrapper +- Basic JWT auth and password hashing +- Simple `config.json` loader +- Minimal utility functions + +> ⚠️ **Note:** v1.0.0 is deprecated and no longer maintained. Please upgrade to v2.0.0+. \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..0ba0c22 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,41 @@ +# Contribution Guidelines + +Thank you for considering contributing to this project! Your involvement helps make this project better for everyone. + +## How to Contribute + +1. **Fork the repository** +2. **Create a new feature branch** + ```bash + git checkout -b feature/your-feature-name + ``` +3. **Make your changes** + Write clean, well-documented code. Follow the project’s coding standards. +4. **Add tests** + All new features or bug fixes must include appropriate unit or integration tests. +5. **Commit your changes** + Use descriptive commit messages following [Conventional Commits](https://www.conventionalcommits.org/). +6. **Push to your fork** + ```bash + git push origin feature/your-feature-name + ``` +7. **Open a Pull Request** + Clearly describe what you changed, why, and how it affects the project. + +## Code Style & Standards + +- Follow the project’s linter rules (e.g., PEP8 for Python, ESLint for JavaScript) +- Keep functions small and focused +- Document public APIs with docstrings or comments +- Never commit secrets or environment files + +## Reporting Issues + +If you find a bug or have a feature request, please open an [Issue](https://github.com/your-repo/issues) with: +- A clear title +- Steps to reproduce (for bugs) +- Expected vs actual behavior + +## License + +By contributing, you agree that your contributions will be licensed under the MIT License. \ No newline at end of file diff --git a/environment.yml b/environment.yml new file mode 100644 index 0000000..bdcca9c --- /dev/null +++ b/environment.yml @@ -0,0 +1,50 @@ +# environment.yml +name: paste-env +channels: + - conda-forge + - defaults + +dependencies: + - python=3.11 + - aiohttp>=3.13.0 + - aiomysql>=0.2.0 + - aioquic>=1.2.0 + - aiosqlite>0.21.0 + - aiofiles>=23.0.0 + - cryptography==46.0.3 + - matplotlib>=3.10.1 + - matplotlib-inline>=0.1.7 + - numpy>=1.24.0 + - openpyxl>=3.1.5 + - pandas>=2.0.0 + - pillow>=10.0.0 + - psutil>=5.9.0 + - PyJWT>=1.7.1 + - PyMySQL>=1.1.0 + - pyOpenSSL>=24.3.0 + - pytest>=8.0.0 + - pytest-asyncio>=0.23.0 + - pytest-cov>=4.0.0 + - PyYAML>=6.0.2 + - requests>=2.32.5 + - selenium>=4.38.0 + - scipy>=1.14.0 + - sqlalchemy==2.0.49 + - svgwrite>=1.4.2 + - tabulate>=0.9.0 + - tinycss2>=1.4.0 + - tinyhtml5>=2.0.0 + - tornado>=6.4 + - weasyprint>=64.1 + - WTForms>=3.2.1 + - pip + - pip: + - javaobj-py3>=0.4.4 + - jieba>=0.42.1 + - jpush>=3.3.9 + - redis>=5.2.1 + - opencv-python>=4.11.0.86 + - pypinyin>=0.55.0 + - seaborn>=0.13.2 + - tornado-swagger>=1.4.5 + - tornado-wtforms>=0.0.1 \ No newline at end of file