Skip to content

Commit dda9605

Browse files
author
Release Manager
committed
gh-40166: Format toml files and add linter check <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes #12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes #12345". --> As in the title. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [ ] The title is concise and informative. - [ ] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - #12345: short description why this is a dependency --> <!-- - #34567: ... --> URL: #40166 Reported by: Tobias Diez Reviewer(s):
2 parents 1591b6d + 9dccb88 commit dda9605

File tree

3 files changed

+78
-63
lines changed

3 files changed

+78
-63
lines changed

.github/workflows/lint.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,8 @@ jobs:
4444
- name: Validate docstring markup as RST
4545
if: (success() || failure()) && steps.deps.outcome == 'success'
4646
run: uv run --frozen --only-group lint -- flake8 --select=RST src/sage/ --config src/tox.ini
47+
48+
- name: TOML format check with taplo
49+
uses: docker://tamasfe/taplo:0.10.0
50+
with:
51+
args: format --check --diff pyproject.toml .taplo.toml

.taplo.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# TODO: Move to pyproject.toml once https://github.com/tamasfe/taplo/issues/603 is fixed
2+
3+
[formatting]
4+
# https://taplo.tamasfe.dev/configuration/formatter-options.html
5+
align_comments = false
6+
align_entries = false
7+
array_auto_collapse = false
8+
reorder_arrays = true
9+
reorder_inline_tables = true
10+
reorder_keys = true

pyproject.toml

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
build-backend = 'mesonpy'
33
# Minimum requirements for the build system to execute.
44
requires = [
5-
'meson-python',
65
'cypari2 >=2.2.1; sys_platform != "win32"',
6+
'meson-python',
77
# Exclude 1.12.0 because of https://github.com/sagemath/cysignals/issues/212
88
'cysignals >=1.11.2, != 1.12.0',
99
# Exclude 3.0.3 because of https://github.com/cython/cython/issues/5748
1010
'cython >=3.0, != 3.0.3',
1111
'gmpy2 ~=2.1.b999',
12+
'jinja2',
1213
'memory_allocator',
1314
'numpy >=1.25',
14-
'jinja2',
1515
]
1616
[tool.meson-python.args]
1717
# Prevent meson from trying to install the autoconf subprojects
@@ -25,92 +25,92 @@ install = ['--skip-subprojects']
2525
setup = ['--default-library=static']
2626

