2024-09-10 01:15:36 +02:00
|
|
|
|
[tool.poetry]
|
|
|
|
|
|
|
|
|
|
name = "lalib"
|
2024-09-10 03:55:36 +02:00
|
|
|
|
version = "0.5.0.dev0"
|
2024-09-10 01:15:36 +02:00
|
|
|
|
|
|
|
|
|
authors = [
|
|
|
|
|
"Alexander Hess <alexander@webartifex.biz>",
|
|
|
|
|
]
|
|
|
|
|
classifiers = [
|
|
|
|
|
"Development Status :: 4 - Beta",
|
|
|
|
|
"Intended Audience :: Developers",
|
|
|
|
|
"Intended Audience :: Education",
|
|
|
|
|
"Intended Audience :: Science/Research",
|
|
|
|
|
"License :: OSI Approved :: MIT License",
|
|
|
|
|
"Programming Language :: Python :: 3.9",
|
|
|
|
|
"Programming Language :: Python :: 3.10",
|
|
|
|
|
"Programming Language :: Python :: 3.11",
|
|
|
|
|
"Programming Language :: Python :: 3.12",
|
2024-10-16 01:32:14 +02:00
|
|
|
|
"Programming Language :: Python :: 3.13",
|
2024-09-10 01:15:36 +02:00
|
|
|
|
]
|
|
|
|
|
description = "A Python library to study linear algebra"
|
|
|
|
|
license = "MIT"
|
|
|
|
|
readme = "README.md"
|
|
|
|
|
|
2024-09-10 03:11:59 +02:00
|
|
|
|
documentation = "https://lalib.readthedocs.io"
|
2024-09-10 01:15:36 +02:00
|
|
|
|
homepage = "https://github.com/webartifex/lalib"
|
|
|
|
|
repository = "https://github.com/webartifex/lalib"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[tool.poetry.dependencies]
|
|
|
|
|
|
|
|
|
|
python = "^3.9"
|
|
|
|
|
|
2024-09-18 18:04:35 +02:00
|
|
|
|
typing-extensions = [ { python = "<3.11", version = "^4.12" } ] # to support Python 3.9 & 3.10
|
|
|
|
|
|
2024-09-10 01:15:36 +02:00
|
|
|
|
|
|
|
|
|
[tool.poetry.group.dev.dependencies]
|
|
|
|
|
|
2024-09-10 02:32:56 +02:00
|
|
|
|
pre-commit = "^3.8"
|
|
|
|
|
|
2024-09-10 01:27:34 +02:00
|
|
|
|
# Code formatters
|
|
|
|
|
autoflake = "^2.3"
|
|
|
|
|
black = "^24.8"
|
|
|
|
|
isort = "^5.13"
|
2024-09-10 01:15:36 +02:00
|
|
|
|
|
2024-09-10 01:33:54 +02:00
|
|
|
|
# Code linters
|
|
|
|
|
flake8 = "^7.1"
|
|
|
|
|
flake8-annotations = "^3.1"
|
|
|
|
|
flake8-bandit = "^4.1"
|
|
|
|
|
flake8-black = "^0.3"
|
|
|
|
|
flake8-broken-line = "^1.0"
|
|
|
|
|
flake8-bugbear = "^24.8"
|
|
|
|
|
flake8-commas = "^4.0"
|
|
|
|
|
flake8-comprehensions = "^3.15"
|
|
|
|
|
flake8-debugger = "^4.1"
|
|
|
|
|
flake8-docstrings = "^1.7"
|
|
|
|
|
flake8-eradicate = "^1.5"
|
|
|
|
|
flake8-isort = "^6.1"
|
|
|
|
|
flake8-quotes = "^3.4"
|
|
|
|
|
flake8-string-format = "^0.3"
|
2024-09-27 15:29:33 +02:00
|
|
|
|
flake8-todos = "^0.3"
|
2024-09-10 01:33:54 +02:00
|
|
|
|
flake8-pyproject = "^1.2"
|
2024-09-10 01:38:26 +02:00
|
|
|
|
flake8-pytest-style = "^2.0"
|
2024-10-16 11:23:54 +02:00
|
|
|
|
flake8-unused-arguments = "^0.0"
|
2024-09-10 01:33:54 +02:00
|
|
|
|
mypy = "^1.11"
|
|
|
|
|
pep8-naming = "^0.14" # flake8 plug-in
|
|
|
|
|
pydoclint = { extras = ["flake8"], version = "^0.5" }
|
|
|
|
|
ruff = "^0.6"
|
|
|
|
|
|
2024-09-10 02:09:09 +02:00
|
|
|
|
# Documentation
|
|
|
|
|
sphinx = [
|
|
|
|
|
{ python = "=3.9", version = "^7.4" },
|
|
|
|
|
{ python = ">=3.10", version = "^8.0" },
|
|
|
|
|
]
|
|
|
|
|
sphinx-autodoc-typehints = "^2.3"
|
|
|
|
|
|
2024-09-10 01:38:26 +02:00
|
|
|
|
# Test suite
|
2024-09-10 02:01:23 +02:00
|
|
|
|
coverage = "^7.6"
|
2024-09-10 01:45:47 +02:00
|
|
|
|
packaging = "^24.1" # to test the version identifier
|
2024-09-10 01:38:26 +02:00
|
|
|
|
pytest = "^8.3"
|
|
|
|
|
pytest-cov = "^5.0"
|
2024-09-27 16:04:37 +02:00
|
|
|
|
pytest-randomly = "^3.15"
|
Add `Q`, `R`, `C`, and `GF2` fields
- add `lalib.fields.base.Field`, a blueprint for all concrete fields,
providing a unified interface to be used outside of the
`lalib.fields` sub-package
- implement `lalib.fields.complex_.ComplexField`, or `C` for short,
the field over the complex numbers (modeled as `complex` numbers)
- implement `lalib.fields.galois.GaloisField2`, or `GF2` for short,
the (finite) field over the two elements `one` and `zero`
+ adapt `lalib.elements.galois.GF2Element.__eq__()` to return
`NotImplemented` instead of `False` for non-castable `other`s
=> this fixes a minor issue with `pytest.approx()`
- implement `lalib.fields.rational.RationalField`, or `Q` for short,
the field over the rational numbers (modeled as `fractions.Fraction`s)
- implement `lalib.fields.real.RealField`, or `R` for short,
the field over the real numbers (modeled as `float`s)
- organize top-level imports for `lalib.fields`,
making `Q`, `R`, `C`, and `GF2` importable with
`from lalib.fields import *`
- provide extensive unit and integration tests for the new objects:
+ test generic and common behavior in `tests.fields.test_base`
+ test specific behavior is other modules
+ test the well-known math axioms for all fields (integration tests)
+ test the new objects' docstrings
+ add "pytest-repeat" to run randomized tests many times
2024-10-14 15:17:42 +02:00
|
|
|
|
pytest-repeat = "^0.9"
|
2024-09-10 01:45:47 +02:00
|
|
|
|
semver = "^3.0" # to test the version identifier
|
|
|
|
|
tomli = [ { python = "<3.11", version = "^2.0" } ]
|
2024-09-10 01:57:02 +02:00
|
|
|
|
xdoctest = { extras = ["colors"], version = "^1.2" }
|
2024-09-10 01:15:36 +02:00
|
|
|
|
|
2024-09-18 15:08:19 +02:00
|
|
|
|
|
2024-09-10 01:15:36 +02:00
|
|
|
|
[tool.poetry.urls]
|
|
|
|
|
|
|
|
|
|
"Issues Tracker" = "https://github.com/webartifex/lalib/issues"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-10 01:27:34 +02:00
|
|
|
|
[tool.autoflake]
|
|
|
|
|
# Source: https://github.com/PyCQA/autoflake#configuration
|
|
|
|
|
|
|
|
|
|
in-place = true
|
|
|
|
|
recursive = true
|
|
|
|
|
expand-star-imports = true
|
|
|
|
|
remove-all-unused-imports = true
|
|
|
|
|
ignore-init-module-imports = true # modifies "remove-all-unused-imports"
|
|
|
|
|
remove-duplicate-keys = true
|
|
|
|
|
remove-unused-variables = true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[tool.black]
|
|
|
|
|
# Source: https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html
|
|
|
|
|
|
|
|
|
|
line-length = 88
|
|
|
|
|
target-version = ["py312", "py311", "py310", "py39"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-10 01:38:26 +02:00
|
|
|
|
[tool.coverage]
|
|
|
|
|
# Source: https://coverage.readthedocs.io/en/latest/config.html
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[tool.coverage.paths]
|
|
|
|
|
|
|
|
|
|
source = ["src/", "*/site-packages/"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[tool.coverage.report]
|
|
|
|
|
|
|
|
|
|
show_missing = true
|
|
|
|
|
|
|
|
|
|
skip_covered = true
|
|
|
|
|
skip_empty = true
|
|
|
|
|
|
2024-09-18 15:15:24 +02:00
|
|
|
|
exclude_lines = [
|
|
|
|
|
|
|
|
|
|
# "pragma: no cover"
|
|
|
|
|
# => Intentionally commented out as we thrive for 100% test coverage
|
|
|
|
|
|
2024-09-18 18:04:35 +02:00
|
|
|
|
# PyPI's "typing-extensions" are needed to make `mypy` work
|
|
|
|
|
"pragma: no cover ${PRAGMA_SUPPORT_39_N_310}",
|
|
|
|
|
|
2024-09-18 15:15:24 +02:00
|
|
|
|
]
|
|
|
|
|
|
2024-09-10 01:38:26 +02:00
|
|
|
|
|
|
|
|
|
[tool.coverage.run]
|
|
|
|
|
|
|
|
|
|
data_file = ".cache/coverage/data"
|
|
|
|
|
|
|
|
|
|
branch = true
|
|
|
|
|
parallel = true
|
|
|
|
|
|
|
|
|
|
source = ["lalib"]
|
|
|
|
|
|
|
|
|
|
|
2024-09-10 03:10:26 +02:00
|
|
|
|
[tool.coverage.xml]
|
|
|
|
|
|
|
|
|
|
output = ".cache/coverage/report.xml"
|
|
|
|
|
|
|
|
|
|
|
2024-09-10 01:38:26 +02:00
|
|
|
|
|
2024-09-10 01:33:54 +02:00
|
|
|
|
[tool.flake8]
|
|
|
|
|
|
|
|
|
|
select = [
|
|
|
|
|
|
|
|
|
|
# violations also covered by `ruff` below
|
|
|
|
|
|
|
|
|
|
"ANN", # flake8-annotations => enforce type checking for functions
|
|
|
|
|
"B", # flake8-bugbear => bugs and design flaws
|
|
|
|
|
"C4", # flake8-comprehensions => better comprehensions
|
|
|
|
|
"C8", # flake8-commas => better comma placements ("COM" for `ruff`)
|
|
|
|
|
"C90", # mccabe => cyclomatic complexity (Source: https://github.com/pycqa/mccabe#plugin-for-flake8)
|
|
|
|
|
"D", # flake8-docstrings / pydocstyle => PEP257 compliance
|
|
|
|
|
"E", "W", # pycodestyle => PEP8 compliance (Source: https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes)
|
|
|
|
|
"E800", # flake8-eradicate / eradicate => no commented out code ("ERA" for `ruff`)
|
|
|
|
|
"F", # pyflakes => basic errors (Source: https://flake8.pycqa.org/en/latest/user/error-codes.html)
|
|
|
|
|
"I", # flake8-isort => isort would make changes
|
|
|
|
|
"N", # pep8-naming
|
2024-09-10 01:38:26 +02:00
|
|
|
|
"PT", # flake8-pytest-style => enforce a consistent style with pytest
|
2024-09-10 01:33:54 +02:00
|
|
|
|
"Q", # flake8-quotes => use double quotes everywhere (complying with black)
|
|
|
|
|
"S", # flake8-bandit => common security issues
|
2024-09-27 15:29:33 +02:00
|
|
|
|
"T00", # flake8-todos => unify TODOs
|
2024-09-10 01:33:54 +02:00
|
|
|
|
"T10", # flake8-debugger => no debugger usage
|
2024-10-16 11:23:54 +02:00
|
|
|
|
"U100", # flake8-unused-arguments => declared function arguments must be used
|
2024-09-10 01:33:54 +02:00
|
|
|
|
|
|
|
|
|
# violations not covered by `ruff` below
|
|
|
|
|
|
|
|
|
|
"BLK", # flake8-black => complain if black wants to make changes
|
|
|
|
|
"DOC", # pydoclint (replaces "darglint") => docstring matches implementation
|
|
|
|
|
"N400", # flake8-broken-line => no "\" to end a line
|
|
|
|
|
"P", # flake8-string-format => unify usage of `str.format()` ("FMT" in the future)
|
|
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
ignore = []
|
|
|
|
|
|
|
|
|
|
extend-ignore = [ # never check the following codes
|
|
|
|
|
|
|
|
|
|
"ANN101", "ANN102", # `self` and `cls` in methods need no annotation
|
|
|
|
|
|
|
|
|
|
"ANN401", # allow dynamically typed expressions with `typing.Any`
|
|
|
|
|
|
2024-09-18 15:17:53 +02:00
|
|
|
|
"DOC301", # PEP257 => class constructor's docstring go in `.__init__()`
|
|
|
|
|
|
2024-09-10 01:33:54 +02:00
|
|
|
|
# Comply with black's style
|
|
|
|
|
# Sources: https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#pycodestyle
|
|
|
|
|
"E203", "E701", "E704", "W503",
|
|
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
per-file-ignores = [
|
|
|
|
|
|
2024-09-10 01:45:47 +02:00
|
|
|
|
# Linting rules for the test suite:
|
|
|
|
|
# - type hints are not required
|
|
|
|
|
# - `assert`s are normal
|
|
|
|
|
"tests/*.py:ANN,S101",
|
|
|
|
|
|
2024-09-10 01:33:54 +02:00
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
# Explicitly set mccabe's maximum complexity to 10 as recommended by
|
|
|
|
|
# Thomas McCabe, the inventor of the McCabe complexity, and the NIST
|
|
|
|
|
# Source: https://en.wikipedia.org/wiki/Cyclomatic_complexity#Limiting_complexity_during_development
|
|
|
|
|
max-complexity = 10
|
|
|
|
|
|
|
|
|
|
# Whereas black and isort break the line at 88 characters,
|
|
|
|
|
# make flake8 not complain about anything (e.g., comments) until 100
|
|
|
|
|
max-line-length = 99
|
|
|
|
|
|
|
|
|
|
# Preview the code lines that cause errors
|
|
|
|
|
show-source = true
|
|
|
|
|
|
|
|
|
|
# Plug-in: flake8-docstrings
|
|
|
|
|
# Source: https://www.pydocstyle.org/en/latest/error_codes.html#default-conventions
|
|
|
|
|
docstring-convention = "google"
|
|
|
|
|
|
|
|
|
|
# Plug-in: flake8-eradicate
|
|
|
|
|
# Source: https://github.com/wemake-services/flake8-eradicate#options
|
|
|
|
|
eradicate-aggressive = true
|
|
|
|
|
|
2024-09-10 01:38:26 +02:00
|
|
|
|
# Plug-in: flake8-pytest-style
|
|
|
|
|
#
|
|
|
|
|
# Aligned with [tool.ruff.lint.flake8-pytest-style] below
|
|
|
|
|
#
|
|
|
|
|
# Prefer `@pytest.fixture` over `@pytest.fixture()`
|
|
|
|
|
pytest-fixture-no-parentheses = true
|
|
|
|
|
#
|
|
|
|
|
# Prefer `@pytest.mark.foobar` over `@pytest.mark.foobar()`
|
|
|
|
|
pytest-mark-no-parentheses = true
|
|
|
|
|
#
|
|
|
|
|
# Prefer `@pytest.mark.parametrize(['param1', 'param2'], [(1, 2), (3, 4)])`
|
|
|
|
|
# over `@pytest.mark.parametrize(('param1', 'param2'), ([1, 2], [3, 4]))`
|
|
|
|
|
pytest-parametrize-names-type = "list"
|
|
|
|
|
pytest-parametrize-values-row-type = "tuple"
|
|
|
|
|
pytest-parametrize-values-type = "list"
|
|
|
|
|
|
2024-09-10 01:33:54 +02:00
|
|
|
|
# Plug-in: flake8-quotes
|
|
|
|
|
# Source: https://github.com/zheller/flake8-quotes#configuration
|
|
|
|
|
avoid-escape = true
|
|
|
|
|
docstring-quotes = "double"
|
|
|
|
|
inline-quotes = "double"
|
|
|
|
|
multiline-quotes = "double"
|
|
|
|
|
|
2024-10-16 11:23:54 +02:00
|
|
|
|
# Plug-in: flake8-unused-arguments
|
|
|
|
|
# Source: https://github.com/nhoad/flake8-unused-arguments
|
|
|
|
|
# Make flake8-unused-arguments behave like ruff's "ARG" error code
|
|
|
|
|
unused-arguments-ignore-abstract-functions = true
|
|
|
|
|
unused-arguments-ignore-stub-functions = true
|
|
|
|
|
|
2024-09-10 01:33:54 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[tool.isort] # aligned with [tool.ruff.lint.isort] below
|
2024-09-10 01:27:34 +02:00
|
|
|
|
# Source: https://pycqa.github.io/isort/docs/configuration/options.html
|
|
|
|
|
|
|
|
|
|
known_first_party = ["lalib"]
|
|
|
|
|
|
|
|
|
|
atomic = true
|
|
|
|
|
case_sensitive = true
|
|
|
|
|
combine_star = true
|
|
|
|
|
force_alphabetical_sort_within_sections = true
|
|
|
|
|
lines_after_imports = 2
|
|
|
|
|
remove_redundant_aliases = true
|
|
|
|
|
|
|
|
|
|
# Comply with black's style => Instead of: 'profile = "black"'
|
|
|
|
|
# Source: https://pycqa.github.io/isort/docs/configuration/profiles.html
|
|
|
|
|
ensure_newline_before_comments = true
|
|
|
|
|
force_grid_wrap = 0
|
|
|
|
|
include_trailing_comma = true
|
|
|
|
|
line_length = 88
|
|
|
|
|
multi_line_output = 3
|
|
|
|
|
split_on_trailing_comma = true
|
|
|
|
|
use_parentheses = true
|
|
|
|
|
|
|
|
|
|
# Comply with Google's Python style guide
|
|
|
|
|
# => All imports go on a single line (with some exceptions)
|
|
|
|
|
# Source: https://google.github.io/styleguide/pyguide.html#313-imports-formatting
|
|
|
|
|
force_single_line = true
|
|
|
|
|
single_line_exclusions = ["collections.abc", "typing"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-10 01:33:54 +02:00
|
|
|
|
[tool.mypy]
|
|
|
|
|
# Source: https://mypy.readthedocs.io/en/latest/config_file.html
|
|
|
|
|
|
|
|
|
|
cache_dir = ".cache/mypy"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[[tool.mypy.overrides]]
|
|
|
|
|
|
|
|
|
|
module = [
|
|
|
|
|
"nox",
|
2024-09-10 01:45:47 +02:00
|
|
|
|
"pytest",
|
|
|
|
|
"semver",
|
|
|
|
|
"tomli",
|
2024-09-10 01:57:02 +02:00
|
|
|
|
"xdoctest",
|
2024-09-10 01:33:54 +02:00
|
|
|
|
]
|
|
|
|
|
ignore_missing_imports = true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-10 01:38:26 +02:00
|
|
|
|
[tool.pytest.ini_options]
|
|
|
|
|
# Source: https://docs.pytest.org/en/stable/
|
|
|
|
|
|
|
|
|
|
cache_dir = ".cache/pytest"
|
|
|
|
|
|
|
|
|
|
addopts = "--strict-markers"
|
|
|
|
|
console_output_style = "count"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-10 01:33:54 +02:00
|
|
|
|
[tool.ruff]
|
|
|
|
|
# Source: https://docs.astral.sh/ruff/
|
|
|
|
|
|
|
|
|
|
cache-dir = ".cache/ruff"
|
|
|
|
|
|
|
|
|
|
target-version = "py39" # minimum supported Python version
|
|
|
|
|
|
|
|
|
|
indent-width = 4
|
|
|
|
|
line-length = 88
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[tool.ruff.format]
|
|
|
|
|
|
|
|
|
|
# Align with black
|
|
|
|
|
indent-style = "space"
|
|
|
|
|
line-ending = "lf"
|
|
|
|
|
quote-style = "double"
|
|
|
|
|
skip-magic-trailing-comma = false
|
|
|
|
|
|
|
|
|
|
# Format docstrings as well
|
|
|
|
|
docstring-code-format = true
|
|
|
|
|
docstring-code-line-length = "dynamic"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[tool.ruff.lint] # aligned with [tool.flake8] above
|
|
|
|
|
|
|
|
|
|
select = [
|
|
|
|
|
|
|
|
|
|
# violations also covered by `flake8` above
|
|
|
|
|
|
|
|
|
|
"ANN", # flake8-annotations => enforce type checking for functions
|
2024-10-16 11:23:54 +02:00
|
|
|
|
"ARG", # flake8-unused-arguments => declared function arguments must be used
|
2024-09-10 01:33:54 +02:00
|
|
|
|
"B", # flake8-bugbear => bugs and design flaws
|
|
|
|
|
"C4", # flake8-comprehensions => better comprehensions
|
|
|
|
|
"C90", # mccabe => cyclomatic complexity
|
|
|
|
|
"COM", # "C8" for flake8-commas => better comma placements
|
|
|
|
|
"D", # flake8-docstrings / pydocstyle => PEP257 compliance
|
|
|
|
|
"E", "W", # pycodestyle => PEP8 compliance
|
|
|
|
|
"ERA", # "E800" for flake8-eradicate / eradicate => no commented out code
|
|
|
|
|
"F", # pyflakes => basic errors
|
|
|
|
|
"I", # flake8-isort => isort would make changes
|
|
|
|
|
"N", # pep8-naming
|
2024-09-10 01:38:26 +02:00
|
|
|
|
"PT", # flake8-pytest-style => enforce a consistent style with pytest
|
2024-09-10 01:33:54 +02:00
|
|
|
|
"Q", # flake8-quotes => use double quotes everywhere
|
|
|
|
|
"S", # flake8-bandit => common security issues
|
2024-09-27 15:29:33 +02:00
|
|
|
|
"TD", # flake8-todos => unify TODOs
|
2024-09-10 01:33:54 +02:00
|
|
|
|
"T10", # flake8-debugger => no debugger usage
|
|
|
|
|
|
|
|
|
|
# violations not covered by `flake8` above
|
|
|
|
|
|
|
|
|
|
"T20", # flake8-print => forbid `[p]print`
|
|
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
ignore = []
|
|
|
|
|
|
|
|
|
|
extend-ignore = [ # never check the following codes
|
|
|
|
|
|
|
|
|
|
"ANN101", "ANN102", # `self` and `cls` in methods need no annotation
|
|
|
|
|
|
|
|
|
|
"ANN401", # allow dynamically typed expressions with `typing.Any`
|
|
|
|
|
|
|
|
|
|
# Comply with black's style
|
|
|
|
|
# Sources: https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#pycodestyle
|
|
|
|
|
"E203", "E701", # "E704" and "W503" do not exist for `ruff`
|
|
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
Add `Q`, `R`, `C`, and `GF2` fields
- add `lalib.fields.base.Field`, a blueprint for all concrete fields,
providing a unified interface to be used outside of the
`lalib.fields` sub-package
- implement `lalib.fields.complex_.ComplexField`, or `C` for short,
the field over the complex numbers (modeled as `complex` numbers)
- implement `lalib.fields.galois.GaloisField2`, or `GF2` for short,
the (finite) field over the two elements `one` and `zero`
+ adapt `lalib.elements.galois.GF2Element.__eq__()` to return
`NotImplemented` instead of `False` for non-castable `other`s
=> this fixes a minor issue with `pytest.approx()`
- implement `lalib.fields.rational.RationalField`, or `Q` for short,
the field over the rational numbers (modeled as `fractions.Fraction`s)
- implement `lalib.fields.real.RealField`, or `R` for short,
the field over the real numbers (modeled as `float`s)
- organize top-level imports for `lalib.fields`,
making `Q`, `R`, `C`, and `GF2` importable with
`from lalib.fields import *`
- provide extensive unit and integration tests for the new objects:
+ test generic and common behavior in `tests.fields.test_base`
+ test specific behavior is other modules
+ test the well-known math axioms for all fields (integration tests)
+ test the new objects' docstrings
+ add "pytest-repeat" to run randomized tests many times
2024-10-14 15:17:42 +02:00
|
|
|
|
allowed-confusables = ["ℂ", "ℝ", "ℚ"]
|
|
|
|
|
|
2024-09-10 01:33:54 +02:00
|
|
|
|
|
2024-09-10 01:38:26 +02:00
|
|
|
|
[tool.ruff.lint.flake8-pytest-style] # aligned with [tool.flake8] above
|
|
|
|
|
|
|
|
|
|
# Prefer `@pytest.fixture` over `@pytest.fixture()`
|
|
|
|
|
fixture-parentheses = false
|
|
|
|
|
|
|
|
|
|
# Prefer `@pytest.mark.foobar` over `@pytest.mark.foobar()`
|
|
|
|
|
mark-parentheses = false
|
|
|
|
|
|
|
|
|
|
# Prefer `@pytest.mark.parametrize(['param1', 'param2'], [(1, 2), (3, 4)])`
|
|
|
|
|
# over `@pytest.mark.parametrize(('param1', 'param2'), ([1, 2], [3, 4]))`
|
|
|
|
|
parametrize-names-type = "list"
|
|
|
|
|
parametrize-values-row-type = "tuple"
|
|
|
|
|
parametrize-values-type = "list"
|
|
|
|
|
|
|
|
|
|
|
2024-09-10 01:33:54 +02:00
|
|
|
|
[tool.ruff.lint.isort] # aligned with [tool.isort] above
|
|
|
|
|
|
|
|
|
|
case-sensitive = true
|
|
|
|
|
force-single-line = true
|
|
|
|
|
single-line-exclusions = ["collections.abc", "typing"]
|
|
|
|
|
lines-after-imports = 2
|
|
|
|
|
split-on-trailing-comma = true
|
|
|
|
|
known-first-party = ["lalib"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[tool.ruff.lint.per-file-ignores]
|
|
|
|
|
|
2024-09-10 02:09:09 +02:00
|
|
|
|
# The "docs/" folder is not a package
|
|
|
|
|
"docs/conf.py" = ["INP001"]
|
|
|
|
|
|
2024-09-10 01:45:47 +02:00
|
|
|
|
"tests/*.py" = [ # Linting rules for the test suite:
|
|
|
|
|
"ANN", # - type hints are not required
|
|
|
|
|
"S101", # - `assert`s are normal
|
|
|
|
|
"W505", # - docstrings may be longer than 72 characters
|
|
|
|
|
]
|
2024-09-10 01:33:54 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[tool.ruff.lint.pycodestyle]
|
|
|
|
|
|
|
|
|
|
max-doc-length = 72
|
|
|
|
|
max-line-length = 99
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[tool.ruff.lint.pydocstyle]
|
|
|
|
|
|
|
|
|
|
convention = "google"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-10 01:15:36 +02:00
|
|
|
|
[build-system]
|
|
|
|
|
|
|
|
|
|
requires = ["poetry-core"]
|
|
|
|
|
build-backend = "poetry.core.masonry.api"
|