Skip to content
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
10 changes: 6 additions & 4 deletions docs/source/_ext/libsemigroups_pybind11_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ def no_doc_run(self):
# replaced when the doc is built. It should be left empty.
strings_replaced = set()

# TODO(0): I think that, if we change the order in which we bind the functions
# and class, it should be possible to remove the need for the following two type
# replacement dictionaries.

# This dictionary should be of the form "bad type" -> "good type", and
# replacements will be performed globally. Hyperlinks will be added in the
# signature if "good type" is a valid (potentially user defined) python type
Expand All @@ -113,14 +117,12 @@ def no_doc_run(self):
# "pattern" should be replaced by "repl" in the signature of all functions in
# "class_name"
class_specific_replacements = {
"Sims1": [("SubclassType", "Sims1"), ("SimsSettingsSims1", "Sims1")],
"Sims2": [("SubclassType", "Sims2"), ("SimsSettingsSims2", "Sims2")],
"Sims1": [("SimsSettingsSims1", "Sims1")],
"Sims2": [("SimsSettingsSims2", "Sims2")],
"MinimalRepOrc": [
("SubclassType", "MinimalRepOrc"),
("SimsSettingsMinimalRepOrc", "MinimalRepOrc"),
],
"RepOrc": [
("SubclassType", "RepOrc"),
("SimsSettingsRepOrc", "RepOrc"),
],
}
Expand Down
1 change: 1 addition & 0 deletions docs/source/data-structures/words/to-string.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ Full API
.. autoclass:: ToString
:class-doc-from: init
:members:
:special-members: __call__
1 change: 1 addition & 0 deletions docs/source/data-structures/words/to-word.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ Full API
.. autoclass:: ToWord
:class-doc-from: init
:members:
:special-members: __call__
2 changes: 1 addition & 1 deletion docs/source/main-algorithms/knuth-bendix/knuth-bendix.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Full API
:members:
:exclude-members:
options, run_for, run_until, run, finished, stopped, current_state, dead,
internal_generating_pairs, kill, last_report, report, report_every,
internal_generating_pairs, internal_presentation, kill, last_report, report, report_every,
report_prefix, report_why_we_stopped, reset_last_report, reset_start_time,
running, running_for, running_until, start_time, started, state,
stopped_by_predicate, success, timed_out
9 changes: 4 additions & 5 deletions etc/check-params.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def warn(message):
print(YELLOW + f"WARNING: {message}" + END_COLOUR)


