Download Latest Version v2.6.3 source code.zip (2.2 MB)
Email in envelope

Get an email when there's a new version of BlackSheep

Home / v2.6.0
Name Modified Size InfoDownloads / Week
Parent folder
README.md 2026-02-15 2.7 kB
v2.6.0 source code.tar.gz 2026-02-15 2.1 MB
v2.6.0 source code.zip 2026-02-15 2.2 MB
Totals: 3 Items   4.2 MB 0
  • Add support for handling FromText, FromFiles in OpenAPI Documentation (#546).
  • Significantly improve support for multipart/form-data forms with memory-efficient streaming and file handling:
  • Add Request.multipart_stream() method for true streaming parsing of multipart data without buffering entire request body in memory, ideal for handling large file uploads and large text fields.
  • Refactor Request.form() and Request.multipart() to use SpooledTemporaryFile for memory-efficient file handling: small files (<1MB) are kept in memory, larger files automatically spill to temporary disk files.
  • Add Request.dispose() method to properly clean up SpooledTemporaryFile resources and prevent resource leaks when handling file uploads.
  • Add FileBuffer class wrapping SpooledTemporaryFile to provide a clean API for uploaded files with read(), seek(), close(), and save_to() methods.
  • Add FormPart.stream() async generator method to stream part data in chunks.
  • Add save_to() method to FormPart, FileBuffer, and StreamedFormPart for saving uploaded data to disk with automatic security validation via ensure_in_cwd() to prevent directory traversal attacks.
  • Add FormPart.field() class method as a convenience for creating form parts from string values without manual encoding (accepts name, value, optional content_type and charset).
  • Add FormPart.from_file() class method as a convenience for creating file upload parts that automatically opens files, detects MIME types from file extensions, and handles both file paths and pre-opened file handles.
  • FormPart instances provide better memory management and a cleaner API.
  • The framework automatically calls Request.dispose() at the end of each request-response cycle to clean up file resources.
  • Fix #501; accept to overwrite default headers when using TestClient, contributed by @ticapix.
  • Modify the MultiPartFormData to inherit StreamedContent and remove the immediate call to write_multipart_form_data() which loaded everything into memory.

[!NOTE] Support for efficient handling of multipart/form-data was previously neglected as BlackSheep focused primarily on JSON-based Web APIs, Web Apps serving HTML and static files, and raw request body streaming for large uploads. This release improves support for this format, adding support for memory-efficient handling of multipart/form-data, both when parsing on the server-side and when writing payloads for the BlackSheep HTTP Client, through the MultiPartFormData content class.

Source: README.md, updated 2026-02-15