Skip to content

Commit f306d7e

Browse files
committed
Format toml files and add linter check
1 parent d617df4 commit f306d7e

File tree

3 files changed

+112
-92
lines changed

3 files changed

+112
-92
lines changed

.github/workflows/lint.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,8 @@ jobs:
4242
- name: Validate docstring markup as RST
4343
if: (success() || failure()) && steps.deps.outcome == 'success'
4444
run: uv run --frozen --only-group lint -- flake8 --select=RST src/sage/ --config src/tox.ini
45+
46+
- name: TOML format check with taplo
47+
uses: docker://tamasfe/taplo:0.10.0
48+
with:
49+
args: format --check 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: 97 additions & 92 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',
6-
'cypari2 >=2.2.1; sys_platform != "win32"',
7-
# Exclude 1.12.0 because of https://github.com/sagemath/cysignals/issues/212
8-
'cysignals >=1.11.2, != 1.12.0',
9-
# Exclude 3.0.3 because of https://github.com/cython/cython/issues/5748
10-
'cython >=3.0, != 3.0.3',
11-
'gmpy2 ~=2.1.b999',
12-
'memory_allocator',
13-
'numpy >=1.25',
14-
'jinja2'
5+
'cypari2 >=2.2.1; sys_platform != "win32"',
6+
'meson-python',
7+
# Exclude 1.12.0 because of https://github.com/sagemath/cysignals/issues/212
8+
'cysignals >=1.11.2, != 1.12.0',
9+
# Exclude 3.0.3 because of https://github.com/cython/cython/issues/5748
10+
'cython >=3.0, != 3.0.3',
11+
'gmpy2 ~=2.1.b999',
12+
'jinja2',
13+
'memory_allocator',
14+
'numpy >=1.25',
1515
]
1616
[tool.meson-python.args]
1717
# Prevent meson from trying to install the autoconf subprojects
@@ -25,87 +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+
{ name = "The Sage Developers", email = "[email protected]" },
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',
32-
'conway-polynomials >=0.8',
33-
'cypari2 >=2.2.1; sys_platform != "win32"',
34-
# Exclude 1.12.0 because of https://github.com/sagemath/cysignals/issues/212
35-
'cysignals >=1.11.2, != 1.12.0',
36-
'cython >=3.0, != 3.0.3',
37-
'gmpy2 ~=2.1.b999',
38-
'lrcalc ~=2.1; sys_platform != "win32"',
39-
'memory_allocator',
40-
'numpy >=1.25',
41-
# Issue #30922: pplpy 0.8.4 and earlier do not declare dependencies correctly
42-
'pplpy >=0.8.6; sys_platform != "win32"',
43-
'primecountpy; sys_platform != "win32"',
44-
'requests >=2.13.0',
45-
# According to https://github.com/python/typing_extensions/blob/main/CHANGELOG.md,
46-
# version 4.4.0 adds another Python 3.11 typing backport
47-
'typing_extensions >= 4.4.0; python_version<"3.11"',
48-
'ipython >=8.9.0',
49-
'pexpect >=4.8.0',
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',
62-
# TODO: Remove this once the migration to meson is complete
63-
'pkgconfig',
64-
'traitlets',
46+
'conway-polynomials >=0.8',
47+
'cypari2 >=2.2.1; sys_platform != "win32"',
48+
'six >=1.15.0',
49+
# Exclude 1.12.0 because of https://github.com/sagemath/cysignals/issues/212
50+
'cysignals >=1.11.2, != 1.12.0',
51+
'cython >=3.0, != 3.0.3',
52+
'gmpy2 ~=2.1.b999',
53+
'lrcalc ~=2.1; sys_platform != "win32"',
54+
'memory_allocator',
55+
'numpy >=1.25',
56+
# Issue #30922: pplpy 0.8.4 and earlier do not declare dependencies correctly
57+
'pplpy >=0.8.6; sys_platform != "win32"',
58+
'primecountpy; sys_platform != "win32"',
59+
'requests >=2.13.0',
60+
# According to https://github.com/python/typing_extensions/blob/main/CHANGELOG.md,
61+
# version 4.4.0 adds another Python 3.11 typing backport
62+
'fpylll >=0.5.9; sys_platform != "win32"',
63+
'ipykernel >=5.2.1',
64+
'ipython >=8.9.0',
65+
'ipywidgets >=7.5.1',
66+
'jupyter-client',
67+
'matplotlib >=3.7.0',
68+
'mpmath >=1.1.0',
69+
'networkx >=3.1',
70+
'pexpect >=4.8.0',
71+
'pillow >=7.2.0',
72+
'ptyprocess > 0.5',
73+
'scipy >=1.11',
74+
'sphinx >=5.2, <9',
75+
'sympy >=1.6, <2.0',
76+
'typing_extensions >= 4.4.0; python_version<"3.11"',
77+
# TODO: Remove this once the migration to meson is complete
78+
'pkgconfig',
79+
'traitlets',
6580
]
81+
description = "Sage: Open Source Mathematics Software: Standard Python Library"
6682
dynamic = ["version"]
67-
license = {text = "GNU General Public License (GPL) v2 or later"}
68-
authors = [{name = "The Sage Developers", email = "[email protected]"}]
69-
classifiers = [
70-
"Development Status :: 6 - Mature",
71-
"Intended Audience :: Education",
72-
"Intended Audience :: Science/Research",
73-
"License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)",
74-
"Operating System :: POSIX",
75-
"Operating System :: MacOS :: MacOS X",
76-
"Programming Language :: Python :: 3 :: Only",
77-
"Programming Language :: Python :: 3.11",
78-
"Programming Language :: Python :: 3.12",
79-
"Programming Language :: Python :: 3.13",
80-
"Programming Language :: Python :: Implementation :: CPython",
81-
"Topic :: Scientific/Engineering :: Mathematics",
82-
]
83-
urls = {Homepage = "https://www.sagemath.org"}
83+
license = { text = "GNU General Public License (GPL) v2 or later" }
84+
name = "sagemath"
8485
requires-python = ">=3.11, <3.14"
86+
urls = { Homepage = "https://www.sagemath.org" }
8587

