Skip to content

Commit

Permalink
Bump required Python 3.7 -> 3.8, drop TF1 support (#1668)
Browse files Browse the repository at this point in the history
Closes #1326
  • Loading branch information
NeoLegends authored Dec 17, 2024
1 parent 6e8de68 commit d51e906
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/black.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.7
python-version: 3.8
cache: 'pip'
cache-dependency-path: '.github/workflows/black.yml'
- run: pip install black==22.3.0
Expand Down
24 changes: 6 additions & 18 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
fail-fast: false
matrix:
python-version:
- 3.7
- 3.8
action:
- TEST=Dataset
- TEST=fork_exec
Expand Down Expand Up @@ -158,7 +158,7 @@ jobs:
fail-fast: false
matrix:
python-version:
- 3.7
- 3.8
tf-version:
- 2.10.0
action:
Expand All @@ -174,23 +174,11 @@ jobs:
- TEST=TFUtil
- TEST=tools
include:
- action: TEST=TFUtil
python-version: 3.7
tf-version: 1.15.3
- action: TEST=TFEngine
python-version: 3.7
tf-version: 1.15.3
- action: TEST=TFEngine
python-version: 3.7
python-version: 3.8
tf-version: 2.3.0
- action: TEST=TFNativeOp
python-version: 3.7
tf-version: 1.14.0
- action: TEST=TFNetworkSigProcLayer
python-version: 3.7
tf-version: 1.15.3
- action: TEST=demos RETURNN_DISABLE_TORCH=1
python-version: 3.7
python-version: 3.8
tf-version: 2.3.0

steps:
Expand Down Expand Up @@ -221,7 +209,7 @@ jobs:
pip install --user pytest
if [[ "${{matrix.tf-version}}" == 2.[0123].* || "${{matrix.tf-version}}" == 1.* ]]; then
if [[ "${{matrix.tf-version}}" == 2.[0123].* ]]; then
# Older TF needs older NumPy version.
# https://github.com/rwth-i6/returnn/pull/1160#issuecomment-1284537803
pip install --user numpy==1.19.5
Expand Down Expand Up @@ -358,7 +346,7 @@ jobs:
include:
# Some selected tests (but not all) with some other versions.
- action: TEST=rf_base
python-version: 3.7
python-version: 3.8
torch-version: 1.13.1
tf-version: 2.10.0

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: 3.7
python-version: 3.8

- name: Install Python deps
run: |
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ or any changes which could potentially break or change the behavior of existing
This is intentionally kept short. For a full change log, just see the Git log.


## 2024-12-13: Bump min Python version from 3.7 to 3.8 ([issue #1326](https://github.com/rwth-i6/returnn/issues/1326))

This also drops support for TF 1.x.

## 2024-06-07: `VariableDataset`

Custom subdataset per subepoch based on user-provided function.
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ General rules when contributing to the code of RETURNN:
and in general to use newer TF features (even maybe TF >=2),
as long as your new feature (new layer or so) is just optional.
For older TF support, `TFCompat.py` might be helpful. (See code for examples.)
* We support Python >=3.7 ([discussion](https://github.com/rwth-i6/returnn/issues/487)).
* We support Python >=3.8 ([discussion](https://github.com/rwth-i6/returnn/issues/1326)).

About new features:

Expand Down
12 changes: 12 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,15 @@ Questions can also be asked on

.. image:: https://github.com/rwth-i6/returnn/workflows/CI/badge.svg
:target: https://github.com/rwth-i6/returnn/actions

Dependencies
============

pip dependencies are listed in ``requirements.txt`` and ``requirements-dev``,
although some parts of the code may require additional dependencies (e.g. ``librosa``, ``resampy``) on-demand.

RETURNN supports Python >= 3.8. Bumps to the minimum Python version are listed in `CHANGELOG.md <https://github.com/rwth-i6/returnn/blob/master/CHANGELOG.md>`__.

TensorFlow-based setups require TensorFlow >= 2.2.

PyTorch-based setups require Torch >= 1.0.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.black]
line-length = 120
target-version = ["py37"] # https://github.com/rwth-i6/returnn/issues/487
target-version = ["py38"] # https://github.com/rwth-i6/returnn/issues/1326
extend-exclude = '''
/(
# All Git submodules, see .gitmodules.
Expand Down
7 changes: 3 additions & 4 deletions tests/PyCharm.idea/inspectionProfiles/Project_Default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
<inspection_tool class="PyCompatibilityInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ourVersions">
<value>
<list size="3">
<item index="0" class="java.lang.String" itemvalue="3.7" />
<item index="1" class="java.lang.String" itemvalue="3.8" />
<item index="2" class="java.lang.String" itemvalue="3.9" />
<list size="2">
<item index="0" class="java.lang.String" itemvalue="3.8" />
<item index="1" class="java.lang.String" itemvalue="3.9" />
</list>
</value>
</option>
Expand Down
5 changes: 4 additions & 1 deletion tests/test_Log.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,12 @@ def filter_out(ls):
i = 0
while i < len(ls):
s = ls[i]
if "tensorflow/core/" in s or "tensorflow/stream_executor/" in s: # some TF warnings
if any(f"{l} tensorflow/" in s for l in "IWE"): # some TF warnings
i += 1
continue
elif "SyntaxWarning" in s:
i += 2
continue
# RuntimeWarning|FutureWarning are warnings and they include the code-line in the next output line
if i + 1 < len(ls) and ls[i + 1].startswith(" "):
if re.match(".*:\\d+: RuntimeWarning: numpy.*", s) or re.match(".*:\\d+: FutureWarning: .*", s):
Expand Down

0 comments on commit d51e906

Please sign in to comment.