From 94df05e19fa2200edf6316a810b25719794a899a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 4 Feb 2025 00:06:01 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.0.1 → v5.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.0.1...v5.0.0) - [github.com/jorisroovers/gitlint: v0.15.1 → v0.19.1](https://github.com/jorisroovers/gitlint/compare/v0.15.1...v0.19.1) - [github.com/pycqa/isort: 5.10.1 → 6.0.0](https://github.com/pycqa/isort/compare/5.10.1...6.0.0) - https://github.com/ambv/black → https://github.com/psf/black - [github.com/psf/black: 21.9b0 → 25.1.0](https://github.com/psf/black/compare/21.9b0...25.1.0) - https://gitlab.com/pycqa/flake8 → https://github.com/PyCQA/flake8 - [github.com/PyCQA/flake8: 3.9.2 → 7.1.1](https://github.com/PyCQA/flake8/compare/3.9.2...7.1.1) - [github.com/pycqa/bandit: 1.7.0 → 1.8.2](https://github.com/pycqa/bandit/compare/1.7.0...1.8.2) - [github.com/pycqa/pydocstyle: 6.1.1 → 6.3.0](https://github.com/pycqa/pydocstyle/compare/6.1.1...6.3.0) - [github.com/btford/write-good: v1.0.4 → v1.0.8](https://github.com/btford/write-good/compare/v1.0.4...v1.0.8) --- .pre-commit-config.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4bdcb02..9adc393 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,7 @@ default_language_version: repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.0.1 + rev: v5.0.0 hooks: - id: check-executables-have-shebangs - id: fix-encoding-pragma @@ -19,39 +19,39 @@ repos: - id: trailing-whitespace - repo: https://github.com/jorisroovers/gitlint - rev: v0.15.1 + rev: v0.19.1 hooks: - id: gitlint - repo: https://github.com/pycqa/isort - rev: 5.10.1 + rev: 6.0.0 hooks: - id: isort - - repo: https://github.com/ambv/black - rev: 21.9b0 + - repo: https://github.com/psf/black + rev: 25.1.0 hooks: - id: black - - repo: https://gitlab.com/pycqa/flake8 - rev: 3.9.2 + - repo: https://github.com/PyCQA/flake8 + rev: 7.1.1 hooks: - id: flake8 - repo: https://github.com/pycqa/bandit - rev: 1.7.0 + rev: 1.8.2 hooks: - id: bandit # Bandit does not need to run on test code exclude: tests/* - repo: https://github.com/pycqa/pydocstyle - rev: 6.1.1 + rev: 6.3.0 hooks: - id: pydocstyle - repo: https://github.com/btford/write-good - rev: v1.0.4 + rev: v1.0.8 hooks: - id: write-good files: "\\.(rst|md|markdown|mdown|mkdn)$" From 8b23ab217999ea6b6f4c9db785f80b5f0e1bc516 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 4 Feb 2025 00:07:01 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .bumpversion.cfg | 4 ++-- .gitignore | 2 +- README.md | 4 ++-- binder/postBuild | 2 +- binder/runtime.txt | 2 +- docs/Makefile | 2 +- docs/source/api.rst | 14 +++++++------- docs/source/index.rst | 2 +- setup.cfg | 6 +++--- src/structuregraph_helpers/_hasher.py | 5 +++-- src/structuregraph_helpers/analysis.py | 1 + src/structuregraph_helpers/cli.py | 1 + src/structuregraph_helpers/create.py | 1 + src/structuregraph_helpers/delete.py | 1 + src/structuregraph_helpers/hash.py | 1 + src/structuregraph_helpers/plotting.py | 1 + src/structuregraph_helpers/subgraph.py | 1 + src/structuregraph_helpers/utils.py | 1 + tests/conftest.py | 1 + tests/test_analysis.py | 1 + tests/test_cli.py | 1 + tests/test_create.py | 1 + tests/test_delete.py | 1 + tests/test_hash.py | 1 + tests/test_subgraph.py | 1 + 25 files changed, 37 insertions(+), 21 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 6517964..46d9fd6 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -3,7 +3,7 @@ current_version = 0.0.10-dev commit = True tag = False parse = (?P\d+)\.(?P\d+)\.(?P\d+)(?:-(?P[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+(?P[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))? -serialize = +serialize = {major}.{minor}.{patch}-{release}+{build} {major}.{minor}.{patch}+{build} {major}.{minor}.{patch}-{release} @@ -12,7 +12,7 @@ serialize = [bumpversion:part:release] optional_value = production first_value = dev -values = +values = dev production diff --git a/.gitignore b/.gitignore index 8260209..8807041 100644 --- a/.gitignore +++ b/.gitignore @@ -389,4 +389,4 @@ $RECYCLE.BIN/ # End of https://www.toptal.com/developers/gitignore/api/linux,macos,python,pycharm,windows,vim,visualstudiocode,jupyternotebooks scratch/ -dev/ \ No newline at end of file +dev/ diff --git a/README.md b/README.md index c52772c..d2fde3a 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Tests - Cookiecutter template from @cthoyt + Cookiecutter template from @cthoyt PyPI @@ -116,7 +116,7 @@ This package was created with [@audreyfeldroy](https://github.com/audreyfeldroy)
See developer instrutions - + The final section of the README is for if you want to get involved by making a code contribution. ### ❓ Testing diff --git a/binder/postBuild b/binder/postBuild index fdf02c8..f6fad23 100644 --- a/binder/postBuild +++ b/binder/postBuild @@ -1 +1 @@ -python -m pip install --upgrade . \ No newline at end of file +python -m pip install --upgrade . diff --git a/binder/runtime.txt b/binder/runtime.txt index 3cd3102..9850e86 100644 --- a/binder/runtime.txt +++ b/binder/runtime.txt @@ -1 +1 @@ -python-3.8 \ No newline at end of file +python-3.8 diff --git a/docs/Makefile b/docs/Makefile index def8400..521a2d0 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -16,4 +16,4 @@ help: # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/source/api.rst b/docs/source/api.rst index 104f9a0..7596ea9 100644 --- a/docs/source/api.rst +++ b/docs/source/api.rst @@ -33,10 +33,10 @@ Hash -Logging +Logging --------- -structuregraph_helpers uses the `loguru `_ for logging. +structuregraph_helpers uses the `loguru `_ for logging. By default, logging from structuregraph_helpers is disabled to not interfere with your logs. However, you can easily customize the logging: @@ -46,17 +46,17 @@ However, you can easily customize the logging: import sys from loguru import logger - # enable structuregraph_helpers logging + # enable structuregraph_helpers logging logger.enable("structuregraph_helpers") - + # define the logging level LEVEL = "INFO || DEBUG || WARNING || etc." # set the handler # for logging to stdout - logger.add(sys.stdout, level=LEVEL) + logger.add(sys.stdout, level=LEVEL) # or for logging to a file - logger.add("my_log_file.log", level=LEVEL, enqueue=True) + logger.add("my_log_file.log", level=LEVEL, enqueue=True) In many cases, however, you might find it convenient to simply call :py:meth:`~structuregraph_helpers.utils.enable_logging` @@ -67,4 +67,4 @@ In many cases, however, you might find it convenient to simply call :py:meth:`~s enable_logging() -which will enable logging with sane defaults (i.e. logging to ``stderr`` for ``INFO`` and ``WARNING`` levels). \ No newline at end of file +which will enable logging with sane defaults (i.e. logging to ``stderr`` for ``INFO`` and ``WARNING`` levels). diff --git a/docs/source/index.rst b/docs/source/index.rst index ad0a5aa..fc653b5 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -2,7 +2,7 @@ structuregraph_helpers |release| Documentation ============================================== :code:`structuregraph_helpers` is a collection of helper functions -that can be useful when working with :code:`pymatgen`'s :code:`StructureGraph`. +that can be useful when working with :code:`pymatgen`'s :code:`StructureGraph`. .. toctree:: :maxdepth: 2 diff --git a/setup.cfg b/setup.cfg index 644a6a6..0d43767 100644 --- a/setup.cfg +++ b/setup.cfg @@ -70,9 +70,9 @@ package_dir = where = src [options.extras_require] -plotting = +plotting = plotly -lint = +lint = isort black flake8 @@ -168,4 +168,4 @@ application-import-names = structuregraph_helpers tests per-file-ignores = - tests/*.py:DAR101, D205, D100, DAR101, DAR201, D209, D103 \ No newline at end of file + tests/*.py:DAR101, D205, D100, DAR101, DAR201, D209, D103 diff --git a/src/structuregraph_helpers/_hasher.py b/src/structuregraph_helpers/_hasher.py index 34cc209..56465ae 100644 --- a/src/structuregraph_helpers/_hasher.py +++ b/src/structuregraph_helpers/_hasher.py @@ -1,7 +1,8 @@ +# -*- coding: utf-8 -*- """ -Code below is taken from networkx. +Code below is taken from networkx. -License: +License: NetworkX is distributed with the 3-clause BSD license. diff --git a/src/structuregraph_helpers/analysis.py b/src/structuregraph_helpers/analysis.py index 13bb427..ca468f4 100644 --- a/src/structuregraph_helpers/analysis.py +++ b/src/structuregraph_helpers/analysis.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """Helpers for analysing structure graphs.""" from typing import List diff --git a/src/structuregraph_helpers/cli.py b/src/structuregraph_helpers/cli.py index da0cdfc..bb52f73 100644 --- a/src/structuregraph_helpers/cli.py +++ b/src/structuregraph_helpers/cli.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """Command-line interface for StructureGraphHelpers.""" import concurrent.futures import os diff --git a/src/structuregraph_helpers/create.py b/src/structuregraph_helpers/create.py index a636fd0..57381e9 100644 --- a/src/structuregraph_helpers/create.py +++ b/src/structuregraph_helpers/create.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """Helpers for creating graphs.""" import os from typing import Iterable, Tuple diff --git a/src/structuregraph_helpers/delete.py b/src/structuregraph_helpers/delete.py index 5a40de9..e72f391 100644 --- a/src/structuregraph_helpers/delete.py +++ b/src/structuregraph_helpers/delete.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """Helpers for deleting parts of graphs.""" from collections import defaultdict from copy import deepcopy diff --git a/src/structuregraph_helpers/hash.py b/src/structuregraph_helpers/hash.py index 07c8f77..57ac577 100644 --- a/src/structuregraph_helpers/hash.py +++ b/src/structuregraph_helpers/hash.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """Create hash strings for structure graphs. Note that two LQGs of the same net (crystallographic net) diff --git a/src/structuregraph_helpers/plotting.py b/src/structuregraph_helpers/plotting.py index 524551d..9815bae 100644 --- a/src/structuregraph_helpers/plotting.py +++ b/src/structuregraph_helpers/plotting.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """Plotting helpers.""" import plotly.graph_objs as go diff --git a/src/structuregraph_helpers/subgraph.py b/src/structuregraph_helpers/subgraph.py index 45dd258..6481434 100644 --- a/src/structuregraph_helpers/subgraph.py +++ b/src/structuregraph_helpers/subgraph.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """Extract subgraphs from structure graphs.""" import warnings from collections import defaultdict diff --git a/src/structuregraph_helpers/utils.py b/src/structuregraph_helpers/utils.py index 69eeb14..0cbc147 100644 --- a/src/structuregraph_helpers/utils.py +++ b/src/structuregraph_helpers/utils.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import json import sys from typing import List diff --git a/tests/conftest.py b/tests/conftest.py index 4004533..cde0a13 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import os import pytest diff --git a/tests/test_analysis.py b/tests/test_analysis.py index d4c42d3..3c69ba9 100644 --- a/tests/test_analysis.py +++ b/tests/test_analysis.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from pymatgen.analysis.graphs import StructureGraph from structuregraph_helpers.analysis import get_cn, get_dimensionality_larsen, get_leaf_nodes diff --git a/tests/test_cli.py b/tests/test_cli.py index 7b364d0..e3d7832 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import os from click.testing import CliRunner diff --git a/tests/test_create.py b/tests/test_create.py index 57d5f0d..fea7c7a 100644 --- a/tests/test_create.py +++ b/tests/test_create.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import networkx as nx from pymatgen.analysis.graphs import StructureGraph diff --git a/tests/test_delete.py b/tests/test_delete.py index 43ce813..5b828f3 100644 --- a/tests/test_delete.py +++ b/tests/test_delete.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import networkx as nx from pymatgen.analysis.graphs import StructureGraph diff --git a/tests/test_hash.py b/tests/test_hash.py index 65568a3..e9b6124 100644 --- a/tests/test_hash.py +++ b/tests/test_hash.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from pymatgen.analysis.graphs import StructureGraph from pymatgen.transformations.standard_transformations import RotationTransformation diff --git a/tests/test_subgraph.py b/tests/test_subgraph.py index f4bec8c..0dcf457 100644 --- a/tests/test_subgraph.py +++ b/tests/test_subgraph.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import numpy as np from pymatgen.analysis.graphs import MoleculeGraph from pymatgen.core import Molecule