2727
[project]
28-
name = "sagemath"
29-
description = "Sage: Open Source Mathematics Software: Standard Python Library"
28+
authors = [
29+
{ email = "[email protected]", name = "The Sage Developers" },
30+
]
31+
classifiers = [
32+
"Development Status :: 6 - Mature",
33+
"Intended Audience :: Education",
34+
"Intended Audience :: Science/Research",
35+
"License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)",
36+
"Operating System :: MacOS :: MacOS X",
37+
"Operating System :: POSIX",
38+
"Programming Language :: Python :: 3 :: Only",
39+
"Programming Language :: Python :: 3.11",
40+
"Programming Language :: Python :: 3.12",
41+
"Programming Language :: Python :: 3.13",
42+
"Programming Language :: Python :: Implementation :: CPython",
43+
"Topic :: Scientific/Engineering :: Mathematics",
44+
]
3045
dependencies = [
31-
'six >=1.15.0',
3246
'conway-polynomials >=0.8',
3347
'cypari2 >=2.2.1; sys_platform != "win32"',
48+
'six >=1.15.0',
3449
# Exclude 1.12.0 because of https://github.com/sagemath/cysignals/issues/212
3550
'cysignals >=1.11.2, != 1.12.0',
3651
'cython >=3.0, != 3.0.3',
52+
'fpylll >=0.5.9; sys_platform != "win32"',
3753
'gmpy2 ~=2.1.b999',
54+
'ipykernel >=5.2.1',
55+
'ipython >=8.9.0',
56+
'ipywidgets >=7.5.1',
57+
'jupyter-client',
58+
'matplotlib >=3.7.0',
3859
'memory_allocator',
60+
'mpmath >=1.1.0',
61+
'networkx >=3.1',
3962
'numpy >=1.25',
63+
'pexpect >=4.8.0',
64+
'pillow >=7.2.0',
65+
'platformdirs',
4066
# Issue #30922: pplpy 0.8.4 and earlier do not declare dependencies correctly
4167
'pplpy >=0.8.6; sys_platform != "win32"',
4268
'primecountpy; sys_platform != "win32"',
69+
'ptyprocess > 0.5',
4370
'requests >=2.13.0',
71+
'scipy >=1.11',
72+
'sphinx >=5.2, <9',
73+
'sympy >=1.6, <2.0',
4474
# According to https://github.com/python/typing_extensions/blob/main/CHANGELOG.md,
4575
# version 4.4.0 adds another Python 3.11 typing backport
4676
'typing_extensions >= 4.4.0; python_version<"3.11"',
47-
'ipython >=8.9.0',
48-
'pexpect >=4.8.0',
49-
'platformdirs',
50-
'sphinx >=5.2, <9',
51-
'networkx >=3.1',
52-
'scipy >=1.11',
53-
'sympy >=1.6, <2.0',
54-
'matplotlib >=3.7.0',
55-
'pillow >=7.2.0',
56-
'mpmath >=1.1.0',
57-
'ipykernel >=5.2.1',
58-
'jupyter-client',
59-
'ipywidgets >=7.5.1',
60-
'fpylll >=0.5.9; sys_platform != "win32"',
61-
'ptyprocess > 0.5',
6277
# TODO: Remove this once the migration to meson is complete
6378
'pkgconfig',
6479
'traitlets',
6580
]
81+
description = "Sage: Open Source Mathematics Software: Standard Python Library"
6682
dynamic = ["version"]
6783
license = { text = "GNU General Public License (GPL) v2 or later" }
68-
authors = [
69-
{ name = "The Sage Developers", email = "[email protected]" },
70-
]
71-
classifiers = [
72-
"Development Status :: 6 - Mature",
73-
"Intended Audience :: Education",
74-
"Intended Audience :: Science/Research",
75-
"License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)",
76-
"Operating System :: POSIX",
77-
"Operating System :: MacOS :: MacOS X",
78-
"Programming Language :: Python :: 3 :: Only",
79-
"Programming Language :: Python :: 3.11",
80-
"Programming Language :: Python :: 3.12",
81-
"Programming Language :: Python :: 3.13",
82-
"Programming Language :: Python :: Implementation :: CPython",
83-
"Topic :: Scientific/Engineering :: Mathematics",
84-
]
85-
urls = { Homepage = "https://www.sagemath.org" }
84+
name = "sagemath"
8685
requires-python = ">=3.11, <3.14"
86+
urls = { Homepage = "https://www.sagemath.org" }
8787

8888
[project.optional-dependencies]
8989
R = ['rpy2 >=3.3']
9090
extra = [
91-
'p_group_cohomology >=3.3', # Only used in tests
91+
'igraph',
92+
'lrcalc ~=2.1; sys_platform != "win32"',
93+
'p_group_cohomology >=3.3', # Only used in tests
9294
'pycosat >=0.6.3',
9395
'pynormaliz >=2.18; platform_machine != "aarch64" and platform_machine != "arm64"', # Not yet available for Linux aarch64
94-
'igraph',
9596
'sage_numerical_backends_coin',
96-
'symengine >= 0.6.1', # Only used in tests
97-
'lrcalc ~=2.1; sys_platform != "win32"',
97+
'symengine >= 0.6.1', # Only used in tests
9898
]
9999
giac = ['sagemath_giac']
100100

101101
[project.readme]
102-
file = "README.md"
103102
content-type = "text/markdown"
103+
file = "README.md"
104104

105105
[project.scripts]
106106
sage = "sage.cli:main"
107107

108108
[tool.conda-lock]
109-
platforms = ['osx-64', 'linux-64', 'linux-aarch64', 'osx-arm64']
109+
platforms = ['linux-64', 'linux-aarch64', 'osx-64', 'osx-arm64']
110110

111111
[tool.pytest.ini_options]
112-
python_files = "*_test.py"
113112
norecursedirs = "local prefix venv build builddir pkgs .git src/doc src/bin src/sage_setup/autogen/flint tools"
113+
python_files = "*_test.py"
114114
# The "no:warnings" is to stop pytest from capturing warnings so that they are printed to the output of the doctest
115115
addopts = "--import-mode importlib -p no:warnings"
116116
doctest_optionflags = "NORMALIZE_WHITESPACE ELLIPSIS"
@@ -120,22 +120,19 @@ consider_namespace_packages = true
120120
# External dependencies in the format proposed by https://peps.python.org/pep-0725
121121
[external]
122122
build-requires = [
123+
"pkg:generic/pkg-config",
123124
"virtual:compiler/c",
124125
"virtual:compiler/cpp",
125-
"pkg:generic/pkg-config",
126126
]
127127

