Restalchemy

Latest version: v12.10.1

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

Scan your dependencies

Page 1 of 3

12.10.1

None

12.9.0

**New Features & Enhancements**

1. **Dynamic Model Handling & OpenAPI Schema Generation**
- Introduced a new module `types_dynamic.py` to support dynamic typing and polymorphic model resolution via a `kind` property.
- **Key additions**:
- Abstract base classes (`AbstractKindModel`, `AbstractKindType`) for defining models with mandatory `kind`-based subtypes.
- Utilities (`KindModelType`, `KindModelSelectorType`) for bidirectional serialization/deserialization, including nested property resolution.
- OpenAPI schema integration with JSON Schema compliance, supporting UUIDs, datetimes, and complex objects.
- Strict validation via `validate` methods and custom exceptions (`UnknownType`).
- **Use cases**: APIs requiring polymorphic models, systems needing OpenAPI documentation, and scenarios with UUID/datetime serialization.

2. **Extended Network Types with `IPRange`**
- Added `IPRange` type to represent IPv4 ranges in the format `<start_ip>-<end_ip>` (e.g., `10.0.0.100-10.0.0.200`).
- Ensures validation of both start and end IP addresses during instantiation.

**Improvements**

1. **Enhanced Error Messaging for Nested Types**
- Improved `TypeError` messages to include nested type information (e.g., `AllowNone(IPRange)` instead of `AllowNone`).
- Provides clearer debugging context for invalid type assignments.

2. **SQL Interface Consistency**
- Aligned the `get_one_or_none` method’s interface with `get_one()` for consistency across SQL operations.

**Contributors**
A special thanks to **Eugene Frolov**, **Anton Kremenetsky**, and **George Melikov** for their contributions!

12.8.0

**New Features**
- **Added `TimeDelta` property type**: Introduces a new `TimeDelta` class to handle `datetime.timedelta` values with configurable `min_value` and `max_value` constraints. This type seamlessly converts timedelta values to/from float-based seconds for serialization and integrates with OpenAPI specifications. System-agnostic min/max boundaries are calculated using `ctypes` (now a dependency) to ensure compatibility across platforms.

**Enhancements**
- **Extended `DateTime` type initialization**: The `DateTime` type now accepts optional `min_value` and `max_value` parameters. Further implementation details for these constraints are planned for future updates.

**Fixes**
- **OpenAPI spec generation for numeric types**: Replaced `INFINITI` with system-specific float limits (e.g., `sys.float_info.max`) when generating `minimum`/`maximum` values in OpenAPI schemas. This ensures compliance with OpenAPI standards and avoids invalid specifications.

**Testing**
- **Comprehensive unit tests for `TimeDelta`**: Added rigorous tests to validate edge cases (min/max boundaries), error handling for invalid inputs, and consistency with the `TIMEDELTA_INFINITY` constant. Tests confirm correct serialization, deserialization, and platform-agnostic limit calculations.

This release improves flexibility for time-based configurations, strengthens validation, and ensures reliable OpenAPI documentation generation.

12.7.0

**Features & Improvements**
- **Model Field Enhancements**:
- The `name` field in `ModelWithNameDesc` is now **required** (removed default value, added `required=True`).
- The `description` field remains optional with an empty string default and includes improved property declaration formatting.

- **Improved Input Validation**:
- API endpoints now return a **400 HTTP status code** when requests contain unknown fields during payload unpacking, ensuring stricter input validation.

**Dependency Updates**
- **Testing Tooling**:
- Replaced `coverity` with `pytest-cov` for test coverage reporting. This provides clearer coverage statistics during test runs and avoids filesystem clutter (no more `.coverage*` files).

---
*Authors: Eugene Frolov, George Melikov*

12.6.0

None

12.5.1

This release introduces key improvements to application architecture, database operations, and validation logic, alongside critical bug fixes. Here are the highlights:

---

**New Features**
- **DBEngineMixin Enhancements**:
- Added support for **view operations** and **cascade table deletion**, expanding database management capabilities. (Thanks, Anton Kremenetsky)

---

**Bug Fixes**
- **FieldsPermissions Argument Order**:
- Fixed incorrect argument order in `is_readonly` and `is_hidden` methods, resolving issues with field permission checks. (Thanks, George Melikov)
- **UUID Validation**:
- Addressed case sensitivity in UUID regex patterns to ensure compatibility with uppercase UUIDs, aligning with RFC 4122 standards.

---

**Improvements**
- **RESTService Initialization Refactor**:
- Removed hardcoded defaults for `bind_host` and `bind_port`, replacing them with dynamic properties (`service_host` and `service_port`).
- Simplified server creation by directly passing `app_root` to the WSGI server.
- **WSGI Application Setup**:
- Centralized OpenAPI configuration and middleware logic into the new `build_wsgi_application` function, improving separation of concerns.
- **UUID Regex Formatting**:
- Updated regex syntax for clarity (e.g., `{8}` instead of `{8,8}`) while preserving UUID structure validation.

---

**Refactoring**
- **Entry Point and Test Updates**:
- Explicitly set `bind_host="0.0.0.0"` and `bind_port=8000` in the `main()` entry point.
- Adjusted test suites to utilize `build_wsgi_application` for consistency.

---

**Contributors**: Eugene Frolov, Anton Kremenetsky, George Melikov

Page 1 of 3

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.