1
- # Compatibility with Python 2 and Python 3 {: #py2_py3_compatibility }
1
+ # Compatibility with Python 3 {: #py2_py3_compatibility }
2
2
3
- Starting with EasyBuild v4 .0, the EasyBuild framework and easyblocks are
4
- compatible with both Python versions 2 and 3. More specifically, the
5
- following Python versions are currently supported:
3
+ Starting with EasyBuild v5 .0, the EasyBuild framework and easyblocks require Python >= 3.6.
4
+
5
+ More specifically, the following Python versions are currently supported:
6
6
7
- - Python 2.6.x (support was removed in EasyBuild v4.4.0)
8
- - Python 2.7.x ([ support will be removed in EasyBuild v5.0.0] ( easybuild-v5/index.md ) )
9
- - Python 3.5.x ([ support will be removed in EasyBuild v5.0.0] ( easybuild-v5/index.md ) )
10
7
- Python 3.6.x
11
8
- Python 3.7.x
12
9
- Python 3.8.x (requires EasyBuild v4.1.0)
13
10
- Python 3.9.x (requires EasyBuild v4.3.1)
14
11
- Python 3.10.x (requires EasyBuild v4.5.2)
15
12
- Python 3.11.x (requires EasyBuild v4.5.2)
13
+ - Python 3.12.x (requires EasyBuild v5.0.0)
14
+ - Python 3.13.x (requires EasyBuild v5.0.0)
16
15
17
16
## Determining which Python version EasyBuild is using via ` $EB_VERBOSE ` {: #py2_py3_compatibility_EB_VERBOSE }
18
17
@@ -41,7 +40,6 @@ The commands considered are (in order):
41
40
42
41
- ` python `
43
42
- ` python3 `
44
- - ` python2 `
45
43
46
44
Before considering these commands, ` eb ` will first consider the command
47
45
name specified via the ` $EB_PYTHON ` environment variable (if defined),
@@ -62,130 +60,12 @@ This is EasyBuild 4.0.0 (framework: 4.0.0, easyblocks: 4.0.0) on host example.
62
60
63
61
## The ` easybuild.tools.py2vs3 ` package
64
62
65
- To facilitate this, the ` easybuild.tools.py2vs3 ` package was introduced
66
- in EasyBuild v4.0. When importing a function from this package, you will
67
- automatically get a version of the function that is compatible with the
68
- Python version being used to run EasyBuild.
69
-
70
- Through this approach we can hide subtle differences between Python 2
71
- and 3, while avoiding code duplication and Python version checks
72
- throughout the codebase, as well as avoid requiring packages like ` six `
73
- or ` future ` (which facilitate maintaining compatibility with Python 2
74
- and 3, but are also a bit of a burden).
75
-
76
- The ` easybuild.tools.py2vs3 ` package provides two major classes of items
77
- (listed below in alphabetical order):
78
-
79
- - functions from the Python standard library which should be imported
80
- from different locations in Python 2 and 3
81
- - wrappers for functionality in the Python standard library which
82
- behaves differently in Python 2 and 3
83
-
84
- ## ` ascii_letters ` {: #py2vs3_ascii_letters }
85
-
86
- - Python 2: corresponds to ` string.letters `
87
- - Python 3: corresponds to ` string.ascii_letters `
88
-
89
- ## ` ascii_lowercase ` {: #py2vs3_ascii_lowercase }
90
-
91
- - Python 2: corresponds to ` string.lowercase `
92
- - Python 3: corresponds to ` string.ascii_lowercase `
93
-
94
- ## ` build_opener ` {: #py2vs3_build_opener }
95
-
96
- - Python 2: corresponds to ` urllib2.build_opener ` function
97
- - Python 3: corresponds to ` urllib.request.build_opener ` function
98
-
99
- ## ` configparser ` {: #py2vs3_configparser }
100
-
101
- - Python 2: corresponds to ` ConfigParser.configparser ` module
102
- - Python 3: corresponds to ` configparser ` module
103
-
104
- ## ` create_base_metaclass ` {: #py2vs3_create_base_metaclass }
105
-
106
- Function to create a metaclass that can be used as a base class,
107
- implemented in a way that is compatible with both Python 2 and 3.
108
-
109
- ## ` extract_method_name ` {: #py2vs3_extract_method_name }
110
-
111
- Function to method name from lambda function, implemented in a way that
112
- is compatible with both Python 2 and 3.
113
-
114
- ## ` HTTPError ` {: #py2vs3_HTTPError }
115
-
116
- - Python 2: corresponds to ` urllib2.HTTPError `
117
- - Python 3: corresponds to ` urllib.request.HTTPError `
118
-
119
- ## ` HTTPSHandler ` {: #py2vs3_HTTPSHandler }
120
-
121
- - Python 2: corresponds to ` urllib2.HTTPSHandler `
122
- - Python 3: corresponds to ` urllib.request.HTTPSHandler `
123
-
124
- ## ` json_loads ` {: #py2vs3_json_loads }
125
-
126
- - Python 2: wraps ` json.loads ` function
127
-
128
- - Python 3: wraps ` json.loads ` function, taking into account that for Python versions older than 3.6
129
- - a value of type ` string ` (rather than ` bytes ` ) is required as argument
130
-
131
- ## ` mk_wrapper_baseclass ` {: #py2vs3_mk_wrapper_baseclass }
132
-
133
- Function to create a wrapper base class using the specified metaclass,
134
- implemented in a way that is compatible with both Python 2 and 3.
135
-
136
- ## ` OrderedDict ` {: #py2vs3_OrderedDict }
137
-
138
- - Python 2.6: corresponds to ` easybuild.tools.ordereddict.OrderedDict `
139
- - Python 2.7: corresponds to ` collections.OrderedDict `
140
- - Python 3: corresponds to ` collections.OrderedDict `
141
-
142
- ## ` reload ` {: #py2vs3_reload }
143
-
144
- - Python 2: corresponds to ` reload ` built-in function
145
- - Python 3: corresponds to ` importlib.reload ` function
146
-
147
- ## ` raise_with_traceback ` {: #py2vs3_raise_with_traceback }
148
-
149
- Function to raise an error with specified message and traceback,
150
- implemented in a way that is compatible with both Python 2 and 3.
151
-
152
- ## ` Request ` {: #py2vs3_Request }
153
-
154
- - Python 2: corresponds to ` urllib2.Request `
155
- - Python 3: corresponds to ` urllib.request.Request `
156
-
157
- ## ` subprocess_popen_text ` {: #py2vs3_subprocess_popen_text }
158
-
159
- - Python 2: wrapper for ` subprocess.Popen `
160
- - Python 3: wrapper for ` subprocess.Popen ` while forcing text mode
161
- (using ` universal_newlines=True ` )
162
-
163
- ## ` std_urllib ` {: #py2vs3_std_urllib }
164
-
165
- - Python 2: corresponds to ` urllib ` package
166
- - Python 3: corresponds to ` urllib.request ` package
167
-
168
- ## ` string_type ` {: #py2vs3_string_type }
169
-
170
- - Python 2: corresponds to ` basestring ` built-in string type
171
- - Python 3: corresponds to ` str ` built-in string type
172
-
173
- ## ` StringIO ` {: #py2vs3_StringIO }
174
-
175
- - Python 2: corresponds to ` StringIO.StringIO ` class
176
- - Python 3: corresponds to ` io.StringIO ` class
177
-
178
- ## ` urlencode ` {: #py2vs3_urlencode }
179
-
180
- - Python 2: corresponds to ` urllib.urlencode ` function
181
- - Python 3: corresponds to ` urllib.parse.urlencode ` function
182
-
183
- ## ` URLError ` {: #py2vs3_URLError }
184
-
185
- - Python 2: corresponds to ` urllib2.URLError `
186
- - Python 3: corresponds to ` urllib.request.URLError `
63
+ Support for Python 2.7, and Python 3.5, was removed in EasyBuild v5.0.
187
64
188
- ## ` urlopen ` {: #py2vs3_urlopen }
65
+ The ` easybuild.tools.py2vs3 ` package was introduced in EasyBuild v4.0 so
66
+ that when importing a function from this package, you would automatically
67
+ get a version of the function that is compatible with the Python version
68
+ being used to run EasyBuild.
189
69
190
- - Python 2: corresponds to ` urllib2.urlopen `
191
- - Python 3: corresponds to ` urllib.request.urlopen `
70
+ Use of ` easybuild.tools.py2vs3 ` is deprecated in EasyBuild v5 and will be
71
+ removed in the future.
0 commit comments