Coverage for version.py: 88%

8 statements  

« prev     ^ index     » next       coverage.py v7.8.0, created at 2026-02-05 06:46 -0600

1""" 

2crate_anon/version.py 

3 

4=============================================================================== 

5 

6 Copyright (C) 2015, University of Cambridge, Department of Psychiatry. 

7 Created by Rudolf Cardinal (rnc1001@cam.ac.uk). 

8 

9 This file is part of CRATE. 

10 

11 CRATE is free software: you can redistribute it and/or modify 

12 it under the terms of the GNU General Public License as published by 

13 the Free Software Foundation, either version 3 of the License, or 

14 (at your option) any later version. 

15 

16 CRATE is distributed in the hope that it will be useful, 

17 but WITHOUT ANY WARRANTY; without even the implied warranty of 

18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

19 GNU General Public License for more details. 

20 

21 You should have received a copy of the GNU General Public License 

22 along with CRATE. If not, see <https://www.gnu.org/licenses/>. 

23 

24=============================================================================== 

25 

26**Version constants for CRATE.** 

27 

28""" 

29 

30import sys 

31 

32 

33# ============================================================================= 

34# Constants 

35# ============================================================================= 

36 

37CRATE_VERSION = "0.20.7" 

38CRATE_VERSION_DATE = "2025-05-05" 

39 

40MINIMUM_PYTHON_VERSION = (3, 10) 

41# Only other place that has this: install_virtualenv.py (which can't import 

42# CRATE packages). 

43 

44 

45# ============================================================================= 

46# Derived constants 

47# ============================================================================= 

48 

49CRATE_VERSION_PRETTY = ( 

50 f"CRATE version {CRATE_VERSION}, {CRATE_VERSION_DATE}. " 

51 f"Created by Rudolf Cardinal." 

52) 

53MINIMUM_PYTHON_VERSION_AS_DECIMAL = ".".join( 

54 str(_) for _ in MINIMUM_PYTHON_VERSION 

55) 

56 

57 

58# ============================================================================= 

59# Helper functions 

60# ============================================================================= 

61 

62 

63def require_minimum_python_version(): 

64 """ 

65 Checks that we are running the required minimum Python version. 

66 """ 

67 assert ( 

68 sys.version_info >= MINIMUM_PYTHON_VERSION 

69 ), f"Need Python {MINIMUM_PYTHON_VERSION_AS_DECIMAL}+"