Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@TheoCouss
Copy link

@TheoCouss TheoCouss commented Oct 31, 2025

Drop pylibmc and python-memcache and replace with pymemcache

  • Use pymemcache exclusively for cache backend
  • Add HashClient support for multiple servers
  • Add RetryingClient with configurable retry options
  • Maintain backward compatibility with pylibmc URLs
  • Update requirements: pymemcache>=3.4.0
  • Rewrite tests for pymemcache-only implementation

@Nusnus Nusnus requested a review from Copilot October 31, 2025 22:57
Copy link
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

This PR migrates the Celery cache backend from pylibmc/python-memcached to pymemcache as the exclusive memcached client library, simplifying dependencies while maintaining backward compatibility.

Key changes:

  • Replaces import_best_memcache()/get_best_memcache() with get_memcache_client() that exclusively uses pymemcache
  • Implements HashClient for multiple servers and RetryingClient for configurable retry logic
  • Maintains backward compatibility by accepting pylibmc-style URLs and ignoring the behaviors parameter

Reviewed Changes

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

File Description
celery/backends/cache.py Replaces multi-library detection logic with pymemcache-only implementation; adds ClientFactory with retry support
t/unit/backends/test_cache.py Rewrites tests to use pymemcache mocks instead of pylibmc/python-memcached; adds new tests for retry and multi-server scenarios
requirements/extras/pymemcache.txt Updates dependency from python-memcached to pymemcache>=3.4.0

@codecov
Copy link

codecov bot commented Oct 31, 2025

Codecov Report

❌ Patch coverage is 86.66667% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.68%. Comparing base (5fd0b3e) to head (5887b9b).

Files with missing lines Patch % Lines
celery/backends/cache.py 86.66% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9977      +/-   ##
==========================================
- Coverage   78.68%   78.68%   -0.01%     
==========================================
  Files         153      153              
  Lines       19313    19326      +13     
  Branches     2214     2219       +5     
==========================================
+ Hits        15196    15206      +10     
- Misses       3817     3819       +2     
- Partials      300      301       +1     
Flag Coverage Δ
unittests 78.66% <86.66%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@auvipy auvipy self-requested a review November 1, 2025 04:55
@auvipy auvipy added this to the 5.7.0 milestone Nov 1, 2025
Théophile Coussière and others added 2 commits November 2, 2025 14:22
Drop pylibmc and python-memcache and replace with pymemcache

 - Use pymemcache exclusively for cache backend
 - Add HashClient support for multiple servers
 - Add RetryingClient with configurable retry options
 - Maintain backward compatibility with pylibmc URLs
 - Update requirements: pymemcache>=3.4.0
 - Rewrite tests for pymemcache-only implementation
@Nusnus
Copy link
Member

Nusnus commented Nov 2, 2025

Related:

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