Skip to content

Conversation

@silvanocerza
Copy link
Contributor

Similar approach to other libraries. I added IPinfoLiteMiddleware and IPinfoAsyncLiteMiddleware that the same functionality as the previous middlewares.

I had to bump the ipinfo library version in setup.py as that's the first release that ships the Lite API handlers.

I made some changes to tox config as it wasn't working. Tests have been reworked too to use fixtures to customize which middlewares are set in the Django test configs, this way we can test all the middlewares. Previously only the async one was tested as that was hardcoded in tests/settings.py.

@silvanocerza silvanocerza self-assigned this Jul 25, 2025
@linear
Copy link

linear bot commented Jul 25, 2025

Copy link

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 adds support for IPinfo's Lite API by introducing new middleware classes that use the Lite API handlers. The Lite API provides a lightweight alternative to the full IPinfo API.

  • Adds IPinfoLiteMiddleware and IPinfoAsyncLiteMiddleware classes that mirror existing middleware functionality
  • Updates the ipinfo library dependency to version 5.2.0+ to support Lite API handlers
  • Refactors test structure to use fixtures for middleware configuration, enabling comprehensive testing of all middleware variants

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
ipinfo_django/middleware.py Adds new Lite middleware classes and minor code formatting improvements
setup.py Bumps ipinfo library dependency to support Lite API handlers
tests/conftest.py Adds pytest fixtures for configuring different middleware types in tests
tests/settings.py Removes hardcoded middleware configuration to enable fixture-based testing
tests/test_middleware.py New test file for standard IPinfo middleware
tests/test_lite_middleware.py New test file for Lite middleware functionality
tests/test_async_middleware.py Updates existing async tests to use new fixture system
tests/test_async_lite_middleware.py New test file for async Lite middleware
tox.ini Fixes tox configuration and standardizes test execution

@silvanocerza
Copy link
Contributor Author

I mistakenly asked for a review by Copilot. 🤦‍♀️

Copy link

@max-ipinfo max-ipinfo left a comment

Choose a reason for hiding this comment

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

Do we need to update the Django and/or Python versions we use to test?

https://github.com/ipinfo/django/blob/master/.github/workflows/test.yml#L13

Copy link

@max-ipinfo max-ipinfo left a comment

Choose a reason for hiding this comment

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

LGTM

@silvanocerza
Copy link
Contributor Author

Do we need to update the Django and/or Python versions we use to test?

https://github.com/ipinfo/django/blob/master/.github/workflows/test.yml#L13

No need to that right now, the version is the same as the one set in tox.ini.
In the future though we should enhance this so that there's a single source of truth to ease testing locally and in CI.

@silvanocerza silvanocerza merged commit 657489d into master Jul 31, 2025
4 checks passed
@silvanocerza silvanocerza deleted the silvano/eng-298-add-lite-api-support-to-ipinfodjango branch August 1, 2025 13:33
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