Skip to content

fix: Remove deprecated coreapi dependency#178

Open
vgulati-apphelix wants to merge 2 commits intomasterfrom
vgulati/BOMS-480
Open

fix: Remove deprecated coreapi dependency#178
vgulati-apphelix wants to merge 2 commits intomasterfrom
vgulati/BOMS-480

Conversation

@vgulati-apphelix
Copy link
Copy Markdown
Member

@vgulati-apphelix vgulati-apphelix commented Apr 17, 2026

Description

Alert - Failure: Devstack provisioning tests for analyticsapi+insights+lms #22222673915

https://github.com/edx/devstack/actions/runs/22222673915

The error was caused by coreapi package not being able to import pkg_resources. This happens because:

  • Newer versions of setuptools (v68.0.0+) no longer include pkg_resources
  • The coreapi package (which is deprecated) still depends on it

Since coreapi itself it deprecated and there is direct replacement OpenAPI available. This PR take care of replacing

Ticket

BOMS-480

Remove coreapi deprecated dependency

This PR removes the deprecated coreapi library and migrates to Django REST Framework's built-in OpenAPI schema generation.

Changes

  1. Removed dependencies: Removed coreapi from base.in (also removes transitive dependency coreschema)
  2. Updated schema configuration: Changed DEFAULT_SCHEMA_CLASS in analyticsdataserver/settings/base.py from rest_framework.schemas.coreapi.AutoSchema to rest_framework.schemas.openapi.AutoSchema
  3. Regenerated requirements: Ran make upgrade with Python 3.11 to update all locked requirements files

Testing

Provision ran successfully

Test failure

command - make test
This was yielding 3 failures

====================== short test summary info =======================
FAILED analytics_data_api/management/commands/tests/test_generate_fake_course_data.py::GenerateFakeCourseDataTests::testNormalRun - TypeError: 'float' object cannot be interpreted as an integer
FAILED analytics_data_api/management/commands/tests/test_generate_stage_course_data.py::GenerateStageCourseDataTests::test_run_with_no_preexisting_data - TypeError: 'float' object cannot be interpreted as an integer
FAILED analytics_data_api/management/commands/tests/test_generate_stage_course_data.py::GenerateStageCourseDataTests::test_run_with_preexisting_data - TypeError: 'float' object cannot be interpreted as an integer
============ 3 failed, 275 passed, 299 warnings in 52.71s ============

Below change in generate_data.py fixes the failures
count = random.randint(0, max_value // 20) instead of count = random.randint(0, max_value / 20)

Copilot AI review requested due to automatic review settings April 17, 2026 15:57
Copy link
Copy Markdown

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

This PR removes the deprecated coreapi dependency and switches the service to Django REST Framework’s built-in OpenAPI schema generation, while also regenerating pinned dependency lockfiles as part of the upgrade process.

Changes:

  • Dropped coreapi (and transitive coreschema) from the dependency set.
  • Updated DRF schema configuration to use rest_framework.schemas.openapi.AutoSchema.
  • Regenerated pinned requirements across environments (base/dev/test/doc/production/tox/pip tooling).

Reviewed changes

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

Show a summary per file
File Description
requirements/base.in Removes the direct coreapi dependency from the base input requirements.
analyticsdataserver/settings/base.py Switches DRF DEFAULT_SCHEMA_CLASS from CoreAPI-based schema to OpenAPI-based schema.
requirements/base.txt Updates locked runtime dependency versions and removes coreapi/coreschema from the compiled set.
requirements/dev.txt Updates locked dev dependency versions and removes coreapi/coreschema from the compiled set.
requirements/test.txt Updates locked test dependency versions and removes coreapi/coreschema (and related transitive pins).
requirements/production.txt Updates locked production dependency versions and removes coreapi/coreschema (and related transitive pins).
requirements/doc.txt Updates locked documentation build dependency versions and removes coreapi/coreschema from the compiled set.
requirements/django.txt Bumps the pinned Django patch version in the dedicated Django pin file.
requirements/tox.txt Updates tox/virtualenv toolchain pins used for CI/test orchestration.
requirements/pip_tools.txt Updates pins for pip-tools-related build tooling.
requirements/pip.txt Updates pins for pip/wheel/setuptools-related tooling.

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

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 17, 2026

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  analytics_data_api/management/commands
  generate_data.py
Project Total  

This report was generated by python-coverage-comment-action

Copy link
Copy Markdown

@santhosh-apphelix-2u santhosh-apphelix-2u left a comment

Choose a reason for hiding this comment

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

Looks good to me.

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.

4 participants