Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/setuptools/config/__init__.py: 86%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

14 statements  

1"""For backward compatibility, expose main functions from 

2``setuptools.config.setupcfg`` 

3""" 

4 

5from functools import wraps 

6from typing import Callable, TypeVar, cast 

7 

8from ..warnings import SetuptoolsDeprecationWarning 

9from . import setupcfg 

10 

11Fn = TypeVar("Fn", bound=Callable) 

12 

13__all__ = ('parse_configuration', 'read_configuration') 

14 

15 

16def _deprecation_notice(fn: Fn) -> Fn: 

17 @wraps(fn) 

18 def _wrapper(*args, **kwargs): 

19 SetuptoolsDeprecationWarning.emit( 

20 "Deprecated API usage.", 

21 f""" 

22 As setuptools moves its configuration towards `pyproject.toml`, 

23 `{__name__}.{fn.__name__}` became deprecated. 

24 

25 For the time being, you can use the `{setupcfg.__name__}` module 

26 to access a backward compatible API, but this module is provisional 

27 and might be removed in the future. 

28 

29 To read project metadata, consider using 

30 ``build.util.project_wheel_metadata`` (https://pypi.org/project/build/). 

31 For simple scenarios, you can also try parsing the file directly 

32 with the help of ``configparser``. 

33 """, 

34 # due_date not defined yet, because the community still heavily relies on it 

35 # Warning introduced in 24 Mar 2022 

36 ) 

37 return fn(*args, **kwargs) 

38 

39 return cast(Fn, _wrapper) 

40 

41 

42read_configuration = _deprecation_notice(setupcfg.read_configuration) 

43parse_configuration = _deprecation_notice(setupcfg.parse_configuration)