8688
[project.optional-dependencies]
8789
R = [
88-
'rpy2 >=3.3',
90+
'rpy2 >=3.3',
8991
]
9092
giac = [
91-
'sagemath_giac',
93+
'sagemath_giac',
9294
]
9395

9496
[project.readme]
95-
file = "README.md"
9697
content-type = "text/markdown"
98+
file = "README.md"
9799

98100
[project.scripts]
99101
sage = "sage.cli:main"
100102

101103
[tool.conda-lock]
102104
platforms = [
103-
'osx-64', 'linux-64', 'linux-aarch64', 'osx-arm64'
105+
'linux-64',
106+
'linux-aarch64',
107+
'osx-64',
108+
'osx-arm64',
104109
]
105110

106111
[tool.pytest.ini_options]
107-
python_files = "*_test.py"
108112
norecursedirs = "local prefix venv build builddir pkgs .git src/doc src/bin src/sage_setup/autogen/flint tools"
113+
python_files = "*_test.py"
109114
# The "no:warnings" is to stop pytest from capturing warnings so that they are printed to the output of the doctest
110115
addopts = "--import-mode importlib -p no:warnings"
111116
doctest_optionflags = "NORMALIZE_WHITESPACE ELLIPSIS"
@@ -115,14 +120,12 @@ consider_namespace_packages = true
115120
# External dependencies in the format proposed by https://peps.python.org/pep-0725
116121
[external]
117122
build-requires = [
123+
"pkg:generic/pkg-config",
118124
"virtual:compiler/c",
119125
"virtual:compiler/cpp",
120-
"pkg:generic/pkg-config"
121126
]
122127

