Skip to content

Conversation

@rlskoeser
Copy link
Member

@rlskoeser rlskoeser commented Jan 16, 2026

Resolves #152

Changes in this PR:

  • adds optional dependency group to pyproject.toml with django>5.2
  • create initial / empty undate.django module
  • update unit test build matrix to test without django and against django 5.2
  • add test utility with pytest skip decorators for tests that require django is/is not installed (adapted from my https://github.com/Princeton-CDH/parasolr project)
  • placeholder tests to confirm matrix build and decorators are working as expected

To check locally, if desired:

  • running pytest with django installed should pass with one skipped test
  • running pytest with django not installed should also pass with one skipped test

Questions & notes:

  • Should I add some notes about optional django integration to the developer notes document?
  • I put the test_utils in the main package because the tests directory isn't currently setup as a python module, but it's seems a little awkward there (mypy check is failing, and it requires pytest, which is a dev/test requirement). Thoughts?
  • parasolr also has a convenience @requires_django decorator, would that be useful to add? https://github.com/Princeton-CDH/parasolr/blob/main/parasolr/django/util.py
  • I will need to update the GitHub required checks for the revised build matrix once we are happy with the new build
  • I will need to update codecov configuration - once we start adding optional tests, we no longer expect tests to have 100% coverage.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added optional Django support to the package.
  • Documentation

    • Added Django installation instructions to the README.
  • Chores

    • Updated CI/CD workflow to test compatibility with and without Django.
    • Added Django as an optional dependency.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 16, 2026

Walkthrough

The changes introduce optional Django 5.2 support to the project. The workflow is updated to test with and without Django, optional dependency and classifiers are added to project metadata, documentation is updated with Django installation instructions, and new test utilities with conditional skip markers are introduced.

Changes

Cohort / File(s) Summary
GitHub Actions CI Configuration
.github/workflows/unit_tests.yml
Adds django matrix variable (0 and "5.2") to enable testing with and without Django; replaces single install step with conditional installation of Django and pytest-django only when matrix.django > 0; always installs package with test extras.
Project Metadata
pyproject.toml
Adds Django framework classifiers ("Framework :: Django", "Framework :: Django :: 5.2") and new optional dependency django = ["django>=5.2"].
Documentation
README.md
Adds "Optional Django Support (PRELIMINARY / IN PROGRESS)" section with installation instructions for Django support.
Test Utilities & Tests
src/undate/test_utils.py, tests/test_django/test_django_setup.py
New test utility module exports two pytest skip markers (skipif_no_django, skipif_django) for conditional test execution; new test module with two guarded test functions (test_django, test_no_django) that verify Django availability based on installation state.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A Django dream takes flight,
Optional as starlight,
Tests skip, dance, and play,
With and without, hip hooray!
Framework support, now in sight! 🌟

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: establishing optional Django support and configuring tests to run with and without Django.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@rlskoeser rlskoeser force-pushed the feature/optional-django branch from 48eb807 to e42bdf8 Compare January 16, 2026 16:57
@codecov
Copy link

codecov bot commented Jan 16, 2026

Codecov Report

❌ Patch coverage is 95.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 98.92%. Comparing base (0691b12) to head (729e6d8).
⚠️ Report is 6 commits behind head on develop.

Files with missing lines Patch % Lines
tests/test_django/test_django_setup.py 90.90% 1 Missing ⚠️

❌ Your project check has failed because the head coverage (99.91%) is below the target coverage (100.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #159      +/-   ##
===========================================
- Coverage    98.96%   98.92%   -0.04%     
===========================================
  Files           40       42       +2     
  Lines         2121     2141      +20     
===========================================
+ Hits          2099     2118      +19     
- Misses          22       23       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/unit_tests.yml (1)

28-50: Fix Django install guard (bash test is invalid for "5.2").
The condition uses integer -gt against a non-integer version and is missing a space before ], so the step will fail on the Django build.

✅ Proposed fix
-          if [ "${{ matrix.django }}" -gt "0"]; then pip install -q Django==${{ matrix.django }} pytest-django; fi
+          if [ "${{ matrix.django }}" != "0" ]; then
+            pip install -q "Django==${{ matrix.django }}" pytest-django
+          fi
🤖 Fix all issues with AI agents
In `@src/undate/test_utils.py`:
- Around line 1-26: Add inline mypy ignores to the imports so static checking
won't fail: add "# type: ignore[import]" to the pytest import and to the django
import inside the try/except (or use "# type: ignore[import]" on the django
import line and keep the runtime fallback django = None), then leave the
existing skipif_no_django and skipif_django definitions using
pytest.mark.skipif(django is None, ...) and pytest.mark.skipif(django, ...).
This targets the import statements for pytest and django in test_utils.py to
silence "Library stubs not found" / "Unresolved import" mypy errors.
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d8df254 and e42bdf8.

📒 Files selected for processing (6)
  • .github/workflows/unit_tests.yml
  • README.md
  • pyproject.toml
  • src/undate/django/__init__.py
  • src/undate/test_utils.py
  • tests/test_django/test_django_setup.py
🧰 Additional context used
🪛 GitHub Actions: Check style + docs + types
src/undate/test_utils.py

[error] 17-17: Cannot find implementation or library stub for module named "pytest" [import-not-found]


[error] 20-20: Cannot find implementation or library stub for module named "django" [import-not-found]

🔇 Additional comments (3)
pyproject.toml (1)

43-44: LGTM — Django metadata/extras look consistent.

Also applies to: 58-58

README.md (1)

46-51: LGTM — optional Django install note is clear.

tests/test_django/test_django_setup.py (1)

1-16: LGTM — conditional tests match the skip markers.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@rlskoeser rlskoeser marked this pull request as draft January 16, 2026 17:26
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