From 56cbfa002a44dce471b58ca3e6680d89ba9ec8a0 Mon Sep 17 00:00:00 2001 From: Harmon Date: Mon, 18 Jan 2021 13:31:13 -0600 Subject: [PATCH 01/40] Fix changelog version number v3.0.3 was skipped --- doc/source/changes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/changes.rst b/doc/source/changes.rst index f8ddb1d..3169674 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -9,7 +9,7 @@ v3.0.4 - signed release (with correct key this time) ****** -v3.0.3 +v3.0.2 ****** - signed release From 0b53ddc88a1221a9b933bc53570729c96cb4f09d Mon Sep 17 00:00:00 2001 From: Harmon Date: Mon, 18 Jan 2021 13:44:30 -0600 Subject: [PATCH 02/40] Remove Sublime Text project definition --- etc/sublime-text/smmap.sublime-project | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 etc/sublime-text/smmap.sublime-project diff --git a/etc/sublime-text/smmap.sublime-project b/etc/sublime-text/smmap.sublime-project deleted file mode 100644 index 251ebbd..0000000 --- a/etc/sublime-text/smmap.sublime-project +++ /dev/null @@ -1,21 +0,0 @@ -{ - "folders": - [ - // SMMAP - //////// - { - "follow_symlinks": true, - "path": "../..", - "file_exclude_patterns" : [ - "*.sublime-workspace", - ".git", - ".noseids", - ".coverage" - ], - "folder_exclude_patterns" : [ - ".git", - "cover", - ] - }, - ] -} From e79fe25f16c3a8bfcf315b269412f0927486155d Mon Sep 17 00:00:00 2001 From: Harmon Date: Mon, 18 Jan 2021 13:48:06 -0600 Subject: [PATCH 03/40] Remove duplicate sys import --- smmap/buf.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/smmap/buf.py b/smmap/buf.py index 786775a..cdbfad3 100644 --- a/smmap/buf.py +++ b/smmap/buf.py @@ -3,8 +3,6 @@ __all__ = ["SlidingWindowMapBuffer"] -import sys - try: bytes except NameError: From 066f038cfc74d6095289b5dc3f8810a242e81ecb Mon Sep 17 00:00:00 2001 From: Harmon Date: Mon, 18 Jan 2021 13:53:34 -0600 Subject: [PATCH 04/40] Remove bytes existence check Python < 2.6 is no longer supported --- smmap/buf.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/smmap/buf.py b/smmap/buf.py index cdbfad3..18766da 100644 --- a/smmap/buf.py +++ b/smmap/buf.py @@ -3,11 +3,6 @@ __all__ = ["SlidingWindowMapBuffer"] -try: - bytes -except NameError: - bytes = str - class SlidingWindowMapBuffer(object): From 93c7ba67f0614416482916741f24829bef06e22f Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 11 Apr 2020 14:21:10 +0800 Subject: [PATCH 05/40] Revert "Remove basestring reference, no py2 support" This reverts commit 2ceedc91958dc080b31e426150610eef52774f5f. --- smmap/util.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/smmap/util.py b/smmap/util.py index 13604c5..defef1f 100644 --- a/smmap/util.py +++ b/smmap/util.py @@ -23,7 +23,11 @@ def buffer(obj, offset, size): def string_types(): - return str + if sys.version_info[0] >= 3: + return str + else: + return basestring + def align_to_mmap(num, round_up): """ From 06c4972c87dcd07bb42071b86c2b0d2aae03e581 Mon Sep 17 00:00:00 2001 From: Harmon Date: Thu, 21 Jan 2021 06:06:50 -0600 Subject: [PATCH 06/40] Ignore Flake8 undefined name error for Python 2 support --- smmap/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smmap/util.py b/smmap/util.py index defef1f..3d73291 100644 --- a/smmap/util.py +++ b/smmap/util.py @@ -26,7 +26,7 @@ def string_types(): if sys.version_info[0] >= 3: return str else: - return basestring + return basestring # noqa: F821 def align_to_mmap(num, round_up): From c661324746a26df609d1ace2106a1c8b916cf802 Mon Sep 17 00:00:00 2001 From: Harmon Date: Thu, 21 Jan 2021 06:12:51 -0600 Subject: [PATCH 07/40] Improve changelog for v3.0.2 --- doc/source/changes.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/source/changes.rst b/doc/source/changes.rst index 3169674..f92db64 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -12,7 +12,8 @@ v3.0.4 v3.0.2 ****** -- signed release +- Signed release +- Switched to GitHub Actions for CI ****** v3.0.1 From 37cc3c09c188b65996e170cddce2d151bf682388 Mon Sep 17 00:00:00 2001 From: Harmon Date: Thu, 21 Jan 2021 06:14:03 -0600 Subject: [PATCH 08/40] Improve capitalization consistency in changelog for v3.0.4 --- doc/source/changes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/changes.rst b/doc/source/changes.rst index f92db64..bc1db5d 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -6,7 +6,7 @@ Changelog v3.0.4 ****** -- signed release (with correct key this time) +- Signed release (with correct key this time) ****** v3.0.2 From 65f171aadffb2d83124065fc6c193f133936643b Mon Sep 17 00:00:00 2001 From: Harmon Date: Thu, 21 Jan 2021 06:17:49 -0600 Subject: [PATCH 09/40] Add changelog for v3.0.5 --- doc/source/changes.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/source/changes.rst b/doc/source/changes.rst index bc1db5d..c9665b6 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -2,6 +2,12 @@ Changelog ######### +****** +v3.0.5 +****** + +- Restored Python 2 support removed in v3.0.2 + ****** v3.0.4 ****** From 119cc417541f400b3533c02d53d3d5f236e87023 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 23 Jan 2021 09:59:05 +0800 Subject: [PATCH 10/40] bump patch level --- Makefile | 2 +- doc/source/changes.rst | 2 ++ smmap/__init__.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b867ad7..593a758 100644 --- a/Makefile +++ b/Makefile @@ -46,4 +46,4 @@ release: clean force_release:: clean git push --tags python3 setup.py sdist bdist_wheel - twine upload -s -i 2CF6E0B51AAF73F09B1C21174D1DA68C88710E60 dist/* + twine upload -s -i 27C50E7F590947D7273A741E85194C08421980C9 dist/* diff --git a/doc/source/changes.rst b/doc/source/changes.rst index c9665b6..041711b 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -7,6 +7,8 @@ v3.0.5 ****** - Restored Python 2 support removed in v3.0.2 +- changed release signature key to 27C50E7F590947D7273A741E85194C08421980C9. See + https://keybase.io/byronbates for proof of ownership. ****** v3.0.4 diff --git a/smmap/__init__.py b/smmap/__init__.py index a6671e1..abc09d9 100644 --- a/smmap/__init__.py +++ b/smmap/__init__.py @@ -3,7 +3,7 @@ __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/smmap" -version_info = (3, 0, 4) +version_info = (3, 0, 5) __version__ = '.'.join(str(i) for i in version_info) # make everything available in root package for convenience From 9c2570bf07db6dfc7d616b5ffaee84cc33b5c0f5 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 23 Jan 2021 21:01:32 -0600 Subject: [PATCH 11/40] Improve changelog for v3.0.5 --- doc/source/changes.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/changes.rst b/doc/source/changes.rst index 041711b..bc0b1b6 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -7,8 +7,8 @@ v3.0.5 ****** - Restored Python 2 support removed in v3.0.2 -- changed release signature key to 27C50E7F590947D7273A741E85194C08421980C9. See - https://keybase.io/byronbates for proof of ownership. +- Changed release signature key to 27C50E7F590947D7273A741E85194C08421980C9. + See https://keybase.io/byronbates for proof of ownership. ****** v3.0.4 From 341b27890a0e1353ccdf08b345aee9f5934d1847 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 23 Jan 2021 21:08:03 -0600 Subject: [PATCH 12/40] Remove string_types --- smmap/mman.py | 3 +-- smmap/util.py | 11 ++--------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/smmap/mman.py b/smmap/mman.py index 9df69ed..d7dfe6d 100644 --- a/smmap/mman.py +++ b/smmap/mman.py @@ -4,7 +4,6 @@ MapRegion, MapRegionList, is_64_bit, - string_types, buffer, ) @@ -227,7 +226,7 @@ def fd(self): **Note:** it is not required to be valid anymore :raise ValueError: if the mapping was not created by a file descriptor""" - if isinstance(self._rlist.path_or_fd(), string_types()): + if isinstance(self._rlist.path_or_fd(), str): raise ValueError("File descriptor queried although mapping was generated from path") # END handle type return self._rlist.path_or_fd() diff --git a/smmap/util.py b/smmap/util.py index 3d73291..4e713f8 100644 --- a/smmap/util.py +++ b/smmap/util.py @@ -22,13 +22,6 @@ def buffer(obj, offset, size): # return obj[offset:offset + size] -def string_types(): - if sys.version_info[0] >= 3: - return str - else: - return basestring # noqa: F821 - - def align_to_mmap(num, round_up): """ Align the given integer number to the closest page offset, which usually is 4096 bytes. @@ -146,7 +139,7 @@ def __init__(self, path_or_fd, ofs, size, flags=0): self._size = len(self._mf) finally: - if isinstance(path_or_fd, string_types()): + if isinstance(path_or_fd, str): os.close(fd) # END only close it if we opened it # END close file handle @@ -229,7 +222,7 @@ def path_or_fd(self): def file_size(self): """:return: size of file we manager""" if self._file_size is None: - if isinstance(self._path_or_fd, string_types()): + if isinstance(self._path_or_fd, str): self._file_size = os.stat(self._path_or_fd).st_size else: self._file_size = os.fstat(self._path_or_fd).st_size From da0a610bd9a050239299d37ce40d4c01d5cacc81 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 23 Jan 2021 21:15:53 -0600 Subject: [PATCH 13/40] Remove buffer --- smmap/mman.py | 3 +-- smmap/util.py | 13 +------------ 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/smmap/mman.py b/smmap/mman.py index d7dfe6d..19c3a02 100644 --- a/smmap/mman.py +++ b/smmap/mman.py @@ -4,7 +4,6 @@ MapRegion, MapRegionList, is_64_bit, - buffer, ) import sys @@ -160,7 +159,7 @@ def buffer(self): **Note:** buffers should not be cached passed the duration of your access as it will prevent resources from being freed even though they might not be accounted for anymore !""" - return buffer(self._region.buffer(), self._ofs, self._size) + return memoryview(self._region.buffer())[self._ofs:self._ofs+self._size] def map(self): """ diff --git a/smmap/util.py b/smmap/util.py index 4e713f8..72b2394 100644 --- a/smmap/util.py +++ b/smmap/util.py @@ -5,22 +5,11 @@ from mmap import mmap, ACCESS_READ from mmap import ALLOCATIONGRANULARITY -__all__ = ["align_to_mmap", "is_64_bit", "buffer", +__all__ = ["align_to_mmap", "is_64_bit", "MapWindow", "MapRegion", "MapRegionList", "ALLOCATIONGRANULARITY"] #{ Utilities -try: - # Python 2 - buffer = buffer -except NameError: - # Python 3 has no `buffer`; only `memoryview` - def buffer(obj, offset, size): - # Actually, for gitpython this is fastest ... . - return memoryview(obj)[offset:offset+size] - # doing it directly is much faster ! - # return obj[offset:offset + size] - def align_to_mmap(num, round_up): """ From 0e59cc906065c36e2605f9b76d797d5227f84460 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 23 Jan 2021 21:20:13 -0600 Subject: [PATCH 14/40] Update Python requirement to >= 3.4 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index f0c67ad..c4a9f4e 100755 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ license="BSD", packages=find_packages(), zip_safe=True, - python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", + python_requires=">=3.4", classifiers=[ # Picked from # http://pypi.python.org/pypi?:action=list_classifiers From ee01c2e6f661b76ddde94cdfa02176dc573cd95b Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 23 Jan 2021 21:21:16 -0600 Subject: [PATCH 15/40] Update setup classifiers to be only Python 3 --- setup.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setup.py b/setup.py index c4a9f4e..d2c6a21 100755 --- a/setup.py +++ b/setup.py @@ -45,12 +45,11 @@ "Operating System :: Microsoft :: Windows", "Operating System :: MacOS :: MacOS X", "Programming Language :: Python", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3 :: Only", ], long_description=long_description, long_description_content_type='text/markdown', From 9478708e6663fabbeb8464d6a943054e8927c2ce Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 23 Jan 2021 21:25:14 -0600 Subject: [PATCH 16/40] Update Python prerequisite in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fcb9217..9e6ea42 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ For performance critical 64 bit applications, a simplified version of memory map ## Prerequisites -* Python 2.7 or 3.4+ +* Python 3.4+ * OSX, Windows or Linux The package was tested on all of the previously mentioned configurations. From cc7d2b8516a9bc23d7b3ac599395b80461b738cd Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 23 Jan 2021 21:26:22 -0600 Subject: [PATCH 17/40] Remove information about Python < 2.5 in README --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 9e6ea42..9707e50 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,6 @@ Smmap wraps an interface around mmap and tracks the mapped files as well as the To allow processing large files even on 32 bit systems, it allows only portions of the file to be mapped. Once the user reads beyond the mapped region, smmap will automatically map the next required region, unloading unused regions using a LRU algorithm. -The interface also works around the missing offset parameter in python implementations up to python 2.5. - Although the library can be used most efficiently with its native interface, a Buffer implementation is provided to hide these details behind a simple string-like interface. For performance critical 64 bit applications, a simplified version of memory mapping is provided which always maps the whole file, but still provides the benefit of unloading unused mappings on demand. From 3646d133e3be66ce1297560542f43b547d47e318 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 23 Jan 2021 21:27:08 -0600 Subject: [PATCH 18/40] Remove Python 2.7 from tox configuration --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index d1f558b..8a5ce02 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ # and then run "tox" from this directory. [tox] -envlist = flake8, py27, py34, py35, py36 +envlist = flake8, py34, py35, py36 [testenv] commands = nosetests {posargs:--with-coverage --cover-package=smmap} From d20070534a443543fabfae24e249921821a0f991 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 23 Jan 2021 21:29:39 -0600 Subject: [PATCH 19/40] Update Python prerequisite in documentation --- doc/source/intro.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/intro.rst b/doc/source/intro.rst index 8f7cf3c..63480fc 100644 --- a/doc/source/intro.rst +++ b/doc/source/intro.rst @@ -22,7 +22,7 @@ For performance critical 64 bit applications, a simplified version of memory map ############# Prerequisites ############# -* Python 2.7 or 3.4+ +* Python 3.4+ * OSX, Windows or Linux The package was tested on all of the previously mentioned configurations. From 72d47eb937f22de5c71abe5630af6c1dc999bbe0 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 23 Jan 2021 21:30:19 -0600 Subject: [PATCH 20/40] Remove information about Python < 2.5 in documentation --- doc/source/intro.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/doc/source/intro.rst b/doc/source/intro.rst index 63480fc..a4c82d2 100644 --- a/doc/source/intro.rst +++ b/doc/source/intro.rst @@ -13,8 +13,6 @@ Smmap wraps an interface around mmap and tracks the mapped files as well as the To allow processing large files even on 32 bit systems, it allows only portions of the file to be mapped. Once the user reads beyond the mapped region, smmap will automatically map the next required region, unloading unused regions using a LRU algorithm. -The interface also works around the missing offset parameter in python implementations up to python 2.5. - Although the library can be used most efficiently with its native interface, a Buffer implementation is provided to hide these details behind a simple string-like interface. For performance critical 64 bit applications, a simplified version of memory mapping is provided which always maps the whole file, but still provides the benefit of unloading unused mappings on demand. From 812ad85acd3eda5b1d6dc5aa837d390a72ce1538 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 23 Jan 2021 21:32:29 -0600 Subject: [PATCH 21/40] Replace codecs.open with open --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index d2c6a21..46eecdd 100755 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ #!/usr/bin/env python import os -import codecs + try: from setuptools import setup, find_packages except ImportError: @@ -11,7 +11,7 @@ import smmap if os.path.exists("README.md"): - long_description = codecs.open('README.md', "r", "utf-8").read().replace('\r\n', '\n') + long_description = open('README.md', "r", encoding="utf-8").read().replace('\r\n', '\n') else: long_description = "See https://github.com/gitpython-developers/smmap" From 960cbc5b01aafe4d0b1706ab236d40d1125e05ac Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 23 Jan 2021 21:42:41 -0600 Subject: [PATCH 22/40] Remove buffer usage from TestTutorial.test_example --- smmap/test/test_tutorial.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/smmap/test/test_tutorial.py b/smmap/test/test_tutorial.py index b03db9b..31c272a 100644 --- a/smmap/test/test_tutorial.py +++ b/smmap/test/test_tutorial.py @@ -41,12 +41,6 @@ def test_example(self): c.buffer()[1:10] # first 9 bytes c.buffer()[c.size() - 1] # last byte - # its recommended not to create big slices when feeding the buffer - # into consumers (e.g. struct or zlib). - # Instead, either give the buffer directly, or use pythons buffer command. - from smmap.util import buffer - buffer(c.buffer(), 1, 9) # first 9 bytes without copying them - # you can query absolute offsets, and check whether an offset is included # in the cursor's data. assert c.ofs_begin() < c.ofs_end() From 230725f81e0298d110f8b136e1a6a19c9105d961 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 23 Jan 2021 21:45:48 -0600 Subject: [PATCH 23/40] Remove Development Status classifier comments in setup.py --- setup.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/setup.py b/setup.py index 46eecdd..755fdda 100755 --- a/setup.py +++ b/setup.py @@ -28,15 +28,7 @@ zip_safe=True, python_requires=">=3.4", classifiers=[ - # Picked from - # http://pypi.python.org/pypi?:action=list_classifiers - #"Development Status :: 1 - Planning", - #"Development Status :: 2 - Pre-Alpha", - #"Development Status :: 3 - Alpha", - # "Development Status :: 4 - Beta", "Development Status :: 5 - Production/Stable", - #"Development Status :: 6 - Mature", - #"Development Status :: 7 - Inactive", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", From 710fb1994adda7215261d240e6332c2a10bfff6a Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 23 Jan 2021 21:48:38 -0600 Subject: [PATCH 24/40] Remove Travis CI configuration file --- .travis.yml | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 50e5b97..0000000 --- a/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -# NOT USED, just for reference. See github actions for CI configuration -language: python -python: - - 2.7 - - 3.4 - - 3.5 - - 3.6 -install: - - pip install coveralls -script: - - ulimit -n 48 - - ulimit -n - - nosetests --with-coverage -after_success: - - coveralls From 724540cd82856e850ab9175775db8caa1ea42ec7 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 23 Jan 2021 21:49:29 -0600 Subject: [PATCH 25/40] Remove AppVeyor configuration file --- .appveyor.yml | 50 -------------------------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 .appveyor.yml diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index 2090a05..0000000 --- a/.appveyor.yml +++ /dev/null @@ -1,50 +0,0 @@ -# NOT USED, just for reference. See github actions for CI configuration -# CI on Windows via appveyor -environment: - - matrix: - ## MINGW - # - - PYTHON: "C:\\Python27" - PYTHON_VERSION: "2.7" - - PYTHON: "C:\\Python34-x64" - PYTHON_VERSION: "3.4" - - PYTHON: "C:\\Python35-x64" - PYTHON_VERSION: "3.5" - - PYTHON: "C:\\Miniconda35-x64" - PYTHON_VERSION: "3.5" - IS_CONDA: "yes" - -install: - - set PATH=%PYTHON%;%PYTHON%\Scripts;%PATH% - - ## Print configuration for debugging. - # - - | - echo %PATH% - uname -a - where python pip pip2 pip3 pip34 - python --version - python -c "import struct; print(struct.calcsize('P') * 8)" - - - IF "%IS_CONDA%"=="yes" ( - conda info -a & - conda install --yes --quiet pip - ) - - pip install nose wheel coveralls - - ## For commits performed with the default user. - - | - git config --global user.email "travis@ci.com" - git config --global user.name "Travis Runner" - - - pip install -e . - -build: false - -test_script: - - IF "%PYTHON_VERSION%"=="3.5" ( - nosetests -v --with-coverage - ) ELSE ( - nosetests -v - ) From 18b499e213b1fd81c4cf5e5340a5af6302f26bef Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 23 Jan 2021 21:49:54 -0600 Subject: [PATCH 26/40] Remove MemoryManagerError and RegionCollectionError --- smmap/exc.py | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 smmap/exc.py diff --git a/smmap/exc.py b/smmap/exc.py deleted file mode 100644 index 1176645..0000000 --- a/smmap/exc.py +++ /dev/null @@ -1,11 +0,0 @@ -"""Module with system exceptions""" - - -class MemoryManagerError(Exception): - - """Base class for all exceptions thrown by the memory manager""" - - -class RegionCollectionError(MemoryManagerError): - - """Thrown if a memory region could not be collected, or if no region for collection was found""" From fe64cbd88c37e0a5fb52709790b44cba7a5f5fd8 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 23 Jan 2021 21:52:16 -0600 Subject: [PATCH 27/40] Remove Exceptions documentation --- doc/source/api.rst | 8 -------- 1 file changed, 8 deletions(-) diff --git a/doc/source/api.rst b/doc/source/api.rst index cddd268..2e2dac4 100644 --- a/doc/source/api.rst +++ b/doc/source/api.rst @@ -20,14 +20,6 @@ Buffers :members: :undoc-members: -********** -Exceptions -********** - -.. automodule:: smmap.exc - :members: - :undoc-members: - ********* Utilities ********* From 95431a22d559c17e96ed2ca094247f0d227a544c Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 23 Jan 2021 21:55:43 -0600 Subject: [PATCH 28/40] Add Python 3.9 to GitHub Actions workflow --- .github/workflows/pythonpackage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 4f06a18..e070c68 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.5, 3.6, 3.7, 3.8] + python-version: [3.5, 3.6, 3.7, 3.8, 3.9] steps: - uses: actions/checkout@v2 From 8fda48842fb422025b498cd21644b7a480593cc2 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 23 Jan 2021 21:57:21 -0600 Subject: [PATCH 29/40] Add Python 3.7, 3.8, and 3.9 to setup classifiers --- setup.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setup.py b/setup.py index 755fdda..039f302 100755 --- a/setup.py +++ b/setup.py @@ -41,6 +41,9 @@ "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3 :: Only", ], long_description=long_description, From c64ac58cf768d5416fcc3e306fa72843089313a2 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 23 Jan 2021 22:00:26 -0600 Subject: [PATCH 30/40] Drop support for Python 3.4 --- README.md | 2 +- doc/source/intro.rst | 2 +- setup.py | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9707e50..412dfd9 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ For performance critical 64 bit applications, a simplified version of memory map ## Prerequisites -* Python 3.4+ +* Python 3.5+ * OSX, Windows or Linux The package was tested on all of the previously mentioned configurations. diff --git a/doc/source/intro.rst b/doc/source/intro.rst index a4c82d2..e458d53 100644 --- a/doc/source/intro.rst +++ b/doc/source/intro.rst @@ -20,7 +20,7 @@ For performance critical 64 bit applications, a simplified version of memory map ############# Prerequisites ############# -* Python 3.4+ +* Python 3.5+ * OSX, Windows or Linux The package was tested on all of the previously mentioned configurations. diff --git a/setup.py b/setup.py index 039f302..0718c15 100755 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ license="BSD", packages=find_packages(), zip_safe=True, - python_requires=">=3.4", + python_requires=">=3.5", classifiers=[ "Development Status :: 5 - Production/Stable", "Environment :: Console", @@ -38,7 +38,6 @@ "Operating System :: MacOS :: MacOS X", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", From 689ab6fb040e218ca16e4c0aa4944e608649df04 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 23 Jan 2021 22:02:43 -0600 Subject: [PATCH 31/40] Add Python 3.7, 3.8, and 3.9 to tox configuration --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 8a5ce02..9e8dd22 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ # and then run "tox" from this directory. [tox] -envlist = flake8, py34, py35, py36 +envlist = flake8, py34, py35, py36, py37, py38, py39 [testenv] commands = nosetests {posargs:--with-coverage --cover-package=smmap} From ed11471388a3c4dc4756605ec76650e7ad994eb9 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 23 Jan 2021 22:03:00 -0600 Subject: [PATCH 32/40] Remove Python 3.4 from tox configuration --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 9e8dd22..e33f567 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ # and then run "tox" from this directory. [tox] -envlist = flake8, py34, py35, py36, py37, py38, py39 +envlist = flake8, py35, py36, py37, py38, py39 [testenv] commands = nosetests {posargs:--with-coverage --cover-package=smmap} From e762f17a0bc479d52d4f9cda46cec3f98c89e812 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 23 Jan 2021 22:06:54 -0600 Subject: [PATCH 33/40] Remove unused pyvers variable in SlidingWindowMapBuffer.__getslice__ --- smmap/buf.py | 1 - 1 file changed, 1 deletion(-) diff --git a/smmap/buf.py b/smmap/buf.py index 18766da..af8496e 100644 --- a/smmap/buf.py +++ b/smmap/buf.py @@ -80,7 +80,6 @@ def __getslice__(self, i, j): ofs = i # It's fastest to keep tokens and join later, especially in py3, which was 7 times slower # in the previous iteration of this code - pyvers = sys.version_info[:2] md = list() while l: c.use_region(ofs, l) From 30e93fee57286afae25c28a97ba65a9770f9a729 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 23 Jan 2021 22:17:37 -0600 Subject: [PATCH 34/40] v4.0.0 --- doc/source/changes.rst | 8 ++++++++ smmap/__init__.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/source/changes.rst b/doc/source/changes.rst index bc0b1b6..ff5ca99 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -2,6 +2,14 @@ Changelog ######### +****** +v4.0.0 +****** + +- Dropped support for Python 2.7 and 3.4 +- Added support for Python 3.7, 3.8, and 3.9 +- Removed unused exc.MemoryManagerError and exc.RegionCollectionError + ****** v3.0.5 ****** diff --git a/smmap/__init__.py b/smmap/__init__.py index abc09d9..45f8abe 100644 --- a/smmap/__init__.py +++ b/smmap/__init__.py @@ -3,7 +3,7 @@ __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/smmap" -version_info = (3, 0, 5) +version_info = (4, 0, 0) __version__ = '.'.join(str(i) for i in version_info) # make everything available in root package for convenience From 3affd88c09635f0cad0f268c5ca22162c1aa0aa8 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 14 Oct 2021 17:19:42 +0300 Subject: [PATCH 35/40] Drop support for EOL Python 3.5 --- .github/workflows/pythonpackage.yml | 2 +- README.md | 2 +- doc/source/intro.rst | 2 +- setup.py | 3 +-- tox.ini | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index e070c68..3f1455d 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.5, 3.6, 3.7, 3.8, 3.9] + python-version: ["3.6", "3.7", "3.8", "3.9"] steps: - uses: actions/checkout@v2 diff --git a/README.md b/README.md index 412dfd9..f083dd0 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ For performance critical 64 bit applications, a simplified version of memory map ## Prerequisites -* Python 3.5+ +* Python 3.6+ * OSX, Windows or Linux The package was tested on all of the previously mentioned configurations. diff --git a/doc/source/intro.rst b/doc/source/intro.rst index e458d53..3489b04 100644 --- a/doc/source/intro.rst +++ b/doc/source/intro.rst @@ -20,7 +20,7 @@ For performance critical 64 bit applications, a simplified version of memory map ############# Prerequisites ############# -* Python 3.5+ +* Python 3.6+ * OSX, Windows or Linux The package was tested on all of the previously mentioned configurations. diff --git a/setup.py b/setup.py index 0718c15..8333794 100755 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ license="BSD", packages=find_packages(), zip_safe=True, - python_requires=">=3.5", + python_requires=">=3.6", classifiers=[ "Development Status :: 5 - Production/Stable", "Environment :: Console", @@ -38,7 +38,6 @@ "Operating System :: MacOS :: MacOS X", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", diff --git a/tox.ini b/tox.ini index e33f567..54f328d 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ # and then run "tox" from this directory. [tox] -envlist = flake8, py35, py36, py37, py38, py39 +envlist = flake8, py36, py37, py38, py39 [testenv] commands = nosetests {posargs:--with-coverage --cover-package=smmap} From 19772d24cd63a0b5392084c07cb6a4e8a2ac86ae Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 14 Oct 2021 17:06:35 +0300 Subject: [PATCH 36/40] Add support for Python 3.10 --- .github/workflows/pythonpackage.yml | 2 +- setup.py | 1 + tox.ini | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 3f1455d..e8726a2 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.6", "3.7", "3.8", "3.9"] + python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"] steps: - uses: actions/checkout@v2 diff --git a/setup.py b/setup.py index 8333794..c25e445 100755 --- a/setup.py +++ b/setup.py @@ -42,6 +42,7 @@ "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3 :: Only", ], long_description=long_description, diff --git a/tox.ini b/tox.ini index 54f328d..6587dce 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ # and then run "tox" from this directory. [tox] -envlist = flake8, py36, py37, py38, py39 +envlist = flake8, py36, py37, py38, py39, py310 [testenv] commands = nosetests {posargs:--with-coverage --cover-package=smmap} From ddc4b9f412769915b77d857324ad165ef488499b Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 14 Oct 2021 17:14:27 +0300 Subject: [PATCH 37/40] Switch from abandoned nose to pytest to support Python 3.10 --- .github/workflows/pythonpackage.yml | 8 ++++---- Makefile | 6 +++--- setup.py | 2 -- tox.ini | 6 +++--- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index e8726a2..e6e68ff 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -22,7 +22,7 @@ jobs: with: fetch-depth: 1000 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -35,9 +35,9 @@ jobs: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with nose + - name: Test run: | - pip install nose + pip install pytest ulimit -n 48 ulimit -n - nosetests -v + pytest -v diff --git a/Makefile b/Makefile index 593a758..9145cab 100644 --- a/Makefile +++ b/Makefile @@ -24,11 +24,11 @@ clean-files: clean: clean-files clean-docs test: - nosetests + pytest coverage: - nosetests --with-coverage --cover-package=smmap - + pytest --cov smmap --cov-report xml + build: ./setup.py build diff --git a/setup.py b/setup.py index c25e445..56e560a 100755 --- a/setup.py +++ b/setup.py @@ -47,6 +47,4 @@ ], long_description=long_description, long_description_content_type='text/markdown', - tests_require=('nose', 'nosexcover'), - test_suite='nose.collector' ) diff --git a/tox.ini b/tox.ini index 6587dce..c34ab02 100644 --- a/tox.ini +++ b/tox.ini @@ -7,10 +7,10 @@ envlist = flake8, py36, py37, py38, py39, py310 [testenv] -commands = nosetests {posargs:--with-coverage --cover-package=smmap} +commands = {envpython} -m pytest --cov smmap --cov-report xml {posargs} deps = - nose - nosexcover + pytest + pytest-cov [testenv:flake8] commands = flake8 {posargs} From 1bda3b6a5ee6e383e9fd3316caa2d8181e53bf45 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 14 Oct 2021 17:18:23 +0300 Subject: [PATCH 38/40] Universal wheels are for code expected to work on both Python 2 and 3 --- setup.cfg | 3 --- 1 file changed, 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index 83a51c4..38c535b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,2 @@ -[bdist_wheel] -universal = 1 - [flake8] exclude = .tox,.venv,build,dist,doc From f0b322afcf6934501bade7776c5331619485a06c Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 14 Oct 2021 17:27:17 +0300 Subject: [PATCH 39/40] Upgrade Python syntax with pyupgrade --py36-plus --- doc/source/conf.py | 9 ++++----- setup.py | 2 +- smmap/buf.py | 2 +- smmap/mman.py | 6 +++--- smmap/test/lib.py | 2 +- smmap/test/test_buf.py | 2 -- smmap/test/test_mman.py | 2 -- smmap/util.py | 6 +++--- 8 files changed, 13 insertions(+), 18 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 5aa28e2..55dfc5c 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # smmap documentation build configuration file, created by # sphinx-quickstart on Wed Jun 8 15:14:25 2011. @@ -38,8 +37,8 @@ master_doc = 'index' # General information about the project. -project = u'smmap' -copyright = u'2011, Sebastian Thiel' +project = 'smmap' +copyright = '2011, Sebastian Thiel' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -173,8 +172,8 @@ # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ('index', 'smmap.tex', u'smmap Documentation', - u'Sebastian Thiel', 'manual'), + ('index', 'smmap.tex', 'smmap Documentation', + 'Sebastian Thiel', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of diff --git a/setup.py b/setup.py index 56e560a..9ab8a7f 100755 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ import smmap if os.path.exists("README.md"): - long_description = open('README.md', "r", encoding="utf-8").read().replace('\r\n', '\n') + long_description = open('README.md', encoding="utf-8").read().replace('\r\n', '\n') else: long_description = "See https://github.com/gitpython-developers/smmap" diff --git a/smmap/buf.py b/smmap/buf.py index af8496e..795e0fd 100644 --- a/smmap/buf.py +++ b/smmap/buf.py @@ -4,7 +4,7 @@ __all__ = ["SlidingWindowMapBuffer"] -class SlidingWindowMapBuffer(object): +class SlidingWindowMapBuffer: """A buffer like object which allows direct byte-wise object and slicing into memory of a mapped file. The mapping is controlled by the provided cursor. diff --git a/smmap/mman.py b/smmap/mman.py index 19c3a02..1de7d9e 100644 --- a/smmap/mman.py +++ b/smmap/mman.py @@ -15,7 +15,7 @@ #}END utilities -class WindowCursor(object): +class WindowCursor: """ Pointer into the mapped region of the memory manager, keeping the map @@ -233,7 +233,7 @@ def fd(self): #} END interface -class StaticWindowMapManager(object): +class StaticWindowMapManager: """Provides a manager which will produce single size cursors that are allowed to always map the whole file. @@ -486,7 +486,7 @@ class SlidingWindowMapManager(StaticWindowMapManager): def __init__(self, window_size=-1, max_memory_size=0, max_open_handles=sys.maxsize): """Adjusts the default window size to -1""" - super(SlidingWindowMapManager, self).__init__(window_size, max_memory_size, max_open_handles) + super().__init__(window_size, max_memory_size, max_open_handles) def _obtain_region(self, a, offset, size, flags, is_recursive): # bisect to find an existing region. The c++ implementation cannot diff --git a/smmap/test/lib.py b/smmap/test/lib.py index f86c0c6..ca91ee9 100644 --- a/smmap/test/lib.py +++ b/smmap/test/lib.py @@ -8,7 +8,7 @@ #{ Utilities -class FileCreator(object): +class FileCreator: """A instance which creates a temporary file with a prefix and a given size and provides this info to the user. diff --git a/smmap/test/test_buf.py b/smmap/test/test_buf.py index 3b6009e..17555af 100644 --- a/smmap/test/test_buf.py +++ b/smmap/test/test_buf.py @@ -1,5 +1,3 @@ -from __future__ import print_function - from .lib import TestBase, FileCreator from smmap.mman import ( diff --git a/smmap/test/test_mman.py b/smmap/test/test_mman.py index 96bc355..d88316b 100644 --- a/smmap/test/test_mman.py +++ b/smmap/test/test_mman.py @@ -1,5 +1,3 @@ -from __future__ import print_function - from .lib import TestBase, FileCreator from smmap.mman import ( diff --git a/smmap/util.py b/smmap/util.py index 72b2394..cf027af 100644 --- a/smmap/util.py +++ b/smmap/util.py @@ -34,7 +34,7 @@ def is_64_bit(): #{ Utility Classes -class MapWindow(object): +class MapWindow: """Utility type which is used to snap windows towards each other, and to adjust their size""" __slots__ = ( @@ -80,7 +80,7 @@ def extend_right_to(self, window, max_size): self.size = min(self.size + (window.ofs - self.ofs_end()), max_size) -class MapRegion(object): +class MapRegion: """Defines a mapped region of memory, aligned to pagesizes @@ -198,7 +198,7 @@ class MapRegionList(list): ) def __new__(cls, path): - return super(MapRegionList, cls).__new__(cls) + return super().__new__(cls) def __init__(self, path_or_fd): self._path_or_fd = path_or_fd From db8810096503dd8a1f5a021ff39be907417f90a7 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Fri, 15 Oct 2021 21:18:55 +0800 Subject: [PATCH 40/40] bump major version and update changelog --- doc/source/changes.rst | 7 +++++++ smmap/__init__.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/source/changes.rst b/doc/source/changes.rst index ff5ca99..d0623b5 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -2,6 +2,13 @@ Changelog ######### +****** +v5.0.0 +****** + +- Dropped support 3.5 +- Added support for Python 3.10 + ****** v4.0.0 ****** diff --git a/smmap/__init__.py b/smmap/__init__.py index 45f8abe..696401c 100644 --- a/smmap/__init__.py +++ b/smmap/__init__.py @@ -3,7 +3,7 @@ __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/smmap" -version_info = (4, 0, 0) +version_info = (5, 0, 0) __version__ = '.'.join(str(i) for i in version_info) # make everything available in root package for convenience