Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incremental 24.7.0 breaks arbitrary projects #100

Closed
mgorny opened this issue Jul 26, 2024 · 5 comments · Fixed by #104
Closed

incremental 24.7.0 breaks arbitrary projects #100

mgorny opened this issue Jul 26, 2024 · 5 comments · Fixed by #104

Comments

@mgorny
Copy link

mgorny commented Jul 26, 2024

After upgrading incremental to 24.7.0, various projects (that never used it) fail to build now, e.g. stripe:

pypy3 -m gpep517 build-wheel --prefix=/usr --backend setuptools.build_meta:__legacy__ --output-fd 3 --wheel-dir /tmp/portage/dev-python/stripe-10.5.0/work/stripe-10.5.0-pypy3/wheel
2024-07-26 03:44:10,409 gpep517 INFO Building wheel via backend setuptools.build_meta:__legacy__
Traceback (most recent call last):
  File "/usr/lib/pypy3.10/site-packages/incremental/__init__.py", line 487, in _load_pyproject_toml
    package = data["project"]["name"]
KeyError: 'project'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/pypy3.10/runpy.py", line 199, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/pypy3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/lib/pypy3.10/site-packages/gpep517/__main__.py", line 443, in <module>
    sys.exit(main())
  File "/usr/lib/pypy3.10/site-packages/gpep517/__main__.py", line 439, in main
    return func(args)
  File "/usr/lib/pypy3.10/site-packages/gpep517/__main__.py", line 229, in build_wheel
    print(build_wheel_impl(args, args.wheel_dir), file=out)
  File "/usr/lib/pypy3.10/site-packages/gpep517/__main__.py", line 221, in build_wheel_impl
    wheel_name = backend.build_wheel(str(wheel_dir), args.config_json)
  File "/usr/lib/pypy3.10/site-packages/setuptools/build_meta.py", line 415, in build_wheel
    return self._build_with_temp_dir(
  File "/usr/lib/pypy3.10/site-packages/setuptools/build_meta.py", line 397, in _build_with_temp_dir
    self.run_setup()
  File "/usr/lib/pypy3.10/site-packages/setuptools/build_meta.py", line 497, in run_setup
    super().run_setup(setup_script=setup_script)
  File "/usr/lib/pypy3.10/site-packages/setuptools/build_meta.py", line 313, in run_setup
    exec(code, locals())
  File "<string>", line 19, in <module>
  File "/usr/lib/pypy3.10/site-packages/setuptools/__init__.py", line 108, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/pypy3.10/site-packages/setuptools/_distutils/core.py", line 146, in setup
    _setup_distribution = dist = klass(attrs)
  File "/usr/lib/pypy3.10/site-packages/setuptools/dist.py", line 289, in __init__
    _Distribution.__init__(self, dist_attrs)
  File "/usr/lib/pypy3.10/site-packages/setuptools/_distutils/dist.py", line 286, in __init__
    self.finalize_options()
  File "/usr/lib/pypy3.10/site-packages/setuptools/dist.py", line 641, in finalize_options
    ep(self)
  File "/usr/lib/pypy3.10/site-packages/incremental/__init__.py", line 402, in _get_setuptools_version
    config = _load_pyproject_toml("./pyproject.toml")
  File "/usr/lib/pypy3.10/site-packages/incremental/__init__.py", line 489, in _load_pyproject_toml
    raise ValueError("""\
ValueError: Couldn't extract the package name from pyproject.toml. Specify it like:

    [project]
    name = "Foo"

Or:

    [tool.incremental]
    name = "Foo"

In fact, I can't even build the previous version of incremental itself.

@kyluca
Copy link

kyluca commented Jul 26, 2024

Encountered the same issue on a few of our internal builds this morning too. We use pyproject.toml for configuring a suite of third party packages, but not for the project itself (still using setup.py instead).

Our workaround was to pin to the previous version incremental==22.10.0. Worth noting we also use towncrier, which has an uncapped dependency on incremental so that's how it got the latest version pulled in.

The command that triggered the same error for us was python setup.py bdist_wheel, however some of our other builds which use the newer python -m build --wheel command were unaffected.

@twm
Copy link
Contributor

twm commented Jul 26, 2024

Hmm, looking at the stripe setup.py it should be a no-op from Incremental's perspective. There is no use_incremental=True opt-in. There is a pyproject.toml with various tool configs which triggers this bug.

I'll put together a fix shortly.

@twm
Copy link
Contributor

twm commented Jul 26, 2024

Given this can potentially break the build of any setuptools-based project, generally causing havoc, I've yanked release 24.7.0 on PyPI so that folks don't automatically upgrade.

@mgorny
Copy link
Author

mgorny commented Jul 27, 2024

Thank you!

@twm
Copy link
Contributor

twm commented Jul 27, 2024

Thank you for the report! (And sorry for the breakage.)

github-actions bot pushed a commit to aio-libs/aiohttp that referenced this issue Aug 20, 2024
Bumps [incremental](https://github.com/twisted/incremental) from 22.10.0
to 24.7.2.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/twisted/incremental/blob/trunk/NEWS.rst">incremental's
changelog</a>.</em></p>
<blockquote>
<h1>Incremental 24.7.2 (2024-07-29)</h1>
<h2>Bugfixes</h2>
<ul>
<li>
<p>Incremental could mis-identify that a project had opted in to version
management.</p>
<p>If a <code>pyproject.toml</code> in the current directory contained a
<code>[project]</code> table with a <code>name</code> key, but did not
contain the opt-in <code>[tool.incremental]</code> table, Incremental
would still treat the file as if the opt-in were present and attempt to
validate the configuration. This could happen in contexts outside of
packaging, such as when creating a virtualenv. When operating as a
setuptools plugin Incremental now always ignores invalid configuration,
such as configuration that doesn't match the content of the working
directory.
(<code>[#106](twisted/incremental#106)
&lt;https://github.com/twisted/incremental/issues/106&gt;</code>__)</p>
</li>
</ul>
<h1>Incremental 24.7.1 (2024-07-27)</h1>
<h2>Bugfixes</h2>
<ul>
<li>Incremental 24.7.0 would produce an error when parsing the
<code>pyproject.toml</code> of a project that lacked the
<code>use_incremental=True</code> or <code>[tool.incremental]</code>
opt-in markers if that file lacked a <code>[project]</code> section
containing the package name. This could cause a project that only uses
<code>pyproject.toml</code> to configure tools to fail to build if
Incremental is installed. Incremental now ignores such projects.
(<code>[#100](twisted/incremental#100)
&lt;https://github.com/twisted/incremental/issues/100&gt;</code>__)</li>
</ul>
<h2>Misc</h2>
<ul>
<li><code>[#101](twisted/incremental#101)
&lt;https://github.com/twisted/incremental/issues/101&gt;</code>__</li>
</ul>
<h1>Incremental 24.7.0 (2024-07-25)</h1>
<h2>Features</h2>
<ul>
<li>Incremental can now be configured using <code>pyproject.toml</code>.
(<code>[#90](twisted/incremental#90)
&lt;https://github.com/twisted/incremental/issues/90&gt;</code>__)</li>
<li>Incremental now provides a read-only <code>Hatchling version source
plugin
&lt;https://hatch.pypa.io/latest/plugins/version-source/reference/&gt;</code>_.
(<code>[#93](twisted/incremental#93)
&lt;https://github.com/twisted/incremental/issues/93&gt;</code>__)</li>
</ul>
<h2>Bugfixes</h2>
<ul>
<li>Incremental no longer inserts a dot before the rc version component
(i.e., <code>1.2.3rc1</code> instead of <code>1.2.3.rc1</code>),
resulting in version numbers in the <code>canonical format
&lt;https://packaging.python.org/en/latest/specifications/version-specifiers/#public-version-identifiers&gt;</code><strong>.
(<code>[#81](twisted/incremental#81)
&lt;https://github.com/twisted/incremental/issues/81&gt;</code></strong>)</li>
<li>Incremental's tests are now included in the sdist release artifact.
(<code>[#80](twisted/incremental#80)
&lt;https://github.com/twisted/incremental/issues/80&gt;</code>__)</li>
</ul>
<h2>Deprecations and Removals</h2>
<ul>
<li><code>incremental[scripts]</code> no longer depends on Twisted.
(<code>[#88](twisted/incremental#88)
&lt;https://github.com/twisted/incremental/issues/88&gt;</code>__)</li>
<li>Support for Python 2.7 has been dropped for lack of test
infrastructure. We no longer provide universal wheels.
(<code>[#86](twisted/incremental#86)
&lt;https://github.com/twisted/incremental/issues/86&gt;</code>__)</li>
<li>Support for Python 3.5, 3.6, and 3.7 has been dropped for lack of
test infrastructure.
(<code>[#92](twisted/incremental#92)
&lt;https://github.com/twisted/incremental/issues/92&gt;</code>__)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/twisted/incremental/commit/32be98f929cc45b6a1b588e865dcf8c220b6c7f6"><code>32be98f</code></a>
Release Incremental 24.7.2</li>
<li><a
href="https://github.com/twisted/incremental/commit/380e66970918027bc7fbbb393453de7cd8d7a555"><code>380e669</code></a>
Merge pull request <a
href="https://redirect.github.com/twisted/incremental/issues/107">#107</a>
from twisted/106-never-raise</li>
<li><a
href="https://github.com/twisted/incremental/commit/a559f5c770ec93c95abaadfc8693d7ae654c6e39"><code>a559f5c</code></a>
Allow syntax errors to propagate</li>
<li><a
href="https://github.com/twisted/incremental/commit/3d2cdb172c7d5c7e27903c0949128f0aa7888741"><code>3d2cdb1</code></a>
Cleanups to shorten the diff</li>
<li><a
href="https://github.com/twisted/incremental/commit/d2fe36fa5bb5bb13bfbeb3461154fadd5d709993"><code>d2fe36f</code></a>
Defense in depth</li>
<li><a
href="https://github.com/twisted/incremental/commit/d659ea0ed0f8518608f40065aa5e6ad6dd2a69be"><code>d659ea0</code></a>
There and back again</li>
<li><a
href="https://github.com/twisted/incremental/commit/11ad4133e2857b37f140bfee835135f8cf1b6ad0"><code>11ad413</code></a>
Update the readme</li>
<li><a
href="https://github.com/twisted/incremental/commit/0f7001c2bf5cc3d24f6d273067b2e88866bff6d1"><code>0f7001c</code></a>
Tidy up some comments</li>
<li><a
href="https://github.com/twisted/incremental/commit/4adf23bb48cfbc35e75d44c4863b2dc73d4e9563"><code>4adf23b</code></a>
Add newsfragment</li>
<li><a
href="https://github.com/twisted/incremental/commit/b5ad0545b572ede441d73c35d8ff882f430e64d1"><code>b5ad054</code></a>
100% coverage, why not?</li>
<li>Additional commits viewable in <a
href="https://github.com/twisted/incremental/compare/incremental-22.10.0...incremental-24.7.2">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=incremental&package-manager=pip&previous-version=22.10.0&new-version=24.7.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
github-actions bot pushed a commit to aio-libs/aiohttp that referenced this issue Aug 21, 2024
Bumps [incremental](https://github.com/twisted/incremental) from 22.10.0
to 24.7.2.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/twisted/incremental/blob/trunk/NEWS.rst">incremental's
changelog</a>.</em></p>
<blockquote>
<h1>Incremental 24.7.2 (2024-07-29)</h1>
<h2>Bugfixes</h2>
<ul>
<li>
<p>Incremental could mis-identify that a project had opted in to version
management.</p>
<p>If a <code>pyproject.toml</code> in the current directory contained a
<code>[project]</code> table with a <code>name</code> key, but did not
contain the opt-in <code>[tool.incremental]</code> table, Incremental
would still treat the file as if the opt-in were present and attempt to
validate the configuration. This could happen in contexts outside of
packaging, such as when creating a virtualenv. When operating as a
setuptools plugin Incremental now always ignores invalid configuration,
such as configuration that doesn't match the content of the working
directory.
(<code>[#106](twisted/incremental#106)
&lt;https://github.com/twisted/incremental/issues/106&gt;</code>__)</p>
</li>
</ul>
<h1>Incremental 24.7.1 (2024-07-27)</h1>
<h2>Bugfixes</h2>
<ul>
<li>Incremental 24.7.0 would produce an error when parsing the
<code>pyproject.toml</code> of a project that lacked the
<code>use_incremental=True</code> or <code>[tool.incremental]</code>
opt-in markers if that file lacked a <code>[project]</code> section
containing the package name. This could cause a project that only uses
<code>pyproject.toml</code> to configure tools to fail to build if
Incremental is installed. Incremental now ignores such projects.
(<code>[#100](twisted/incremental#100)
&lt;https://github.com/twisted/incremental/issues/100&gt;</code>__)</li>
</ul>
<h2>Misc</h2>
<ul>
<li><code>[#101](twisted/incremental#101)
&lt;https://github.com/twisted/incremental/issues/101&gt;</code>__</li>
</ul>
<h1>Incremental 24.7.0 (2024-07-25)</h1>
<h2>Features</h2>
<ul>
<li>Incremental can now be configured using <code>pyproject.toml</code>.
(<code>[#90](twisted/incremental#90)
&lt;https://github.com/twisted/incremental/issues/90&gt;</code>__)</li>
<li>Incremental now provides a read-only <code>Hatchling version source
plugin
&lt;https://hatch.pypa.io/latest/plugins/version-source/reference/&gt;</code>_.
(<code>[#93](twisted/incremental#93)
&lt;https://github.com/twisted/incremental/issues/93&gt;</code>__)</li>
</ul>
<h2>Bugfixes</h2>
<ul>
<li>Incremental no longer inserts a dot before the rc version component
(i.e., <code>1.2.3rc1</code> instead of <code>1.2.3.rc1</code>),
resulting in version numbers in the <code>canonical format
&lt;https://packaging.python.org/en/latest/specifications/version-specifiers/#public-version-identifiers&gt;</code><strong>.
(<code>[#81](twisted/incremental#81)
&lt;https://github.com/twisted/incremental/issues/81&gt;</code></strong>)</li>
<li>Incremental's tests are now included in the sdist release artifact.
(<code>[#80](twisted/incremental#80)
&lt;https://github.com/twisted/incremental/issues/80&gt;</code>__)</li>
</ul>
<h2>Deprecations and Removals</h2>
<ul>
<li><code>incremental[scripts]</code> no longer depends on Twisted.
(<code>[#88](twisted/incremental#88)
&lt;https://github.com/twisted/incremental/issues/88&gt;</code>__)</li>
<li>Support for Python 2.7 has been dropped for lack of test
infrastructure. We no longer provide universal wheels.
(<code>[#86](twisted/incremental#86)
&lt;https://github.com/twisted/incremental/issues/86&gt;</code>__)</li>
<li>Support for Python 3.5, 3.6, and 3.7 has been dropped for lack of
test infrastructure.
(<code>[#92](twisted/incremental#92)
&lt;https://github.com/twisted/incremental/issues/92&gt;</code>__)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/twisted/incremental/commit/32be98f929cc45b6a1b588e865dcf8c220b6c7f6"><code>32be98f</code></a>
Release Incremental 24.7.2</li>
<li><a
href="https://github.com/twisted/incremental/commit/380e66970918027bc7fbbb393453de7cd8d7a555"><code>380e669</code></a>
Merge pull request <a
href="https://redirect.github.com/twisted/incremental/issues/107">#107</a>
from twisted/106-never-raise</li>
<li><a
href="https://github.com/twisted/incremental/commit/a559f5c770ec93c95abaadfc8693d7ae654c6e39"><code>a559f5c</code></a>
Allow syntax errors to propagate</li>
<li><a
href="https://github.com/twisted/incremental/commit/3d2cdb172c7d5c7e27903c0949128f0aa7888741"><code>3d2cdb1</code></a>
Cleanups to shorten the diff</li>
<li><a
href="https://github.com/twisted/incremental/commit/d2fe36fa5bb5bb13bfbeb3461154fadd5d709993"><code>d2fe36f</code></a>
Defense in depth</li>
<li><a
href="https://github.com/twisted/incremental/commit/d659ea0ed0f8518608f40065aa5e6ad6dd2a69be"><code>d659ea0</code></a>
There and back again</li>
<li><a
href="https://github.com/twisted/incremental/commit/11ad4133e2857b37f140bfee835135f8cf1b6ad0"><code>11ad413</code></a>
Update the readme</li>
<li><a
href="https://github.com/twisted/incremental/commit/0f7001c2bf5cc3d24f6d273067b2e88866bff6d1"><code>0f7001c</code></a>
Tidy up some comments</li>
<li><a
href="https://github.com/twisted/incremental/commit/4adf23bb48cfbc35e75d44c4863b2dc73d4e9563"><code>4adf23b</code></a>
Add newsfragment</li>
<li><a
href="https://github.com/twisted/incremental/commit/b5ad0545b572ede441d73c35d8ff882f430e64d1"><code>b5ad054</code></a>
100% coverage, why not?</li>
<li>Additional commits viewable in <a
href="https://github.com/twisted/incremental/compare/incremental-22.10.0...incremental-24.7.2">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=incremental&package-manager=pip&previous-version=22.10.0&new-version=24.7.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants