[PATCH v1] Add a pyproject.toml file

Claudio Bantaloukas via Sourceware Forge <[email protected]>
Newsgroups gmane.comp.gcc.patches
Message-ID <[email protected]>
From: Claudio Bantaloukas <[email protected]>

The gcc repository has accrued a number of python
scripts over time.
They serve useful functions, but their dependencies
are not extensively documented and this creates a
needless barrier to their use. A pyproject.toml file,
while not removing the ability of users to use their
system's python interpreter and assorted
distribution-provided python packages, makes it
clear when some packages may have further
requirements and allows use of the widely used
pip and uv tools.

The file is meant for gcc developers to use when
hacking on gcc. As such, it will not install any
script. Dependencies are expressed in as wide a
range as possible with an upper limit on major
versions of packages respecting semver rules.
The exception is the black formatter, which is
deliberately constrained to the 2026 edition in order
to have a consistent and documented formatting target.

Changelog:
	PR other/126226
	* .gitignore: Ignore python eggs.
	* pyproject.toml: New file.
---
The addition of a pyproject.toml file is a prerequisite for PR126226.
A consistently set version of black makes the expected formatting
for python code unambiguous.



This is a forge pull request published on the gcc-patches mailing list mailing list
as requested by Claudio Bantaloukas via Sourceware Forge <[email protected]>.
Forge discussion: https://forge.sourceware.org/gcc/gcc/pulls/219

Get it locally using:
```
git fetch forge-upstream "+refs/versioned_pull/219/*:refs/versioned_pull/219/*"
git switch -c "pr-219-v1" "refs/versioned_pull/219/1/head"
```
Or, download the patch at: https://forge.sourceware.org/gcc/gcc/pulls/219.diff
Created on: 2026-08-18 11:52:20+00:00
Latest update: 2026-08-18 11:54:45+00:00
Changes: 2 changed files, 82 additions, 0 deletions
Head revision: gcc/gcc ref refs/pull/219/head commit b661d80cefb1b4c0278d66a7680565c74f091a46 
Base revision: gcc/gcc ref trunk commit 48a94d04c984457797693bd454ff01f916dda99c r17-3350-g48a94d04c98445
Merge base: 48a94d04c984457797693bd454ff01f916dda99c
Requested Reviewers: 

Changed files:
- A: pyproject.toml
- M: .gitignore

 .gitignore     |  1 +
 pyproject.toml | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 82 insertions(+)
 create mode 100644 pyproject.toml

diff --git a/.gitignore b/.gitignore
index f044fe16b5f6d..ef1b4447f6624 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,6 +15,7 @@
 *.lo
 *.o
 *.pyc
+*.egg-info
 *.tmp
 *.a
 
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000000000..32e3db6118479
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,81 @@
+# Copyright (C) 2026 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GCC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING.  If not, write to
+# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# This pyproject.toml file is used to facilitate installation of all required
+# python dependencies.  It is not used to distribute gcc related packages.
+#
+# Users of uv can get all potentially needed with
+#   uv sync --all-groups
+# Whereas users of pip can use
+#   python -m pip install . --group all
+# Note that these include packages only used in a subset of projects.
+
+[build-system]
+requires = ["setuptools>=66.1"]
+build-backend = "setuptools.build_meta"
+
+[project]
+name = "gcc"
+dynamic = ["version"]
+description = "Tools used when building and developing gcc"
+readme = "README"
+# As of August 2026, upstream python supports only versions from 3.10 and above.
+# Currently supported LTS distributions and unices all provide packages for
+# at least python 3.10.
+# pip added support for groups in 25.1 which requires python version 3.9
+# pytest-pyodide, used by libffi, requires python 3.10
+# black 26.0 requires python 3.10
+requires-python = ">=3.10"
+
+# Upper bounds below are conservative compatibility limits; not all projects
+# publish or strictly follow Semantic Versioning.
+dependencies = [
+	# we keep the black version pinned to an explicit calendar year
+	# in order to take advantage of black's stability policy.
+	"black ~= 26.0",
+	"GitPython<4",
+	"jsonschema<5",
+	"polib ~= 1.2.0",     # does not indicate use of semver
+	"pytest<10",
+	"python-dateutil<3",  # does not indicate use of semver
+	"PyYAML<7",           # does not indicate use of semver
+	"requests<3",
+	"semantic-version<3",
+	"Unidecode<2",        # does not indicate use of semver
+	"unidiff<2",          # does not indicate use of semver
+]
+
+[dependency-groups]
+ada = ["Pygments<3"]
+libffi = ["pytest-pyodide"]
+all = [
+	{ include-group = "ada" },
+	{ include-group = "libffi" },
+]
+
+[tool.setuptools]
+# Disable package discovery
+packages = []
+
+[tool.setuptools.dynamic]
+version = { file = ["gcc/BASE-VER"] }
+
+[tool.black]
+# target is same as requires-python
+target-version = ["py310"]
-- 
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.