Skip to content

Python and Django upgrade#3352

Open
IshaanXCoder wants to merge 13 commits intointelowlproject:developfrom
IshaanXCoder:fix/python-and-django-upgrade
Open

Python and Django upgrade#3352
IshaanXCoder wants to merge 13 commits intointelowlproject:developfrom
IshaanXCoder:fix/python-and-django-upgrade

Conversation

@IshaanXCoder
Copy link
Copy Markdown
Contributor

Description

This is a clean version of #3320
This PR resolved #3306 where we're upgrading python version from 3.11 to 3.13
I have updated the necessary configuration files, CI workflows, Docker files, typing errors and test files for compatibility

  • Minor changes were made due to some depreceated functions like assertDictContainsSubset()
  • pydeep has been replaced with ppdeep
  • removal of PosixPath
  • in api_app/analyzers_manager/observable_analyzers/maxmind.py , i noticed the test was failing with cls._api_key_name, changed it to auth_token
  • Typing errors were fixed(difference between modern andold python typing styles)

Type of change

  • New feature (non-breaking change which adds functionality).

Checklist

  • I have read and understood the rules about how to Contribute to this project
  • The pull request is for the branch develop
  • Please avoid adding new libraries as requirements whenever it is possible. Use new libraries only if strictly needed to solve the issue you are working for. In case of doubt, ask a maintainer permission to use a specific library.
  • Linters (Ruff) gave 0 errors. If you have correctly installed pre-commit, it does these checks and adjustments on your behalf.
  • After you had submitted the PR, if DeepSource, Django Doctors or other third-party linters have triggered any alerts during the CI checks, I have solved those alerts.

Copilot AI review requested due to automatic review settings February 21, 2026 12:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Upgrades the project runtime/tooling to Python 3.13 (and Django 5.2+) and updates dependencies, Docker/CI configs, and tests/code to remain compatible with the newer versions and removed/deprecated APIs.

Changes:

  • Bump Python/Django and multiple dependency versions (incl. pydeep → ppdeep), plus CI + Docker base images for 3.13.
  • Update application code typing and small behavior adjustments for compatibility (e.g., storage retrieval fallback, Maxmind config lookup).
  • Refactor/patch tests to avoid deprecated assertions and to better isolate network/external dependencies.

Reviewed changes

Copilot reviewed 32 out of 32 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
tests/test_crons.py Makes cron/task tests more isolated via settings overrides and updated mocking.
tests/auth/test_oauth.py Adjusts OAuth test setup to register Google provider when missing.
tests/api_app/test_views.py Replaces deprecated assertDictContainsSubset usage and adds linter suppression.
tests/api_app/test_classes.py Ensures required plugin params are configured in test setup; adjusts failure expectations.
tests/api_app/test_api.py Updates assertions for error payload checks.
tests/api_app/ingestors_manager/test_classes.py Adds required config setup and handles network-related exceptions during ingestor subclass tests.
tests/api_app/connectors_manager/test_views.py Mocks HTTP health-check calls to make tests deterministic.
tests/api_app/connectors_manager/test_classes.py Improves health-check mocking and ensures required params are configured in subclass iteration tests.
tests/api_app/analyzers_manager/unit_tests/observable_analyzers/test_greynoise_labs.py Fixes report mocking to match analyzer expectations.
tests/api_app/analyzers_manager/unit_tests/file_analyzers/test_file_info.py Updates FileInfo unit test mocks after fuzzy-hash library swap.
tests/api_app/analyzers_manager/unit_tests/file_analyzers/test_blint_scan.py Fixes patch target to match analyzer import location.
tests/api_app/analyzers_manager/unit_tests/file_analyzers/base_test_class.py Adds/aligns mimetype→sample mapping for additional filetypes.
tests/api_app/analyzers_manager/test_signals.py Overrides settings to stabilize signal tests under new defaults.
requirements/project-requirements.txt Updates core dependency pins (Django/Celery/etc.) and swaps pydeep → ppdeep.
pyproject.toml Updates Ruff target version to Python 3.13.
integrations/tor_analyzers/Dockerfile Updates integration base image to Python 3.13.
integrations/malware_tools_analyzers/Dockerfile Updates integration base image to Python 3.13.
docker/test.override.yml Minor formatting cleanup in test compose override.
docker/Dockerfile Updates backend build stage Python version to 3.13.
async_tests/test_websocket.py Updates Django test lifecycle hook signature for newer Django behavior.
api_app/serializers/job.py Typing/lint adjustments and small method annotation changes.
api_app/interfaces.py Updates typing for job creation generator.
api_app/engines_manager/models.py Updates typing for generated Celery signatures.
api_app/classes.py Adjusts plugin failure handling behavior (no CI re-raise).
api_app/choices.py Removes PosixPath usage for base paths; updates typing annotation.
api_app/analyzers_manager/observable_analyzers/maxmind.py Fixes Maxmind parameter lookup name and modernizes typing.
api_app/analyzers_manager/file_analyzers/phishing/phishing_form_compiler.py Modernizes typing for redirect handling.
api_app/analyzers_manager/file_analyzers/file_info.py Switches fuzzy hashing from pydeep to ppdeep; Path typing cleanup.
api_app/analyzers_manager/classes.py Makes filepath retrieval compatible with storages lacking retrieve().
.github/workflows/pull_request_automation.yml Updates workflow Python version to 3.13.
.github/workflows/dependency_review.yml Adds dependency-review license allowlist entry for ppdeep.
.github/workflows/codeql-analysis.yml Updates workflow Python version to 3.13.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread integrations/malware_tools_analyzers/Dockerfile Outdated
Comment thread api_app/engines_manager/models.py Outdated
Comment thread api_app/serializers/job.py Outdated
Comment thread tests/api_app/ingestors_manager/test_classes.py Outdated
Comment thread api_app/choices.py Outdated
Comment thread api_app/classes.py
Comment thread tests/auth/test_oauth.py
Comment thread integrations/tor_analyzers/Dockerfile Outdated
@IshaanXCoder IshaanXCoder mentioned this pull request Feb 21, 2026
8 tasks
@IshaanXCoder
Copy link
Copy Markdown
Contributor Author

@mlodic PTAL whenever free :)

@mlodic
Copy link
Copy Markdown
Member

mlodic commented Feb 22, 2026

A note: this PR, when merged, would put the develop branch in a state that would require a new major version when releasing. Because of this, merging this could take a while and/or this could be first merge in a separate branch as a buffer and then merged in develop once we are ready to make the major.

I'll review this more closely when I'll have more time, this is critical and needs a proper check

@IshaanXCoder
Copy link
Copy Markdown
Contributor Author

IshaanXCoder commented Feb 22, 2026

Alright it makes sense to me :))
made the final changes as of now, LGTM.

  • reverted changes in dockerfiles
  • replaced Generator [x,none,none] with Iterator as ruff prefers it

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 5, 2026

This pull request has been marked as stale because it has had no activity for 10 days. If you are still working on this, please provide some updates or it will be closed in 5 days.

@github-actions github-actions Bot added the stale label Mar 5, 2026
@IshaanXCoder
Copy link
Copy Markdown
Contributor Author

This is under review, not to be closed as of now

@github-actions github-actions Bot removed the stale label Mar 6, 2026
@mlodic mlodic added the keep-open To avoid workflow closing PRs label Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

keep-open To avoid workflow closing PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants