Skip to content

Commit e9977e6

Browse files
authored
Python compat info
1 parent a2bb8d9 commit e9977e6

File tree

2 files changed

+14
-134
lines changed

2 files changed

+14
-134
lines changed

docs/python-2-3-compatibility.md

Lines changed: 13 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
# Compatibility with Python 2 and Python 3 {: #py2_py3_compatibility }
1+
# Compatibility with Python 3 {: #py2_py3_compatibility }
22

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:
66

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))
107
- Python 3.6.x
118
- Python 3.7.x
129
- Python 3.8.x (requires EasyBuild v4.1.0)
1310
- Python 3.9.x (requires EasyBuild v4.3.1)
1411
- Python 3.10.x (requires EasyBuild v4.5.2)
1512
- 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)
1615

1716
## Determining which Python version EasyBuild is using via `$EB_VERBOSE` {: #py2_py3_compatibility_EB_VERBOSE }
1817

@@ -41,7 +40,6 @@ The commands considered are (in order):
4140

4241
- `python`
4342
- `python3`
44-
- `python2`
4543

4644
Before considering these commands, `eb` will first consider the command
4745
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.
6260

6361
## The `easybuild.tools.py2vs3` package
6462

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.
18764

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.
18969

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.

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ nav:
6060
- Locks: locks.md
6161
- Manipulating dependencies: manipulating-dependencies.md
6262
- Partial installations: partial-installations.md
63-
- Compatibility with Python 2 + 3: python-2-3-compatibility.md
63+
- Compatibility with Python 3: python-2-3-compatibility.md
6464
- Progress bars: progress-bars.md
6565
- Search index for easyconfigs: easyconfigs-search-index.md
6666
- System toolchain: system-toolchain.md

0 commit comments

Comments
 (0)