123128
host-requires = [
124-
"virtual:interface/blas",
125-
"virtual:compiler/fortran",
126129
"pkg:generic/boost",
127130
"pkg:generic/brial",
128131
"pkg:generic/cddlib",
@@ -132,7 +135,6 @@ host-requires = [
132135
"pkg:generic/ecm",
133136
"pkg:generic/fflas-ffpack",
134137
"pkg:generic/flint",
135-
"pkg:generic/libgd",
136138
"pkg:generic/gap",
137139
"pkg:generic/gfan",
138140
"pkg:generic/givaro",
@@ -142,6 +144,7 @@ host-requires = [
142144
"pkg:generic/iml",
143145
"pkg:generic/lcalc",
144146
"pkg:generic/libbraiding",
147+
"pkg:generic/libgd",
145148
"pkg:generic/libhomfly",
146149
"pkg:generic/linbox",
147150
"pkg:generic/lrcalc",
@@ -159,46 +162,48 @@ host-requires = [
159162
"pkg:generic/pari-galdata",
160163
"pkg:generic/pari-seadata",
161164
"pkg:generic/planarity",
162-
"pkg:generic/primesieve",
163165
"pkg:generic/primecount",
166+
"pkg:generic/primesieve",
164167
"pkg:generic/qhull",
165168
"pkg:generic/rw",
166169
"pkg:generic/singular",
167170
"pkg:generic/symmetrica",
168171
"pkg:generic/sympow",
172+
"virtual:compiler/fortran",
173+
"virtual:interface/blas",
169174
]
170175

171176
dependencies = [
172-
"pkg:generic/sagemath-polytopes-db",
173177
"pkg:generic/sagemath-elliptic-curves",
174178
"pkg:generic/sagemath-graphs",
179+
"pkg:generic/sagemath-polytopes-db",
175180
"pkg:generic/tachyon",
176181
]
177182

178183
[dependency-groups]
179-
test = [
180-
"pytest",
181-
"pytest-xdist",
182-
"coverage",
184+
dev = [
185+
"conda-lock",
186+
"grayskull",
187+
"meson",
188+
"pygithub",
189+
"toml",
190+
"tqdm",
183191
]
184192
docs = [
185-
"sphinx",
186-
"sphinx-inline-tabs",
187193
"furo",
194+
"sphinx",
195+
"sphinx-inline-tabs",
188196
]
189197
lint = [
198+
"flake8-rst-docstrings",
199+
"pycodestyle",
190200
"relint",
191201
"ruff",
192-
"pycodestyle",
193-
"flake8-rst-docstrings",
194202
]
195-
dev = [
196-
"tqdm",
197-
"pygithub",
198-
"meson",
199-
"conda-lock",
200-
"grayskull",
201-
"toml",
203+
test = [
204+
"coverage",
205+
"pytest",
206+
"pytest-xdist",
202207
]
203208

204209
[tool.ruff]
@@ -208,15 +213,15 @@ dev = [
208213
target-version = "py311"
209214

210215
[tool.ruff.lint]
216+
ignore = [
217+
"E501", # Line too long - hard to avoid in doctests, and better handled by black.
218+
]
211219
select = [
212220
"E", # pycodestyle errors - https://docs.astral.sh/ruff/rules/#error-e
213221
"F", # pyflakes - https://docs.astral.sh/ruff/rules/#pyflakes-f
214222
"I", # isort - https://docs.astral.sh/ruff/rules/#isort-i
215223
"PL", # pylint - https://docs.astral.sh/ruff/rules/#pylint-pl
216224
]
217-
ignore = [
218-
"E501", # Line too long - hard to avoid in doctests, and better handled by black.
219-
]
220225

221226
[tool.ruff.lint.per-file-ignores]
222227
"all.py" = [

0 commit comments

Comments
 (0)