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

Allow path dependency that is missing build-system #675

Merged
merged 6 commits into from
Dec 18, 2023

Conversation

oysols
Copy link
Contributor

@oysols oysols commented Dec 16, 2023

Missing [build-system] table should be allowed.
Poetry handles this fine, except for this check.

Tools should not require the existence of the [build-system] table.
https://packaging.python.org/en/latest/specifications/pyproject-toml/


  • Added tests for changed code.
  • Updated documentation for changed code.

oysols and others added 2 commits December 16, 2023 18:45
Missing [build-system] table should be allowed.
Poetry handles this fine, except for this check.

> Tools should not require the existence of the [build-system] table.
https://packaging.python.org/en/latest/specifications/pyproject-toml/
@dimbleby
Copy link
Contributor

per the PEP, the correct check for supports_pep517 would be

If the pyproject.toml file is absent, or the build-backend key is missing, the source tree is not using this specification

the section that you quote relates to PEP518's build-system, not PEP517's build-backend

@oysols
Copy link
Contributor Author

oysols commented Dec 16, 2023

I agree. This implements the simplified solution to this issue. The alternative would be deep validation of the toml file.

@radoering
Copy link
Member

I still don't understand what kind of problem you're trying to solve. Is it just that the name of the method does not match the current implementation or is there a deeper issue? (Afaik, a path dependency without a build system (and no setup.py/setup.cfg) is not installable from Poetry's point of view and thus is not supported so maybe we should just rename the method to is_installable_python_project()?)

Further, the following message is now even more outdated than before:

if not is_python_project(Path(name)):
raise ValueError(
f"Directory {name!r} is not installable. File 'setup.[py|cfg]' "
"not found."
)

@oysols
Copy link
Contributor Author

oysols commented Dec 17, 2023

A path dependency without a build system IS installable by Poetry, but this check blocked the installation. I tried to describe the issue with the new test case. As I read the spec (as linked earlier) that pyproject.toml should be valid and installable.

@dimbleby
Copy link
Contributor

indeed according to pip's reading, even an empty pyproject.toml is enough to define an installable package:

$ pip install .
Processing /home/dch/foo
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: UNKNOWN
  Building wheel for UNKNOWN (pyproject.toml) ... done
  Created wheel for UNKNOWN: filename=UNKNOWN-0.0.0-py3-none-any.whl size=923 sha256=1c1ca2513e561152af25077228c0b0adcc3e7bf389b9423e5db0fa0b185a6ada
  Stored in directory: /tmp/pip-ephem-wheel-cache-jgkqf7p1/wheels/74/36/59/5f272a8602c0655288a982d06e0ec48e94c6c3ccfe9d1f1d69
Successfully built UNKNOWN
Installing collected packages: UNKNOWN
Successfully installed UNKNOWN-0.0.0

@radoering
Copy link
Member

A path dependency without a build system IS installable by Poetry

Ah, of course it is since setuptools supports pyproject.toml. 🤦

Then, this makes sense of course and we should only change the error message I have already mentioned in #675 (comment).

indeed according to pip's reading, even an empty pyproject.toml is enough to define an installable package:

Weird...

Copy link

sonarcloud bot commented Dec 18, 2023

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@radoering radoering merged commit fba71c1 into python-poetry:main Dec 18, 2023
19 checks passed
mwalbeck pushed a commit to mwalbeck/docker-python-poetry that referenced this pull request Apr 12, 2024
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [poetry](https://python-poetry.org/) ([source](https://github.com/python-poetry/poetry), [changelog](https://python-poetry.org/history/)) | minor | `1.7.1` -> `1.8.2` |

---

### Release Notes

<details>
<summary>python-poetry/poetry (poetry)</summary>

### [`v1.8.2`](https://github.com/python-poetry/poetry/blob/HEAD/CHANGELOG.md#182---2024-03-02)

[Compare Source](python-poetry/poetry@1.8.1...1.8.2)

##### Fixed

-   Harden `lazy-wheel` error handling if the index server is behaving badly in an unexpected way ([#&#8203;9051](python-poetry/poetry#9051)).
-   Improve `lazy-wheel` error handling if the index server does not handle HTTP range requests correctly ([#&#8203;9082](python-poetry/poetry#9082)).
-   Improve `lazy-wheel` error handling if the index server pretends to support HTTP range requests but does not respect them ([#&#8203;9084](python-poetry/poetry#9084)).
-   Improve `lazy-wheel` to allow redirects for HEAD requests ([#&#8203;9087](python-poetry/poetry#9087)).
-   Improve debug logging for `lazy-wheel` errors ([#&#8203;9059](python-poetry/poetry#9059)).
-   Fix an issue where the hash of a metadata file could not be calculated correctly due to an encoding issue ([#&#8203;9048](python-poetry/poetry#9048)).
-   Fix an issue where `poetry add` failed in non-package mode if no project name was set ([#&#8203;9046](python-poetry/poetry#9046)).
-   Fix an issue where a hint to non-package mode was not compliant with the final name of the setting ([#&#8203;9073](python-poetry/poetry#9073)).

### [`v1.8.1`](https://github.com/python-poetry/poetry/blob/HEAD/CHANGELOG.md#181---2024-02-26)

[Compare Source](python-poetry/poetry@1.8.0...1.8.1)

##### Fixed

-   Update the minimum required version of `packaging` ([#&#8203;9031](python-poetry/poetry#9031)).
-   Handle unexpected responses from servers that do not support HTTP range requests with negative offsets more robust ([#&#8203;9030](python-poetry/poetry#9030)).

##### Docs

-   Rename `master` branch to `main` ([#&#8203;9022](python-poetry/poetry#9022)).

### [`v1.8.0`](https://github.com/python-poetry/poetry/blob/HEAD/CHANGELOG.md#180---2024-02-25)

[Compare Source](python-poetry/poetry@1.7.1...1.8.0)

##### Added

-   **Add a `non-package` mode for use cases where Poetry is only used for dependency management** ([#&#8203;8650](python-poetry/poetry#8650)).
-   **Add support for PEP 658 to fetch metadata without having to download wheels** ([#&#8203;5509](python-poetry/poetry#5509)).
-   **Add a `lazy-wheel` config option (default: `true`) to reduce wheel downloads during dependency resolution** ([#&#8203;8815](python-poetry/poetry#8815),
    [#&#8203;8941](python-poetry/poetry#8941)).
-   Improve performance of dependency resolution by using shallow copies instead of deep copies ([#&#8203;8671](python-poetry/poetry#8671)).
-   `poetry check` validates that no unknown sources are referenced in dependencies ([#&#8203;8709](python-poetry/poetry#8709)).
-   Add archive validation during installation for further hash algorithms ([#&#8203;8851](python-poetry/poetry#8851)).
-   Add a `to` key in `tool.poetry.packages` to allow custom subpackage names ([#&#8203;8791](python-poetry/poetry#8791)).
-   Add a config option to disable `keyring` ([#&#8203;8910](python-poetry/poetry#8910)).
-   Add a `--sync` option to `poetry update` ([#&#8203;8931](python-poetry/poetry#8931)).
-   Add an `--output` option to `poetry build` ([#&#8203;8828](python-poetry/poetry#8828)).
-   Add a `--dist-dir` option to `poetry publish` ([#&#8203;8828](python-poetry/poetry#8828)).

##### Changed

-   **The implicit PyPI source is disabled if at least one primary source is configured** ([#&#8203;8771](python-poetry/poetry#8771)).
-   **Deprecate source priority `default`** ([#&#8203;8771](python-poetry/poetry#8771)).
-   **Upgrade the warning about an inconsistent lockfile to an error** ([#&#8203;8737](python-poetry/poetry#8737)).
-   Deprecate setting `installer.modern-installation` to `false` ([#&#8203;8988](python-poetry/poetry#8988)).
-   Drop support for `pip<19` ([#&#8203;8894](python-poetry/poetry#8894)).
-   Require `requests-toolbelt>=1` ([#&#8203;8680](python-poetry/poetry#8680)).
-   Allow `platformdirs` 4.x ([#&#8203;8668](python-poetry/poetry#8668)).
-   Allow and require `xattr` 1.x on macOS ([#&#8203;8801](python-poetry/poetry#8801)).
-   Improve venv shell activation in `fish` ([#&#8203;8804](python-poetry/poetry#8804)).
-   Rename `system` to `base` in output of `poetry env info` ([#&#8203;8832](python-poetry/poetry#8832)).
-   Use pretty name in output of `poetry version` ([#&#8203;8849](python-poetry/poetry#8849)).
-   Improve error handling for invalid entries in `tool.poetry.scripts` ([#&#8203;8898](python-poetry/poetry#8898)).
-   Improve verbose output for dependencies with extras during dependency resolution ([#&#8203;8834](python-poetry/poetry#8834)).
-   Improve message about an outdated lockfile ([#&#8203;8962](python-poetry/poetry#8962)).

##### Fixed

-   Fix an issue where `poetry shell` failed when Python has been installed with MSYS2 ([#&#8203;8644](python-poetry/poetry#8644)).
-   Fix an issue where Poetry commands failed in a terminal with a non-UTF-8 encoding ([#&#8203;8608](python-poetry/poetry#8608)).
-   Fix an issue where a missing project name caused an incomprehensible error message ([#&#8203;8691](python-poetry/poetry#8691)).
-   Fix an issue where Poetry failed to install an `sdist` path dependency ([#&#8203;8682](python-poetry/poetry#8682)).
-   Fix an issue where `poetry install` failed because an unused extra was not available ([#&#8203;8548](python-poetry/poetry#8548)).
-   Fix an issue where `poetry install --sync` did not remove an unrequested extra ([#&#8203;8621](python-poetry/poetry#8621)).
-   Fix an issue where `poetry init` did not allow specific characters in the author field ([#&#8203;8779](python-poetry/poetry#8779)).
-   Fix an issue where Poetry could not download `sdists` from misconfigured servers ([#&#8203;8701](python-poetry/poetry#8701)).
-   Fix an issue where metadata of sdists that call CLI tools of their build requirements could not be determined ([#&#8203;8827](python-poetry/poetry#8827)).
-   Fix an issue where Poetry failed to use the currently activated environment ([#&#8203;8831](python-poetry/poetry#8831)).
-   Fix an issue where `poetry shell` failed in `zsh` if a space was in the venv path ([#&#8203;7245](python-poetry/poetry#7245)).
-   Fix an issue where scripts with extras could not be installed ([#&#8203;8900](python-poetry/poetry#8900)).
-   Fix an issue where explicit sources where not propagated correctly ([#&#8203;8835](python-poetry/poetry#8835)).
-   Fix an issue where debug prints where swallowed when using a build script ([#&#8203;8760](python-poetry/poetry#8760)).
-   Fix an issue where explicit sources of locked dependencies where not propagated correctly ([#&#8203;8948](python-poetry/poetry#8948)).
-   Fix an issue where Poetry's own environment was falsely identified as system environment ([#&#8203;8970](python-poetry/poetry#8970)).
-   Fix an issue where dependencies from a `setup.py` were ignored silently ([#&#8203;9000](python-poetry/poetry#9000)).
-   Fix an issue where environment variables for `virtualenv.options` were ignored ([#&#8203;9015](python-poetry/poetry#9015)).
-   Fix an issue where `virtualenvs.options.no-pip` and `virtualenvs.options.no-setuptools` were not normalized ([#&#8203;9015](python-poetry/poetry#9015)).

##### Docs

-   Replace deprecated `--no-dev` with `--without dev` in the FAQ ([#&#8203;8659](python-poetry/poetry#8659)).
-   Recommend `poetry-check` instead of the deprecated `poetry-lock` pre-commit hook ([#&#8203;8675](python-poetry/poetry#8675)).
-   Clarify the names of the environment variables to provide credentials for repositories ([#&#8203;8782](python-poetry/poetry#8782)).
-   Add note how to install several version of Poetry in parallel ([#&#8203;8814](python-poetry/poetry#8814)).
-   Improve description of `poetry show --why` ([#&#8203;8817](python-poetry/poetry#8817)).
-   Improve documentation of `poetry update` ([#&#8203;8706](python-poetry/poetry#8706)).
-   Add a warning about passing variables that may start with a hyphen via command line ([#&#8203;8850](python-poetry/poetry#8850)).
-   Mention that the virtual environment in which Poetry itself is installed should not be activated ([#&#8203;8833](python-poetry/poetry#8833)).
-   Add note about `poetry run` and externally managed environments ([#&#8203;8748](python-poetry/poetry#8748)).
-   Update FAQ entry about `tox` for `tox` 4.x ([#&#8203;8658](python-poetry/poetry#8658)).
-   Fix documentation for default `format` option for `include` and `exclude` value ([#&#8203;8852](python-poetry/poetry#8852)).
-   Add note about `tox` and configured credentials ([#&#8203;8888](python-poetry/poetry#8888)).
-   Add note and link how to install `pipx` ([#&#8203;8878](python-poetry/poetry#8878)).
-   Fix examples for `poetry add` with git dependencies over ssh ([#&#8203;8911](python-poetry/poetry#8911)).
-   Remove reference to deprecated scripts extras feature ([#&#8203;8903](python-poetry/poetry#8903)).
-   Change examples to prefer `--only main` instead of `--without dev` ([#&#8203;8921](python-poetry/poetry#8921)).
-   Mention that the `develop` attribute is a Poetry-specific feature and not propagated to other tools ([#&#8203;8971](python-poetry/poetry#8971)).
-   Fix examples for adding supplemental and secondary sources ([#&#8203;8953](python-poetry/poetry#8953)).
-   Add PyTorch example for explicit sources ([#&#8203;9006](python-poetry/poetry#9006)).

##### poetry-core ([`1.9.0`](https://github.com/python-poetry/poetry-core/releases/tag/1.9.0))

-   **Deprecate scripts that depend on extras** ([#&#8203;690](python-poetry/poetry-core#690)).
-   Add support for path dependencies that do not define a build system ([#&#8203;675](python-poetry/poetry-core#675)).
-   Update list of supported licenses ([#&#8203;659](python-poetry/poetry-core#659),
    [#&#8203;669](python-poetry/poetry-core#669),
    [#&#8203;678](python-poetry/poetry-core#678),
    [#&#8203;694](python-poetry/poetry-core#694)).
-   Rework list of files included in build artifacts ([#&#8203;666](python-poetry/poetry-core#666)).
-   Fix an issue where insignificant errors were printed if the working directory is not inside a git repository ([#&#8203;684](python-poetry/poetry-core#684)).
-   Fix an issue where the project's directory was not recognized as git repository on Windows due to an encoding issue ([#&#8203;685](python-poetry/poetry-core#685)).

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yMDIuMSIsInVwZGF0ZWRJblZlciI6IjM3LjIxNC4wIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIn0=-->

Reviewed-on: https://git.walbeck.it/walbeck-it/docker-python-poetry/pulls/981
Co-authored-by: renovate-bot <[email protected]>
Co-committed-by: renovate-bot <[email protected]>
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 this pull request may close these issues.

3 participants