-
-
Notifications
You must be signed in to change notification settings - Fork 89
[deps] Switched to django-minify-compress-staticfiles #565 #579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
[deps] Switched to django-minify-compress-staticfiles #565 #579
Conversation
Replaced django-compress-staticfiles with the new django-minify-compress-staticfiles package for static file minification and compression. The new package provides: - CSS/JS minification using rjsmin and rcssmin - Both Gzip and Brotli compression support - Better security with path traversal protection - Configurable compression levels and file size limits Updated imports in storage.py and documentation references accordingly. Fixes openwisp#565
WalkthroughThe PR replaces the staticfiles compressor dependency from django-compress-staticfiles to django-minify-compress-staticfiles (updates in setup, imports, docs, and storage class reference), exposes excluded_patterns as a computed Sequence Diagram(s)sequenceDiagram
participant Releaser as Releaser.run_git_cliff
participant Git as Git CLI
participant GitCliff as git-cliff
participant Stderr as stderr
Releaser->>Git: git pull --tags
alt pull succeeds
Git-->>Releaser: exit 0
else pull fails
Git-->>Releaser: non-zero exit
Releaser->>Stderr: print warning
end
Releaser->>GitCliff: git-cliff --unreleased ...
GitCliff-->>Releaser: changelog output / exit
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
✏️ Tip: You can disable this entire section by setting Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR primarily replaces django-compress-staticfiles with django-minify-compress-staticfiles for staticfile minification/compression, updating the storage backend integration and documentation, while also introducing unrelated changes to the releaser changelog flow and selenium test runner behavior.
Changes:
- Switched dependency to
django-minify-compress-staticfilesand updatedCompressStaticFilesStoragebase class accordingly. - Updated test project settings to use Django’s
STORAGESsetting for staticfiles storage. - Modified releaser
run_git_cliffto rungit pull --tagsfirst and added/adjusted tests around this behavior.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
tests/openwisp2/settings.py |
Configures STATIC_ROOT and STORAGES to use CompressStaticFilesStorage in tests. |
setup.py |
Replaces django-compress-staticfiles with django-minify-compress-staticfiles. |
openwisp_utils/tests/selenium.py |
Adjusts retry logic to propagate skips instead of treating them as successes. |
openwisp_utils/storage.py |
Switches storage backend base class import to MinicompressStorage. |
openwisp_utils/releaser/tests/test_changelog.py |
Updates and expands tests to account for the new git pull --tags call. |
openwisp_utils/releaser/tests/conftest.py |
Mocks OPENAI_CHATGPT_TOKEN via os.environ.get to skip AI summary by default. |
openwisp_utils/releaser/changelog.py |
Adds a pre-step to pull tags before running git cliff. |
docs/developer/other-utilities.rst |
Updates documentation reference to the new staticfiles package and base class. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| capture_output=True, | ||
| text=True, | ||
| check=True, | ||
| ) |
Copilot
AI
Feb 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
run_git_cliff now runs subprocess.run(["git", "pull", "--tags"], ...) outside the try/except FileNotFoundError block. If git is missing, this will raise FileNotFoundError and bypass the existing user-friendly error handling (and likely produce a stack trace). Wrap this call in the same FileNotFoundError handling or move it inside the main try/except so missing git is reported consistently.
| ) | |
| ) | |
| except FileNotFoundError: | |
| print("Error: 'git' or 'git-cliff' command not found.", file=sys.stderr) | |
| sys.exit(1) |
| subprocess.run( | ||
| ["git", "pull", "--tags"], | ||
| capture_output=True, | ||
| text=True, | ||
| check=True, | ||
| ) |
Copilot
AI
Feb 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using git pull --tags in a release utility can unexpectedly merge remote branch changes into the local checkout (and can fail if the working tree isn’t clean). If the goal is only to update tags for changelog generation, prefer git fetch --tags (optionally with --force) to avoid altering branch state.
| # First call (git pull --tags) succeeds, second call (git cliff) raises FileNotFoundError | ||
| mock_run.side_effect = [ | ||
| subprocess.CompletedProcess(args=[], returncode=0, stdout="", stderr=""), | ||
| FileNotFoundError, |
Copilot
AI
Feb 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mock_run.side_effect uses FileNotFoundError (the class) as the second element. With unittest.mock, iterable side_effect items are only raised when they are exception instances; the class will be returned as a value, leading to an unexpected AttributeError instead of the intended SystemExit. Use FileNotFoundError() (or FileNotFoundError("...")) for the second call.
| FileNotFoundError, | |
| FileNotFoundError(), |
| # Pull latest tags before calculating changelog | ||
| try: | ||
| subprocess.run( | ||
| ["git", "pull", "--tags"], | ||
| capture_output=True, | ||
| text=True, | ||
| check=True, | ||
| ) | ||
| except subprocess.CalledProcessError as e: | ||
| print(f"Warning: Failed to pull tags: {e.stderr}", file=sys.stderr) | ||
| # Run git-cliff to calculate changelog |
Copilot
AI
Feb 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR description focuses on switching the staticfiles minification/compression dependency, but this PR also changes the release/changelog workflow (adding a git pull --tags call) and modifies selenium test retry/skip behavior. Please update the PR description to cover these additional changes, or split them into separate PRs to keep scope aligned with #565.
Replaced django-compress-staticfiles with the new django-minify-compress-staticfiles package for static file minification and compression. The new package provides: - CSS/JS minification using rjsmin and rcssmin - Both Gzip and Brotli compression support - Better security with path traversal protection - Configurable compression levels and file size limits Updated imports in storage.py and documentation references accordingly. Fixes openwisp#565
Replaced django-compress-staticfiles with the new django-minify-compress-staticfiles package for static file minification and compression. The new package provides: - CSS/JS minification using rjsmin and rcssmin - Both Gzip and Brotli compression support - Better security with path traversal protection - Configurable compression levels and file size limits Updated imports in storage.py and documentation references accordingly. Fixes openwisp#565
Replaced django-compress-staticfiles with the new django-minify-compress-staticfiles package for static file minification and compression. The new package provides: - CSS/JS minification using rjsmin and rcssmin - Both Gzip and Brotli compression support - Better security with path traversal protection - Configurable compression levels and file size limits Updated imports in storage.py and documentation references accordingly. Fixes openwisp#565
|
@nemesifier kindly review |
nemesifier
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the PR contains commits from other PRs, please cleanup, I suggest to start again from master and cherry-pick.
Checklist
Reference to Existing Issue
Closes #565 .
Description of Changes
Please describe these changes.
Replaced django-compress-staticfiles with the new
django-minify-compress-staticfiles package for static
file minification and compression.
The new package provides:
Updated imports in storage.py and documentation
references accordingly.
Fixes #565