File: python3-scipy.README.Debian

package info (click to toggle)
scipy 1.17.0-1exp2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 235,340 kB
  • sloc: cpp: 506,914; python: 357,038; ansic: 215,028; javascript: 89,566; fortran: 19,308; cs: 3,081; f90: 1,150; sh: 860; makefile: 519; pascal: 284; lisp: 134; xml: 56; perl: 51
file content (49 lines) | stat: -rw-r--r-- 1,821 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
__config__.py and SOABI
=======================

Binary builds for different python versions are distinguished by a SOABI tag
sysconfig.get_config_var('SOABI')
e.g. cpython-313-x86_64-linux-gnu

This tag is appended to binary shared libraries compiled by cython,
and allows the module built for different python versions e.g.
python3.13 and python3.14, to be installed alongside each other in the
same installation directory /usr/lib/python3/dist-packages/

But scipy provides a config file scipy/__config__py, accessed as
scipy.__config__, which also includes binary arch-specific information
such as library paths or BLAS build configurations.

In order to continue allowing installation of multiple python
versions, debian has patched __config__py to use a SOABI mechanism.
The config file is renamed as __config__<SOABI>__.py
e.g. __config__cpython-313-x86_64-linux-gnu__.py
and __init__.py loads the SOABI-specific file to ensure that
scipy.__config__ continues to be accessible.

In some cases you might wish to import scipy.__config__ directly.

For instance scipy/linalg/blas.py uses
    from scipy.__config__ import CONFIG
to read the BLAS configuration.

This direct import does not work because of the SOABI tag added to __config__.py

Instead, __config__ can be imported dynamically as done in scipy/__init__.py,
  import sysconfig
  _SOABI = _sysconfig.get_config_var('SOABI')
  __config__ = _importlib.import_module('scipy.__config' + ('__'+_SOABI if _SOABI is not None else '') + '__')
  del _SOABI

or it can be accessed via scipy
  import scipy
  CONFIG = scipy.__config__.CONFIG

or alternatively via exceptions
  try:
      from scipy.__config__ import CONFIG
  except ModuleNotFoundError:
      # allow for __config__<SOABI>__
      import scipy
      CONFIG = scipy.__config__.CONFIG
      del scipy