Skip to content

Commit 624a9a2

Browse files
committed
Drop support for Python 3.7
Drop support for Python 3.7, and remove it from the tox and CI/CD configurations. Upgrade mypy to avoid python/mypy#13499, and add checks for 'None' to account for newly reported errors.
1 parent effd27e commit 624a9a2

File tree

7 files changed

+68
-196
lines changed

7 files changed

+68
-196
lines changed

.github/workflows/ci_cd.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
# docker images on the windows agents. See the issue
5959
# https://github.com/actions/runner-images/issues/1143
6060
os: [ubuntu-latest]
61-
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
61+
python-version: ['3.8', '3.9', '3.10', '3.11']
6262
fail-fast: false
6363
steps:
6464
- name: "Login in Github Container registry"
@@ -120,7 +120,7 @@ jobs:
120120
- name: Set up Python
121121
uses: actions/setup-python@v4
122122
with:
123-
python-version: 3.7
123+
python-version: 3.8
124124
- name: Install dependencies
125125
run: |
126126
python -m pip install --upgrade pip tox tox-gh-actions

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ cython_debug/
157157

158158
# End of https://www.toptal.com/developers/gitignore/api/python
159159

160+
# VSCode
161+
.vscode/
162+
160163
# Generated sphinx gallery
161164
doc/source/examples/gallery_examples
162165

@@ -165,4 +168,4 @@ doc/source/api/_autosummary
165168

166169
# testing server logs
167170
tests/logs/*_log_err*.txt
168-
tests/logs/*_log_out*.txt
171+
tests/logs/*_log_out*.txt

README.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ PyDPF Composites
88
:target: https://docs.pyansys.com/
99
:alt: PyAnsys
1010

11-
.. |python| image:: https://img.shields.io/badge/Python-%3E%3D3.7-blue
11+
.. |python| image:: https://img.shields.io/badge/Python-%3E%3D3.8-blue
1212
:target: https://pypi.org/project/ansys-dpf-composites/
1313
:alt: Python
1414

@@ -74,13 +74,13 @@ familiar with the `PyAnsys Developer's Guide`_.
7474
pipx install poetry
7575
pipx install pip
7676
pipx install tox
77-
78-
77+
78+
7979
PyDPF Composites uses `Poetry <https://python-poetry.org>`_
8080
to manage the development environment.
8181

8282
#. Create a virtual environment and install the package with the
83-
development dependencies:
83+
development dependencies:
8484

8585
.. code:: bash
8686

poetry.lock

Lines changed: 44 additions & 171 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,8 @@ packages = [
2424
]
2525

2626
[tool.poetry.dependencies]
27-
python = ">=3.7,<4.0"
28-
numpy = [
29-
{version = ">=1.19,<1.22", python = ">=3.7,<3.8"},
30-
{version = "^1.22", python = ">=3.8"}
31-
]
32-
importlib-metadata = {version = "^4.0", python = "<3.8"}
27+
python = ">=3.8,<4.0"
28+
numpy = "^1.22"
3329
build = {version = "^0.8.0", optional = true}
3430
twine = {version = "^4.0.1", optional = true}
3531
Sphinx = {version = "^5.0.1", optional = true}
@@ -41,8 +37,8 @@ sphinx-design = {version = "^0.3.0", optional = true}
4137
pypandoc = {version = "^1.8.1", optional = true}
4238
pytest = {version = "^7.1.2", optional = true}
4339
pytest-cov = {version = "^3.0.0", optional = true}
44-
mypy = {version = "^0.931", optional = true}
45-
mypy-extensions = {version = "^0.4.3", optional = true}
40+
mypy = {version = "^1.2.0", optional = true}
41+
mypy-extensions = {version = "^1.0.0", optional = true}
4642
# If this version changes also the link in doc/src/conf.py intersphinx-mapping has to change
4743
ansys-dpf-core = ">=0.8,<1"
4844
vtk = {version = "*"}
@@ -52,10 +48,7 @@ pre-commit = {version = "*", optional = true}
5248
# Upper bound because there is a problem with examples in versions > 1.20.1
5349
sphinx-autodoc-typehints = {version = "^1.19,<1.20.2", optional = true}
5450
pylint = {version = "^2.13", optional = true}
55-
scipy = [
56-
{version = ">=1.6", python = ">=3.7,<3.8", optional = true},
57-
{version = ">=1.9.0", python = ">=3.8", optional = true}
58-
]
51+
scipy = {version = ">=1.9.0", optional = true}
5952

6053
[tool.poetry.extras]
6154
all = [
@@ -124,6 +117,6 @@ ignored-classes = [
124117
]
125118

126119
[tool.mypy]
127-
python_version = 3.7
120+
python_version = 3.8
128121
mypy_path = "$MYPY_CONFIG_FILE_DIR/src:$MYPY_CONFIG_FILE_DIR/tests"
129122
ignore_missing_imports = true

src/ansys/dpf/composites/layup_info/_layup_info.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,9 @@ def get_dpf_material_id_by_analyis_ply_map(
218218
layer_index = analysis_ply_info_provider.get_layer_index_by_element_id(
219219
element_id_int
220220
)
221+
assert (
222+
layer_index is not None
223+
), f"No layer index found for element with id {element_id_int}."
221224
analysis_ply_to_material_map[analysis_ply_name] = element_info.dpf_material_ids[
222225
layer_index
223226
]
@@ -355,6 +358,8 @@ def get_element_info(self, element_id: int) -> Optional[ElementInfo]:
355358
n_spots = _get_n_spots(apdl_element_type, keyopt_8, keyopt_3)
356359
dpf_material_ids: Any = []
357360
element_type = self.dpf_element_types.by_id(element_id)
361+
if element_type is None:
362+
raise IndexError(f"No DPF element type for element with id {element_id}.")
358363

359364
layer_data = self.layer_indices.by_id(element_id)
360365
if layer_data is not None:

tox.ini

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
[tox]
22
description = Default tox environments list
33
envlist =
4-
style,{py3.7,py3.8,py3.9,py3.10,py3.11}{,-coverage},doc-{windows,linux}
4+
style,{py3.8,py3.9,py3.10,py3.11}{,-coverage},doc-{windows,linux}
55
skip_missing_interpreters = false
66
isolated_build = true
77

88
[gh-actions]
99
description = The tox environment to be executed in gh-actions for a given python version
1010
python =
11-
3.7: py3.7-coverage
1211
3.8: py3.8-coverage
1312
3.9: py3.9-coverage
1413
3.10: py3.10-coverage
@@ -17,7 +16,6 @@ python =
1716
[testenv]
1817
description = Checks for project unit tests and coverage (if desired)
1918
basepython =
20-
py3.7: python3.7
2119
py3.8: python3.8
2220
py3.9: python3.9
2321
py3.10: python3.10
@@ -36,7 +34,7 @@ commands =
3634
[testenv:test-minimal]
3735
description = Checks for project unit tests with minimal package versions
3836
basepython =
39-
python3.7
37+
python3.8
4038
skip_install = true
4139
allowlist_externals =
4240
poetry
@@ -104,4 +102,4 @@ allowlist_externals =
104102
poetry
105103
basepython =
106104
python3.9
107-
commands =poetry install -E all
105+
commands =poetry install -E all

0 commit comments

Comments
 (0)