From 47c93f08efe80395634f11eaf0defd8526788bad Mon Sep 17 00:00:00 2001 From: Junpei Kawamoto Date: Tue, 18 Mar 2025 20:54:16 -0600 Subject: [PATCH 1/2] chore: add Poetry hooks to pre-commit configuration This commit integrates Poetry hooks (`poetry-check` and `poetry-lock`) into the pre-commit configuration. These hooks help ensure the consistency and validity of the `pyproject.toml` and lock files, improving dependency management workflows. --- .pre-commit-config.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b415ef3..a0ff9d8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -27,6 +27,11 @@ repos: - id: mypy args: [] additional_dependencies: ["numpy>=2.2", "pytest>=8.1.1", "types-networkx>=3.4.2.20250312"] + - repo: https://github.com/python-poetry/poetry + rev: "2.1.1" + hooks: + - id: poetry-check + - id: poetry-lock - repo: local hooks: - id: pytest From 4bc396f3a4f9c0789063b1b7ce7bcd26c6aba75e Mon Sep 17 00:00:00 2001 From: Junpei Kawamoto Date: Tue, 18 Mar 2025 20:58:14 -0600 Subject: [PATCH 2/2] chore: update version handling and remove redundant configuration Switched version handling to use `importlib.metadata.version` and updated Sphinx config accordingly. Removed outdated LaTeX, manual page, and Texinfo configurations from Sphinx and eliminated the hardcoded `__version__` in `rsd/__init__.py`. Updated Ruff target version to Python 3.11 for better compatibility. --- docs/source/conf.py | 124 +------------------------------------------- pyproject.toml | 5 +- rsd/__init__.py | 4 +- 3 files changed, 4 insertions(+), 129 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 67da1c6..8034176 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -14,8 +14,7 @@ # serve to show the default. from datetime import datetime - -import rsd +from importlib.metadata import version as get_version # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -67,7 +66,7 @@ # built documents. # # The full version, including alpha/beta/rc tags. -release = rsd.__version__ +release = get_version("rgmining-rsd") # The short X.Y version. version = ".".join(release.split(".")[:2]) @@ -253,122 +252,3 @@ # Output file base name for HTML help builder. htmlhelp_basename = "ReviewGraphMiningReviewSpammerDetectiondoc" - -# -- Options for LaTeX output --------------------------------------------- - -latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - # - # 'papersize': 'letterpaper', - # The font size ('10pt', '11pt' or '12pt'). - # - # 'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. - # - # 'preamble': '', - # Latex figure (float) alignment - # - # 'figure_align': 'htbp', -} - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, -# author, documentclass [howto, manual, or own class]). -latex_documents = [ - ( - master_doc, - "ReviewGraphMiningReviewSpammerDetection.tex", - "Review Graph Mining Review Spammer Detection Documentation", - "Junpei Kawamoto", - "manual", - ), -] - -# The name of an image file (relative to this directory) to place at the top of -# the title page. -# -# latex_logo = None - -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -# -# latex_use_parts = False - -# If true, show page references after internal links. -# -# latex_show_pagerefs = False - -# If true, show URL addresses after external links. -# -# latex_show_urls = False - -# Documents to append as an appendix to all manuals. -# -# latex_appendices = [] - -# It false, will not define \strong, \code, itleref, \crossref ... but only -# \sphinxstrong, ..., \sphinxtitleref, ... To help avoid clash with user added -# packages. -# -# latex_keep_old_macro_names = True - -# If false, no module index is generated. -# -# latex_domain_indices = True - - -# -- Options for manual page output --------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - (master_doc, "reviewgraphminingrsd", "Review Graph Mining Review Spammer Detection Documentation", [author], 1) -] - -# If true, show URL addresses after external links. -# -# man_show_urls = False - - -# -- Options for Texinfo output ------------------------------------------- - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - ( - master_doc, - "ReviewGraphMiningReviewSpammerDetection", - "Review Graph Mining Review Spammer Detection Documentation", - author, - "ReviewGraphMiningReviewSpammerDetection", - "One line description of project.", - "Miscellaneous", - ), -] - -# Documents to append as an appendix to all manuals. -# -# texinfo_appendices = [] - -# If false, no module index is generated. -# -# texinfo_domain_indices = True - -# How to display URL addresses: 'footnote', 'no', or 'inline'. -# -# texinfo_show_urls = 'footnote' - -# If true, do not generate a @detailmenu in the "Top" node's menu. -# -# texinfo_no_detailmenu = False - - -# Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = {"python": ("https://docs.python.org/3", None)} - - -# -- Options for autodoc output ------------------------------------------- - -autodoc_member_order = "groupwise" -autodoc_typehints_format = "short" diff --git a/pyproject.toml b/pyproject.toml index 56ef4bf..a54ee39 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -61,7 +61,7 @@ sphinx = "^8.2.3" sphinx-rtd-theme = "^3.0.2" [tool.ruff] -target-version = "py310" +target-version = "py311" line-length = 120 [tool.pytest.ini_options] @@ -80,9 +80,6 @@ filename = "pyproject.toml" search = 'version = "{current_version}"' replace = 'version = "{new_version}"' -[[tool.bumpversion.files]] -filename = "rsd/__init__.py" - [[tool.bumpversion.files]] filename = "README.rst" diff --git a/rsd/__init__.py b/rsd/__init__.py index 7725385..6accba2 100644 --- a/rsd/__init__.py +++ b/rsd/__init__.py @@ -60,6 +60,4 @@ from rsd.graph import ReviewGraph -__version__: Final = "0.3.4" - -__all__: Final = ("ReviewGraph", "__version__") +__all__: Final = ("ReviewGraph",)