diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index cf4fa92..4c9263c 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ["3.7", "3.8", "3.9", "3.10"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] include: - os: ubuntu-20.04 python-version: "3.7" diff --git a/copydetect/__init__.py b/copydetect/__init__.py index 53b8df3..ee80699 100644 --- a/copydetect/__init__.py +++ b/copydetect/__init__.py @@ -1,3 +1,3 @@ -__version__ = "0.4.6" +__version__ = "0.4.7" from .detector import CopyDetector, CodeFingerprint, compare_files diff --git a/copydetect/data/__init__.py b/copydetect/data/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/copydetect/detector.py b/copydetect/detector.py index 43afc57..cfc5b48 100644 --- a/copydetect/detector.py +++ b/copydetect/detector.py @@ -7,7 +7,7 @@ import time import logging import webbrowser -import pkg_resources +import importlib.resources import io import base64 import json @@ -17,6 +17,7 @@ import matplotlib.pyplot as plt from jinja2 import Template +import copydetect.data as data_files from .utils import (filter_code, highlight_overlap, get_copied_slices, get_document_fingerprints, find_fingerprint_overlap, get_token_coverage) @@ -541,7 +542,6 @@ def generate_html_report(self, output_mode="save"): return code_list = self.get_copied_code_list() - data_dir = pkg_resources.resource_filename('copydetect', 'data/') plot_mtx = np.copy(self.similarity_matrix[:,:,0]) plot_mtx[plot_mtx == -1] = np.nan @@ -564,7 +564,9 @@ def generate_html_report(self, output_mode="save"): plt.close() # render template with jinja and save as html - with open(data_dir + "report.html", encoding="utf-8") as template_fp: + with importlib.resources.open_text( + data_files, "report.html", encoding="utf-8" + ) as template_fp: template = Template(template_fp.read()) flagged = self.similarity_matrix[:,:,0] > self.conf.display_t diff --git a/setup.py b/setup.py index d8d2cb0..fc6efc5 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ setup(name="copydetect", author="Bryson Lingenfelter", author_email="blingenfelter@nevada.unr.edu", - version="0.4.5", + version="0.4.7", description="Code plagiarism detection tool", long_description=readme, long_description_content_type="text/markdown", @@ -30,6 +30,8 @@ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3 :: Only", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent",