Skip to content

Commit

Permalink
Add support for python 3.7 (#66)
Browse files Browse the repository at this point in the history
Co-authored-by: Lucas Boucinha <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people committed Feb 2, 2023
1 parent d6ef7c0 commit 807fa94
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
strategy:
matrix:
os: [pytwin-win10, ubuntu-20.04]
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.7", "3.8", "3.9", "3.10"]
steps:
- name: Run pytest
uses: pyansys/actions/tests-pytest@v3
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ packages = [
]

[tool.poetry.dependencies]
python = ">=3.8,<3.12"
python = ">=3.7.1,<3.11"
importlib-metadata = {version = "^4.0", python = "<3.8"}
numpy = ">=1.14"
pandas = ">=1.3.2"
Expand Down
6 changes: 6 additions & 0 deletions requirements/requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
numpy>=0.7.0
pandas>=1.3.2
pywin32>=304
importlib-metadata>=4.0
pytest>=7.1.2
pytest-cov>=4.0.0
8 changes: 6 additions & 2 deletions src/ansys/pytwin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
library
"""
import importlib.metadata as metadata
try:
import importlib.metadata as importlib_metadata
except ModuleNotFoundError:
import importlib_metadata

__version__ = metadata.version("pytwin")

__version__ = importlib_metadata.version("pytwin")

"""
PUBLIC API TO PYTWIN SETTINGS
Expand Down
28 changes: 22 additions & 6 deletions src/ansys/pytwin/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging
import os
import shutil
import sys
import tempfile


Expand Down Expand Up @@ -369,12 +370,27 @@ def _migration_due_to_new_wd(old_path: str, new_path: str):
filepath=new_logfile_path, level=_PyTwinSettings.LOGGING_LEVEL, mode="a"
)
# Migrate subfolder
shutil.copytree(
src=old_path,
dst=new_path,
ignore=shutil.ignore_patterns(f"{_PyTwinSettings.TEMP_WD_NAME}*"),
dirs_exist_ok=True,
)
if sys.version >= "3.8":
shutil.copytree(
src=old_path,
dst=new_path,
ignore=shutil.ignore_patterns(f"{_PyTwinSettings.TEMP_WD_NAME}*"),
dirs_exist_ok=True,
)
else:
"""Copy a directory structure overwriting existing files"""
src = old_path
dst = new_path
for root, dirs, files in os.walk(src):
if not os.path.isdir(root):
os.makedirs(root)
for file in files:
rel_path = root.replace(src, "").lstrip(os.sep)
dest_path = os.path.join(dst, rel_path)
if _PyTwinSettings.TEMP_WD_NAME not in dest_path:
if not os.path.isdir(dest_path):
os.makedirs(dest_path)
shutil.copyfile(os.path.join(root, file), os.path.join(dest_path, file))

@staticmethod
def modify_wd_dir(new_path: str, erase: bool):
Expand Down

0 comments on commit 807fa94

Please sign in to comment.