Fix track_memory_usage on poetry-core 1.3.x installations (#14221)

* Fix `track_memory_usage` on poetry-core 1.3.x installations

The same kind of problem as discussed in #14085:

1. we defined an extra with an underscore
2. we look it up at runtime with an underscore
3. but poetry-core 1.3.x. installs it with a dash, causing (2) to fail.

Fix by using a dash everywhere.

* Changelog
This commit is contained in:
David Robertson 2022-10-18 13:59:04 +01:00 committed by GitHub
parent a8677bc9b8
commit 8e50299d8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 3 deletions

1
changelog.d/14221.misc Normal file
View File

@ -0,0 +1 @@
Rename the `cache_memory` extra to `cache-memory`, for compatability with poetry-core 1.3.0 and [PEP 685](https://peps.python.org/pep-0685/). From-source installations using this extra will need to install using the new name.

View File

@ -227,7 +227,7 @@ jwt = ["authlib"]
# (if it is not installed, we fall back to slow code.) # (if it is not installed, we fall back to slow code.)
redis = ["txredisapi", "hiredis"] redis = ["txredisapi", "hiredis"]
# Required to use experimental `caches.track_memory_usage` config option. # Required to use experimental `caches.track_memory_usage` config option.
cache_memory = ["pympler"] cache-memory = ["pympler"]
test = ["parameterized", "idna"] test = ["parameterized", "idna"]
# The duplication here is awful. I hate hate hate hate hate it. However, for now I want # The duplication here is awful. I hate hate hate hate hate it. However, for now I want
@ -258,7 +258,7 @@ all = [
"jaeger-client", "opentracing", "jaeger-client", "opentracing",
# redis # redis
"txredisapi", "hiredis", "txredisapi", "hiredis",
# cache_memory # cache-memory
"pympler", "pympler",
# omitted: # omitted:
# - test: it's useful to have this separate from dev deps in the olddeps job # - test: it's useful to have this separate from dev deps in the olddeps job

View File

@ -159,7 +159,7 @@ class CacheConfig(Config):
self.track_memory_usage = cache_config.get("track_memory_usage", False) self.track_memory_usage = cache_config.get("track_memory_usage", False)
if self.track_memory_usage: if self.track_memory_usage:
check_requirements("cache_memory") check_requirements("cache-memory")
expire_caches = cache_config.get("expire_caches", True) expire_caches = cache_config.get("expire_caches", True)
cache_entry_ttl = cache_config.get("cache_entry_ttl", "30m") cache_entry_ttl = cache_config.get("cache_entry_ttl", "30m")