Skip to content

Conversation

@semohr
Copy link
Contributor

@semohr semohr commented Jan 7, 2026

This PR introduces a deprecation system to clean up the public API and prepares for the v1.0.0 release.

Note: While not entirely necessary, I moved the MediaFile class into its own file. This cleans the __init__.py file to be responsible for import/export only. This simplified the deprecation process significantly and makes very clear what is exposed by mediafile going forward.

Changes:

  • Added deprecation system with version-aware warnings for imports
  • Simplified __init__.py to expose only core API (MediaFile, Image, exceptions) in its __all__
  • Moved MediaFile class to dedicated file for better organization
  • Adjusted tests to use the new structs to omit warnings

Migration:
Existing imports still work but raise a warnings:

import warnings
warnings.simplefilter("always")
from mediafile import StorageStyle
>>> DeprecationWarning: 'mediafile.StorageStyle' is deprecated and will be removed in version '1.0.0'. Use 'mediafile.storage.StorageStyle' instead.

@semohr semohr changed the title Defining public api and deprecation of previous exports from monolith Deprecation of previous exports from monolith Jan 7, 2026
@codecov-commenter
Copy link

codecov-commenter commented Jan 7, 2026

Codecov Report

❌ Patch coverage is 87.60000% with 31 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.94%. Comparing base (7b53be9) to head (ea3101a).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
mediafile/mediafile.py 89.83% 15 Missing and 9 partials ⚠️
mediafile/deprecation.py 50.00% 6 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #98      +/-   ##
==========================================
- Coverage   93.26%   91.94%   -1.33%     
==========================================
  Files          16       18       +2     
  Lines         817     1067     +250     
  Branches      118      156      +38     
==========================================
+ Hits          762      981     +219     
- Misses         35       56      +21     
- Partials       20       30      +10     
Files with missing lines Coverage Δ
mediafile/deprecation.py 50.00% <50.00%> (ø)
mediafile/mediafile.py 89.83% <89.83%> (ø)

@semohr semohr marked this pull request as ready for review January 7, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants