Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Python 3.12 compatibility, drop Python 3.7 (EOL) #36

Merged
merged 2 commits into from
Oct 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ jobs:
strategy:
matrix:
os: [ubuntu-20.04, macos-latest, windows-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
# https://bugs.python.org/issue43749
exclude:
- os: windows-latest
python-version: 3.7
- os: windows-latest
python-version: 3.8

Expand Down Expand Up @@ -51,10 +49,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python 3.11
- name: Set up Python 3.12
uses: actions/setup-python@v2
with:
python-version: 3.11
python-version: 3.12
- name: Install dependencies
run: |
make venv
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Unreleased_
Added
~~~~~
* (mkfs) `PR #30 <https://github.com/nathanhi/pyfatfs/pull/30>`_: Add support for different FAT12 cluster sizes for filesystems up to 256MB by `@zurcher <https://github.com/zurcher>`_ / `@Microsoft <https://github.com/Microsoft>`_
* `PR #36 <https://github.com/nathanhi/pyfatfs/pull/36>`_: Add Python 3.12 support by `@zurcher <https://github.com/zurcher>`_ / `@Microsoft <https://github.com/Microsoft>`_

Changed
~~~~~~~
Expand All @@ -23,6 +24,11 @@ Changed
- Introduce ``lazy_load`` parameter to allow restoring previous behavior
- `PR #32 <https://github.com/nathanhi/pyfatfs/pull/32>`_: Fix tree iteration on non-lazy load by `@zurcher <https://github.com/zurcher>`_ / `@Microsoft <https://github.com/Microsoft>`_

Removed
~~~~~~~

* `PR #36 <https://github.com/nathanhi/pyfatfs/pull/36>`_: Drop Python 3.7 support by `@zurcher <https://github.com/zurcher>`_ / `@Microsoft <https://github.com/Microsoft>`_

1.0.5_ - 2022-04-16
-------------------

Expand Down
4 changes: 2 additions & 2 deletions pyfatfs/EightDotThree.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def set_byte_name(self, name: bytes):
:param name: `bytes`: Padded (must be 11 bytes) 8dot3 name
"""
if not isinstance(name, bytes):
raise TypeError(f"Given parameter must be of type bytes,"
raise TypeError(f"Given parameter must be of type bytes, "
f"but got {type(name)} instead.")

name = bytearray(name)
Expand All @@ -94,7 +94,7 @@ def set_byte_name(self, name: bytes):
def set_str_name(self, name: str):
"""Set the name as string from user input (i.e. folder creation)."""
if not isinstance(name, str):
raise TypeError(f"Given parameter must be of type str,"
raise TypeError(f"Given parameter must be of type str, "
f"but got {type(name)} instead.")

if not self.is_8dot3_conform(name, self.encoding):
Expand Down
8 changes: 4 additions & 4 deletions pyfatfs/FatIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ def __repr__(self) -> str:

ex: <FatFile fs=<PyFat object> path="/README.txt" mode="r">
"""
return f'<{self.__class__.__name__} ' \
f'fs={self.fs} ' \
f'path="{self.name}" ' \
f'mode="{self.mode}"'
return str(f'<{self.__class__.__name__} '
f'fs={self.fs} '
f'path="{self.name}" '
f'mode="{self.mode}"')

def seek(self, offset: int, whence: int = 0) -> int:
"""Seek to a given offset in the file.
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools ~= 65.6", "setuptools_scm[toml] ~= 7.1"]
requires = ["setuptools ~= 67.8", "setuptools_scm[toml] ~= 7.1"]
build-backend = "setuptools.build_meta"

[project]
Expand Down Expand Up @@ -46,7 +46,7 @@ development = [
"coveralls>=3.0.0,<4.0.0",
"flake8~=5.0",
"flake8-docstrings>=1.6.0,<2.0.0",
"pip-tools>=6.12.0,<7.0.0",
"pip-tools~=7.3.0",
"sphinx>=4.0.3,<4.1.0",
"build~=0.9",
]
Expand Down
2 changes: 1 addition & 1 deletion requirements/development.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ packaging==22.0
# sphinx
pep517==0.13.0
# via build
pip-tools==6.12.1
pip-tools==7.3.0
# via pyfatfs (pyproject.toml)
pluggy==1.0.0
# via pytest
Expand Down
16 changes: 13 additions & 3 deletions tests/test_PyFatFS.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,17 @@ def _make_fs(fat_type: int, **kwargs) -> (PyFatBytesIOFS, BytesIO):
in_memory_fs)


class TestPyFatFS16(FSTestCases, TestCase):
class PyFsCompatLayer:
"""PyFilesystem2 Python 3.12 compatibility layer.

Adds a workaround for PyFilesystem2#568:
https://github.com/PyFilesystem/pyfilesystem2/issues/568
"""

assertRaisesRegexp = TestCase.assertRaisesRegex


class TestPyFatFS16(FSTestCases, TestCase, PyFsCompatLayer):
"""Integration tests with PyFilesystem2 for FAT16."""

FAT_TYPE = PyFat.FAT_TYPE_FAT16
Expand Down Expand Up @@ -107,13 +117,13 @@ def test_writetest_truncates(self):
assert self.fs.readtext(fname) == '1' * 16


class TestPyFatFS32(TestPyFatFS16, FSTestCases, TestCase):
class TestPyFatFS32(TestPyFatFS16, FSTestCases, TestCase, PyFsCompatLayer):
"""Integration tests with PyFilesystem2 for FAT32."""

FAT_TYPE = PyFat.FAT_TYPE_FAT32


class TestPyFatFS12(TestPyFatFS16, FSTestCases, TestCase):
class TestPyFatFS12(TestPyFatFS16, FSTestCases, TestCase, PyFsCompatLayer):
"""Test specifics of FAT12 filesystem."""

FAT_TYPE = PyFat.FAT_TYPE_FAT12
Expand Down
Loading