def extract_signature(func) -> tuple[dict[str, str], str]:
def extract_signature(func, func_name) -> tuple[dict[str, str], str]:
"""Extract the parameters and typehints from the signature of a function

This function interrogates the signature of a function and returns:
Expand All @@ -32,7 +32,7 @@ def extract_signature(func) -> tuple[dict[str, str], str]:
for param in sig.find_all("em", class_="sig-param"):
param_component = param.find_all("span", class_="n")
if len(param_component) == 0 or len(param_component) > 2:
warn("unexpected element in doc. Skipping . . .")
warn(f"unexpected element in doc of {func_name}. Skipping . . .")
elif len(param_component) == 1:
param_to_typehint[param_component[0].get_text()] = ""
else:
Expand Down Expand Up @@ -67,7 +67,6 @@ def extract_documented_signature(func, name) -> tuple[dict[str, str], str]:
param_to_typehint = {}
return_typehint = ""
field_list = func.find("dl", class_="field-list simple")

if not field_list:
return param_to_typehint, return_typehint

Expand Down Expand Up @@ -157,7 +156,7 @@ def process_file(filename):
content = f.read()

soup = BeautifulSoup(content, "html.parser")
for func in soup.find_all("dl", class_="py function"):
for func in soup.find_all("dl", class_=lambda x: x in {"py function", "py method"}):
first_segment = func.find("p")
if first_segment and "Overloaded function" in first_segment.get_text():
continue
Expand All @@ -167,7 +166,7 @@ def process_file(filename):
sig_block = sig_block.parent.find_parent("dl").find("dt")
func_name = sig_block["id"]

sig_params, sig_return_typehint = extract_signature(func)
sig_params, sig_return_typehint = extract_signature(func, func_name)
doc_params, doc_return_typehint = extract_documented_signature(func, func_name)

compare_parameters(sig_params, doc_params, func_name)
Expand Down
90 changes: 45 additions & 45 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,23 @@
# * Use pre-commit
# * Use MyPy
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools>=64",
"setuptools-scm>=8",
"pybind11",
"pkgconfig",
"packaging",
]
build-backend = "setuptools.build_meta"

[project]
name = "libsemigroups_pybind11"
dynamic = ["version"]
description = "A python package for the libsemigroups C++ library."
readme = "README.md"
authors = [
{ name = "Reinis Cirpons", email = "rc234@st-andrews.ac.uk" },
{ name = "Joseph Edwards", email = "jde1@st-andrews.ac.uk" },
{ name = "James Mitchell", email = "jdm3@st-andrews.ac.uk" },
{ name = "Maria Tsalakou", email = "mt200@st-andrews.ac.uk" },
{ name = "Murray Whyte", email = "mw231@st-andrews.ac.uk" },
]
# TODO: Uncomment and update
# maintainers = [{ name = "My Organization", email = "myemail@email.com" }]
requires-python = ">=3.9"
dependencies = ["graphviz", "numpy", "typing_extensions"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python :: 3 :: Only",
Expand All @@ -43,67 +35,75 @@ classifiers = [
"Topic :: Scientific/Engineering :: Mathematics",
"Natural Language :: English",
]
dependencies = ["graphviz", "numpy", "typing_extensions"]
description = "A python package for the libsemigroups C++ library."
dynamic = ["version"]
license = "GPL-3.0-or-later"
license-files = ["LICENSE"]
# TODO: Uncomment and update
# maintainers = [{ name = "My Organization", email = "myemail@email.com" }]
name = "libsemigroups_pybind11"
readme = "README.md"
requires-python = ">=3.9"

[project.urls]
Homepage = "https://github.com/libsemigroups/libsemigroups_pybind11"
Changelog = "https://libsemigroups.github.io/libsemigroups_pybind11/changelog.html"
Documentation = "https://libsemigroups.github.io/libsemigroups_pybind11/"
Issues = "https://github.com/libsemigroups/libsemigroups_pybind11/issues"
Changelog = "https://libsemigroups.github.io/libsemigroups_pybind11/changelog.html"
Homepage = "https://github.com/libsemigroups/libsemigroups_pybind11"
Issues = "https://github.com/libsemigroups/libsemigroups_pybind11/issues"

[project.optional-dependencies]
test = ["pytest"]
docs = [
"sphinx_rtd_theme",
"sphinx >=8.2",
"sphinx-copybutton",
"sphinxcontrib-bibtex",
]
test = ["pytest"]

[dependency-groups]
test = ["pytest==8.3.3"]
docs = [
"sphinx_rtd_theme==3.0.2",
"sphinx-copybutton==0.5.2",
"sphinx==8.2.3",
"sphinxcontrib-bibtex==2.6.3",
]
dev = [
"accepts==2020.12.3",
"argcomplete==3.6.2",
"beautifulsoup4==4.13.3",
"beautifulsoup4==4.13.4",
"colorama==0.4.6",
"cpplint==2.0.0",
"eventlet==0.39.1",
"exceptiongroup==1.2.2",
"gevent==24.11.1",
"cpplint==2.0.2",
"eventlet==0.40.2",
"exceptiongroup==1.3.0",
"gevent==25.5.1",
"graphviz==0.20.3",
"greenlet==3.1.1",
"greenlet==3.2.3",
"numpy==2.0.2",
"ox_profile==0.2.14",
"packaging==24.2",
"pexpect==4.9.0",
"pkgconfig==1.5.5",
"pudb==2024.1.3",
"pybind11==2.13.6",
"pygments==2.19.1",
"pylint==3.3.5",
"pudb==2025.1",
"pybind11==3.0.0",
"pygments==2.19.2",
"pylint==3.3.7",
"pyyaml==6.0.2",
"ruff==0.11.2",
"ruff==0.12.4",
"setuptools==75.8.2",
"tomli==2.2.1",
"twisted==24.11.0",
"typing_extensions==4.13.0",
"twisted==25.5.0",
"typing_extensions==4.14.1",
"zope==5.13",
{ include-group = "test" },
{ include-group = "docs" },
{ include-group = "test" },
]
docs = [
"sphinx_rtd_theme==3.0.2",
"sphinx-copybutton==0.5.2",
"sphinx==8.2.3",
"sphinxcontrib-bibtex==2.6.5",
]
test = ["pytest==8.4.1"]

[tool.codespell]
skip = "./.git,./docs/_build/*,./gh-pages"
ignore-words-list = "nd,toword,groupe,theses"
ignore-multiline-regex = "codespell:begin-ignore.*codespell:end-ignore"
ignore-words-list = "nd,toword,groupe,theses"
skip = "./.git,./docs/_build/*,./gh-pages"

[tool.setuptools.packages.find]
where = ["src"]
Expand All @@ -129,25 +129,25 @@ lint.select = ["E", "F", "B"]
# docstring-code-format = true

[tool.pytest.ini_options]
minversion = "6.0"
testpaths = ["tests"]
addopts = ["-ra", "--showlocals", "--strict-markers", "--strict-config"]
addopts = ["-ra", "--showlocals", "--strict-markers", "--strict-config"]
console_output_style = "progress"
filterwarnings = ["error"]
markers = ["quick", "standard", "extreme", "fail"]
filterwarnings = ["error"]
log_cli_level = "INFO"
markers = ["quick", "standard", "extreme", "fail"]
minversion = "6.0"
testpaths = ["tests"]
verbosity_test_cases = 1
xfail_strict = true
log_cli_level = "INFO"
xfail_strict = true

[tool.pylint.main]
ignore-paths = "src/libsemigroups_pybind11/_version.py"
jobs = 0
jobs = 0

[tool.pylint.miscellaneous]
# List of note tags to take in consideration, separated by a comma.
# notes = ["TODO", "FIXME", "REVIEW"]
disable = ["R0801", "fixme"]
notes = []
notes = []

[tool.pylint.similarities]
ignore-imports = "yes"
Expand Down
32 changes: 16 additions & 16 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
accepts==2020.12.3
argcomplete==3.6.2
beautifulsoup4==4.13.3
beautifulsoup4==4.13.4
colorama==0.4.6
cpplint==2.0.0
eventlet==0.39.1
exceptiongroup==1.2.2
gevent==24.11.1
cpplint==2.0.2
eventlet==0.40.2
exceptiongroup==1.3.0
gevent==25.5.1
graphviz==0.20.3
greenlet==3.1.1
numpy==2.0.2;
greenlet==3.2.3
numpy==2.0.2
ox_profile==0.2.14
packaging==24.2
pexpect==4.9.0
pkgconfig==1.5.5
pudb==2024.1.3
pybind11==2.13.6
pygments==2.19.1
pylint==3.3.5
pytest==8.3.3
pudb==2025.1
pybind11==3.0.0
pygments==2.19.2
pylint==3.3.7
pytest==8.4.1
pyyaml==6.0.2
ruff==0.11.2
ruff==0.12.4
setuptools==75.8.2
sphinx_rtd_theme==3.0.2
sphinx-copybutton==0.5.2
# We are being slightly deceptive here. Compiling with sphinx==7.4.7 will work,
# but will cause warnings
sphinx==8.2.3;python_version>="3.11"
sphinx==7.4.7;python_version<="3.10"
sphinxcontrib-bibtex==2.6.3
sphinxcontrib-bibtex==2.6.5
tomli==2.2.1
twisted==24.11.0
typing_extensions==4.13.0
twisted==25.5.0
typing_extensions==4.14.1
zope==5.13
10 changes: 5 additions & 5 deletions src/action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,14 @@ Returns the number of generators.
self.generators().cend());
},
R"pbdoc(
:sig=(self: Action) -> Iterator[Element]:
:sig=(self: Action) -> collections.abc.Iterator[Element]:

Returns an iterator yielding the generators.

:returns:
An iterator yielding the generators.
:rtype:
Iterator[Element]
collections.abc.Iterator[Element]

:complexity:
Constant.
Expand Down Expand Up @@ -405,9 +405,9 @@ of the strongly connected component containing ``self[pos]``.
},
py::arg("x"),
R"pbdoc(
:sig=(self: Action, x: Element) -> Point:
:sig=(self: Action, x: Point) -> Point:

Returns the root point of a strongly connected component containing an
Returns the root point of a strongly connected component containing a
``Point``.

:param x: the point whose root we want to find.
Expand All @@ -428,7 +428,7 @@ Returns the root point of a strongly connected component containing an
[](Action_& self, index_type pos) { return self.root_of_scc(pos); },
py::arg("pos"),
R"pbdoc(
:sig=(self: Action, pos: Point) -> Point:
:sig=(self: Action, pos: int) -> Point:

Returns the root point of a strongly connected component.

Expand Down
Loading
Loading