128128
host-requires = [
129-
"virtual:interface/blas",
130-
"virtual:compiler/fortran",
131129
"pkg:generic/boost",
132130
"pkg:generic/cddlib",
133131
"pkg:generic/cliquer",
134132
"pkg:generic/ecl",
135133
"pkg:generic/ecm",
136134
"pkg:generic/fflas-ffpack",
137135
"pkg:generic/flint",
138-
"pkg:generic/libgd",
139136
"pkg:generic/gap",
140137
"pkg:generic/gfan",
141138
"pkg:generic/givaro",
@@ -145,6 +142,7 @@ host-requires = [
145142
"pkg:generic/iml",
146143
"pkg:generic/lcalc",
147144
"pkg:generic/libbraiding",
145+
"pkg:generic/libgd",
148146
"pkg:generic/libhomfly",
149147
"pkg:generic/linbox",
150148
"pkg:generic/lrcalc",
@@ -162,19 +160,21 @@ host-requires = [
162160
"pkg:generic/pari-galdata",
163161
"pkg:generic/pari-seadata",
164162
"pkg:generic/planarity",
165-
"pkg:generic/primesieve",
166163
"pkg:generic/primecount",
164+
"pkg:generic/primesieve",
167165
"pkg:generic/qhull",
168166
"pkg:generic/rw",
169167
"pkg:generic/singular",
170168
"pkg:generic/symmetrica",
171169
"pkg:generic/sympow",
170+
"virtual:compiler/fortran",
171+
"virtual:interface/blas",
172172
]
173173

174174
dependencies = [
175-
"pkg:generic/sagemath-polytopes-db",
176175
"pkg:generic/sagemath-elliptic-curves",
177176
"pkg:generic/sagemath-graphs",
177+
"pkg:generic/sagemath-polytopes-db",
178178
"pkg:generic/tachyon",
179179
]
180180

@@ -207,17 +207,17 @@ extra = [
207207
]
208208

209209
[dependency-groups]
210-
test = ["pytest", "pytest-xdist", "coverage"]
210+
dev = ["conda-lock", "grayskull", "meson", "pygithub", "toml", "tqdm", "uv"]
211211
docs = [
212+
"furo",
213+
"jupyter-sphinx",
214+
"python-dateutil",
212215
"sphinx",
213216
"sphinx-copybutton",
214217
"sphinx-inline-tabs",
215-
"jupyter-sphinx",
216-
"furo",
217-
"python-dateutil",
218218
]
219-
lint = ["relint", "ruff", "pycodestyle", "flake8-rst-docstrings"]
220-
dev = ["tqdm", "pygithub", "meson", "conda-lock", "grayskull", "toml", "uv"]
219+
lint = ["flake8-rst-docstrings", "pycodestyle", "relint", "ruff"]
220+
test = ["coverage", "pytest", "pytest-xdist"]
221221

222222
[tool.ruff]
223223
# https://docs.astral.sh/ruff/configuration
@@ -226,15 +226,15 @@ dev = ["tqdm", "pygithub", "meson", "conda-lock", "grayskull", "toml", "uv"]
226226
target-version = "py311"
227227

228228
[tool.ruff.lint]
229-
select = [
230-
"E", # pycodestyle errors - https://docs.astral.sh/ruff/rules/#error-e
231-
"F", # pyflakes - https://docs.astral.sh/ruff/rules/#pyflakes-f
232-
"I", # isort - https://docs.astral.sh/ruff/rules/#isort-i
233-
"PL", # pylint - https://docs.astral.sh/ruff/rules/#pylint-pl
234-
]
235229
ignore = [
236230
"E501", # Line too long - hard to avoid in doctests, and better handled by black.
237231
]
232+
select = [
233+
"E", # pycodestyle errors - https://docs.astral.sh/ruff/rules/#error-e
234+
"F", # pyflakes - https://docs.astral.sh/ruff/rules/#pyflakes-f
235+
"I", # isort - https://docs.astral.sh/ruff/rules/#isort-i
236+
"PL", # pylint - https://docs.astral.sh/ruff/rules/#pylint-pl
237+
]
238238

239239
[tool.ruff.lint.per-file-ignores]
240240
"all.py" = [

0 commit comments

Comments
 (0)