commit python-poetry for openSUSE:Factory
Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-poetry for openSUSE:Factory checked in at 2024-07-01 11:21:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-poetry (Old) and /work/SRC/openSUSE:Factory/.python-poetry.new.18349 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-poetry" Mon Jul 1 11:21:59 2024 rev:31 rq:1184164 version:1.8.3 Changes: -------- --- /work/SRC/openSUSE:Factory/python-poetry/python-poetry.changes 2024-03-20 21:20:24.683417342 +0100 +++ /work/SRC/openSUSE:Factory/.python-poetry.new.18349/python-poetry.changes 2024-07-01 11:22:50.288445677 +0200 @@ -1,0 +2,41 @@ +Sun Jun 30 21:49:44 UTC 2024 - Dirk Müller <dmueller@suse.com> + +- update to 1.8.3: + * Add support for untagged CPython builds with versions ending + with a `+` (#9207). + * Require `pkginfo>=1.10` to ensure support for packages with + metadata version 2.3 (#9130). + * Improve locking on FIPS systems (#9152). + * Fix an issue where unrecognized package metadata versions + silently resulted in empty dependencies (#9203, + * #9226). + * Fix an issue where trailing slashes in git URLs where not + handled correctly (#9205). + * Fix an issue where `poetry self` commands printed a warning + that the current project cannot be installed (#9302). + * Fix an issue where `poetry install` sporadically failed with + a `KeyError` due to a race condition (#9335). + * Fix incorrect information about `poetry shell` (#9060). + * Add a git subdirectory example to `poetry add` (#9080). + * Mention interactive credential configuration (#9074). + * Add notes for optional advanced installation steps (#9098). + * Add reference to configuration credentials in documentation + of poetry `publish` (#9110). + * Improve documentation for configuring credentials via + environment variables (#9121). + * Remove misleading wording around virtual environments + (#9213). + * Remove outdated advice regarding seeding keyring backends + (#9213). + * Add a `pyproject.toml` example for a dependency with multiple + extras (#9138). + * Clarify help of `poetry add` (#9230). + * Add a note how to configure credentials for TestPyPI for + `poetry publish` (#9255). + * Fix information about the `--readme` option in `poetry new` + (#9260). + * Clarify what is special about the Python constraint in + `dependencies` (#9256). + * Update how to uninstall plugins via `pipx` (#9320). + +------------------------------------------------------------------- Old: ---- poetry-1.8.2.tar.gz New: ---- poetry-1.8.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-poetry.spec ++++++ --- /var/tmp/diff_new_pack.IYyRO4/_old 2024-07-01 11:22:51.524490412 +0200 +++ /var/tmp/diff_new_pack.IYyRO4/_new 2024-07-01 11:22:51.540490991 +0200 @@ -27,7 +27,7 @@ %{?sle15_python_module_pythons} Name: python-poetry%{psuffix} -Version: 1.8.2 +Version: 1.8.3 Release: 0 Summary: Python dependency management and packaging License: MIT @@ -58,7 +58,7 @@ Requires: python-keyring >= 24.0 Requires: python-packaging >= 23.1 Requires: python-pexpect >= 4.7.0 -Requires: python-pkginfo >= 1.9.4 +Requires: python-pkginfo >= 1.10.0 Requires: python-pyproject-hooks >= 1.0.0 Requires: python-requests >= 2.26 Requires: python-shellingham >= 1.5 ++++++ poetry-1.8.2.tar.gz -> poetry-1.8.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-1.8.2/.cirrus.yml new/poetry-1.8.3/.cirrus.yml --- old/poetry-1.8.2/.cirrus.yml 2024-03-02 15:56:12.000000000 +0100 +++ new/poetry-1.8.3/.cirrus.yml 2024-05-03 16:24:55.000000000 +0200 @@ -1,5 +1,5 @@ freebsd_instance: - image_family: freebsd-13-2 + image_family: freebsd-14-0 cpu: 2 memory: 4G diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-1.8.2/.github/workflows/docs.yml new/poetry-1.8.3/.github/workflows/docs.yml --- old/poetry-1.8.2/.github/workflows/docs.yml 2024-03-02 15:56:12.000000000 +0100 +++ new/poetry-1.8.3/.github/workflows/docs.yml 2024-05-03 16:24:55.000000000 +0200 @@ -42,7 +42,8 @@ - name: Set up Python uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.12" + cache: poetry - name: Setup Node uses: actions/setup-node@v4 @@ -54,7 +55,7 @@ - name: Fetch Documentation run: | - python -m pip install poetry + pipx install poetry poetry install --no-root --only main poetry run python bin/website build --local ./poetry diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-1.8.2/.github/workflows/main.yml new/poetry-1.8.3/.github/workflows/main.yml --- old/poetry-1.8.2/.github/workflows/main.yml 2024-03-02 15:56:12.000000000 +0100 +++ new/poetry-1.8.3/.github/workflows/main.yml 2024-05-03 16:24:55.000000000 +0200 @@ -43,26 +43,14 @@ steps: - uses: actions/checkout@v4 + - name: Bootstrap poetry + run: pipx install poetry + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - - name: Get full Python version - id: full-python-version - run: echo version=$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") >> $GITHUB_OUTPUT - - - name: Bootstrap poetry - run: | - curl -sSL https://install.python-poetry.org | python - -y - - - name: Update PATH - if: ${{ matrix.os != 'Windows' }} - run: echo "$HOME/.local/bin" >> $GITHUB_PATH - - - name: Update Path for Windows - if: ${{ matrix.os == 'Windows' }} - run: echo "$APPDATA\Python\Scripts" >> $GITHUB_PATH + cache: poetry - name: Enable long paths for git on Windows if: ${{ matrix.os == 'Windows' }} @@ -71,23 +59,10 @@ run: git config --system core.longpaths true - name: Configure poetry - run: poetry config virtualenvs.in-project true - - - name: Set up cache - uses: actions/cache@v4 - id: cache - with: - path: .venv - key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }} - - - name: Ensure cache is healthy - if: steps.cache.outputs.cache-hit == 'true' run: | - # `timeout` is not available on macOS, so we define a custom function. - [ "$(command -v timeout)" ] || function timeout() { perl -e 'alarm shift; exec @ARGV' "$@"; } - - # Using `timeout` is a safeguard against the Poetry command hanging for some reason. - timeout 10s poetry run pip --version || rm -rf .venv + poetry config virtualenvs.in-project true + poetry config virtualenvs.options.no-pip true + poetry config virtualenvs.options.no-setuptools true - name: Check lock file run: poetry check --lock diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-1.8.2/.github/workflows/release.yml new/poetry-1.8.3/.github/workflows/release.yml --- old/poetry-1.8.2/.github/workflows/release.yml 2024-03-02 15:56:12.000000000 +0100 +++ new/poetry-1.8.3/.github/workflows/release.yml 2024-05-03 16:24:55.000000000 +0200 @@ -13,17 +13,14 @@ - name: Checkout code uses: actions/checkout@v4 - - name: Set up Python 3.10 - uses: actions/setup-python@v5 - with: - python-version: "3.10" - - name: Install Poetry - run: | - curl -sSL https://install.python-poetry.org | python - -y + run: pipx install poetry - - name: Update PATH - run: echo "$HOME/.local/bin" >> $GITHUB_PATH + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: poetry - name: Build project for distribution run: poetry build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-1.8.2/CHANGELOG.md new/poetry-1.8.3/CHANGELOG.md --- old/poetry-1.8.2/CHANGELOG.md 2024-03-02 15:56:12.000000000 +0100 +++ new/poetry-1.8.3/CHANGELOG.md 2024-05-03 16:24:55.000000000 +0200 @@ -1,6 +1,43 @@ # Change Log +## [1.8.3] - 2024-05-03 + +### Added + +- Add support for untagged CPython builds with versions ending with a `+` ([#9207](https://github.com/python-poetry/poetry/pull/9207)). + +### Changed + +- Require `pkginfo>=1.10` to ensure support for packages with metadata version 2.3 ([#9130](https://github.com/python-poetry/poetry/pull/9130)). +- Improve locking on FIPS systems ([#9152](https://github.com/python-poetry/poetry/pull/9152)). + +### Fixed + +- Fix an issue where unrecognized package metadata versions silently resulted in empty dependencies ([#9203](https://github.com/python-poetry/poetry/pull/9203), +[#9226](https://github.com/python-poetry/poetry/pull/9226)). +- Fix an issue where trailing slashes in git URLs where not handled correctly ([#9205](https://github.com/python-poetry/poetry/pull/9205)). +- Fix an issue where `poetry self` commands printed a warning that the current project cannot be installed ([#9302](https://github.com/python-poetry/poetry/pull/9302)). +- Fix an issue where `poetry install` sporadically failed with a `KeyError` due to a race condition ([#9335](https://github.com/python-poetry/poetry/pull/9335)). + +### Docs + +- Fix incorrect information about `poetry shell` ([#9060](https://github.com/python-poetry/poetry/pull/9060)). +- Add a git subdirectory example to `poetry add` ([#9080](https://github.com/python-poetry/poetry/pull/9080)). +- Mention interactive credential configuration ([#9074](https://github.com/python-poetry/poetry/pull/9074)). +- Add notes for optional advanced installation steps ([#9098](https://github.com/python-poetry/poetry/pull/9098)). +- Add reference to configuration credentials in documentation of poetry `publish` ([#9110](https://github.com/python-poetry/poetry/pull/9110)). +- Improve documentation for configuring credentials via environment variables ([#9121](https://github.com/python-poetry/poetry/pull/9121)). +- Remove misleading wording around virtual environments ([#9213](https://github.com/python-poetry/poetry/pull/9213)). +- Remove outdated advice regarding seeding keyring backends ([#9213](https://github.com/python-poetry/poetry/pull/9213)). +- Add a `pyproject.toml` example for a dependency with multiple extras ([#9138](https://github.com/python-poetry/poetry/pull/9138)). +- Clarify help of `poetry add` ([#9230](https://github.com/python-poetry/poetry/pull/9230)). +- Add a note how to configure credentials for TestPyPI for `poetry publish` ([#9255](https://github.com/python-poetry/poetry/pull/9255)). +- Fix information about the `--readme` option in `poetry new` ([#9260](https://github.com/python-poetry/poetry/pull/9260)). +- Clarify what is special about the Python constraint in `dependencies` ([#9256](https://github.com/python-poetry/poetry/pull/9256)). +- Update how to uninstall plugins via `pipx` ([#9320](https://github.com/python-poetry/poetry/pull/9320)). + + ## [1.8.2] - 2024-03-02 ### Fixed @@ -10,7 +47,7 @@ - Improve `lazy-wheel` error handling if the index server pretends to support HTTP range requests but does not respect them ([#9084](https://github.com/python-poetry/poetry/pull/9084)). - Improve `lazy-wheel` to allow redirects for HEAD requests ([#9087](https://github.com/python-poetry/poetry/pull/9087)). - Improve debug logging for `lazy-wheel` errors ([#9059](https://github.com/python-poetry/poetry/pull/9059)). -- Fix an issue where the hash of a metadata file could not be calculated correctly due to an encoding issue ([#9048](https://github.com/python-poetry/poetry/pull/9048)). +- Fix an issue where the hash of a metadata file could not be calculated correctly due to an encoding issue ([#9049](https://github.com/python-poetry/poetry/pull/9049)). - Fix an issue where `poetry add` failed in non-package mode if no project name was set ([#9046](https://github.com/python-poetry/poetry/pull/9046)). - Fix an issue where a hint to non-package mode was not compliant with the final name of the setting ([#9073](https://github.com/python-poetry/poetry/pull/9073)). @@ -2152,7 +2189,8 @@ -[Unreleased]: https://github.com/python-poetry/poetry/compare/1.8.2...master +[Unreleased]: https://github.com/python-poetry/poetry/compare/1.8.3...master +[1.8.3]: https://github.com/python-poetry/poetry/releases/tag/1.8.3 [1.8.2]: https://github.com/python-poetry/poetry/releases/tag/1.8.2 [1.8.1]: https://github.com/python-poetry/poetry/releases/tag/1.8.1 [1.8.0]: https://github.com/python-poetry/poetry/releases/tag/1.8.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-1.8.2/docs/_index.md new/poetry-1.8.3/docs/_index.md --- old/poetry-1.8.2/docs/_index.md 2024-03-02 15:56:12.000000000 +0100 +++ new/poetry-1.8.3/docs/_index.md 2024-05-03 16:24:55.000000000 +0200 @@ -62,6 +62,12 @@ {{< step >}} **Install Poetry (advanced)** +{{% note %}} +You can skip this step, if you simply want the latest version and already installed Poetry as described in the +previous step. This step details advanced usages of this installation method. For example, installing Poetry from +source, having multiple versions installed at the same time etc. +{{% /note %}} + `pipx` can install different versions of Poetry, using the same syntax as pip: ```bash @@ -151,6 +157,12 @@ {{< step >}} **Install Poetry (advanced)** +{{% note %}} +You can skip this step, if you simply want the latest version and already installed Poetry as described in the +previous step. This step details advanced usages of this installation method. For example, installing Poetry from +source, using a pre-release build, configuring a different installation location etc. +{{% /note %}} + By default, Poetry is installed into a platform and user-specific directory: - `~/Library/Application Support/pypoetry` on MacOS. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-1.8.2/docs/basic-usage.md new/poetry-1.8.3/docs/basic-usage.md --- old/poetry-1.8.2/docs/basic-usage.md 2024-03-02 15:56:12.000000000 +0100 +++ new/poetry-1.8.3/docs/basic-usage.md 2024-05-03 16:24:55.000000000 +0200 @@ -63,8 +63,29 @@ `tool.poetry.exclude` sections. `tool.poetry.exclude` is additionally implicitly populated by your `.gitignore`. For full documentation on the project format, see the [pyproject section]({{< relref "pyproject" >}}) of the documentation. +### Setting a Python Version + +{{% note %}} +Unlike with other packages, Poetry will not automatically install a python interpreter for you. +If you want to run Python files in your package like a script or application, you must _bring your own_ python interpreter to run them. +{{% /note %}} + Poetry will require you to explicitly specify what versions of Python you intend to support, and its universal locking will guarantee that your project is installable (and all dependencies claim support for) all supported Python versions. +Again, it's important to remember that -- unlike other dependencies -- setting a Python version is merely specifying which versions of Python you intend to support. + +For example, in this `pyproject.toml` file: + +```toml +[tool.poetry.dependencies] +python = "^3.7.0" +``` + +we are allowing any version of Python 3 that is greater than `3.7.0`. + +When you run `poetry install`, you must have access to some version of a Python inrepreter that satisfies this constraint available on your system. +Poetry will not install a Python interpreter for you. +If you use a tool like `pyenv`, you can use the experimental configuration value [`virtualenvs.prefer-active-python`]({{< relref "configuration/#virtualenvsprefer-active-python-experimental" >}}). ### Initialising a pre-existing project @@ -155,6 +176,7 @@ If managing your own virtual environment externally, you do not need to use `poetry run` or `poetry shell` since you will, presumably, already have activated that virtual environment and made available the correct python instance. For example, these commands should output the same python path: + ```shell conda activate your_env_name which python @@ -162,6 +184,7 @@ poetry shell which python ``` + {{% /note %}} ### Activating the virtual environment @@ -197,7 +220,7 @@ To deactivate this virtual environment simply use `deactivate`. | | POSIX Shell | Windows (PowerShell) | Exit/Deactivate | -|-------------------| ----------------------------------------------- |----------------------------------------------------------| --------------- | +| ----------------- | ----------------------------------------------- | -------------------------------------------------------- | --------------- | | Sub-shell | `poetry shell` | `poetry shell` | `exit` | | Manual Activation | `source {path_to_venv}/bin/activate` | `{path_to_venv}\Scripts\activate.ps1` | `deactivate` | | One-liner | `source $(poetry env info --path)/bin/activate` | `& ((poetry env info --path) + "\Scripts\activate.ps1")` | `deactivate` | @@ -273,7 +296,6 @@ {{% warning %}} If you have added the recommended [`[build-system]`]({{< relref "pyproject#poetry-and-pep-517" >}}) section to your project's pyproject.toml then you _can_ successfully install your project and its dependencies into a virtual environment using a command like `pip install -e .`. However, pip will not use the lock file to determine dependency versions as the poetry-core build system is intended for library developers (see next section). {{% /warning %}} - #### As a library developer Library developers have more to consider. Your users are application developers, and your library will run in a Python environment you don't control. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-1.8.2/docs/cli.md new/poetry-1.8.3/docs/cli.md --- old/poetry-1.8.2/docs/cli.md 2024-03-02 15:56:12.000000000 +0100 +++ new/poetry-1.8.3/docs/cli.md 2024-05-03 16:24:55.000000000 +0200 @@ -579,6 +579,10 @@ * `--dry-run`: Perform all actions except upload the package. * `--skip-existing`: Ignore errors from files already existing in the repository. +{{% note %}} +See [Configuring Credentials]({{< relref "repositories/#configuring-credentials" >}}) for more information on how to configure credentials. +{{% /note %}} + ## config The `config` command allows you to edit poetry config settings and repositories. @@ -637,10 +641,13 @@ ## shell -The `shell` command spawns a shell, -according to the `$SHELL` environment variable, -within the virtual environment. -If one doesn't exist yet, it will be created. +The shell command spawns a shell within the project's virtual environment. + +By default, the current active shell is detected and used. Failing that, +the shell defined via the environment variable `SHELL` (on *nix) or +`COMSPEC` (on Windows) is used. + +If a virtual environment does not exist, it will be created. ```bash poetry shell @@ -650,6 +657,11 @@ As such, `exit` should be used to properly exit the shell and the virtual environment instead of `deactivate`. +{{% note %}} +Poetry internally uses the [Shellingham](https://github.com/sarugaku/shellingham) project to detect current +active shell. +{{% /note %}} + ## check The `check` command validates the content of the `pyproject.toml` file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-1.8.2/docs/faq.md new/poetry-1.8.3/docs/faq.md --- old/poetry-1.8.2/docs/faq.md 2024-03-02 15:56:12.000000000 +0100 +++ new/poetry-1.8.3/docs/faq.md 2024-05-03 16:24:55.000000000 +0200 @@ -171,8 +171,8 @@ ### I don't want Poetry to manage my virtual environments. Can I disable it? While Poetry automatically creates virtual environments to always work isolated -from the global Python installation, there are valid reasons why it's not necessary -and is an overhead, like when working with containers. +from the global Python installation, there are rare scenarios where the use a Poetry managed +virtual environment is not possible or preferred. In this case, you can disable this feature by setting the `virtualenvs.create` setting to `false`: @@ -180,6 +180,13 @@ poetry config virtualenvs.create false ``` +{{% warning %}} +The recommended best practice, including when installing an application within a container, is to make +use of a virtual environment. This can also be managed by another tool. + +The Poetry team strongly encourages the use of a virtual environment. +{{% /warning %}} + ### Why is Poetry telling me that the current project's supported Python range is not compatible with one or more packages' Python requirements? Unlike `pip`, Poetry doesn't resolve for just the Python in the current environment. Instead it makes sure that a dependency diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-1.8.2/docs/plugins.md new/poetry-1.8.3/docs/plugins.md --- old/poetry-1.8.2/docs/plugins.md 2024-03-02 15:56:12.000000000 +0100 +++ new/poetry-1.8.3/docs/plugins.md 2024-05-03 16:24:55.000000000 +0200 @@ -202,7 +202,9 @@ If you want to uninstall a plugin, you can run: ```shell -pipx runpip poetry uninstall poetry-plugin +pipx uninject poetry poetry-plugin # For pipx versions >= 1.2.0 + +pipx runpip poetry uninstall poetry-plugin # For pipx versions < 1.2.0 ``` ### With `pip` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-1.8.2/docs/pyproject.md new/poetry-1.8.3/docs/pyproject.md --- old/poetry-1.8.2/docs/pyproject.md 2024-03-02 15:56:12.000000000 +0100 +++ new/poetry-1.8.3/docs/pyproject.md 2024-05-03 16:24:55.000000000 +0200 @@ -421,6 +421,10 @@ {{% note %}} Note that `install --extras` and the variations mentioned above (`--all-extras`, `--extras foo`, etc.) only work on dependencies defined in the current project. If you want to install extras defined by dependencies, you'll have to express that in the dependency itself: ```toml +[tool.poetry.dependencies] +pandas = {version="^2.2.1", extras=["computation", "performance"]} +``` +```toml [tool.poetry.group.dev.dependencies] fastapi = {version="^0.92.0", extras=["all"]} ``` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-1.8.2/docs/repositories.md new/poetry-1.8.3/docs/repositories.md --- old/poetry-1.8.2/docs/repositories.md 2024-03-02 15:56:12.000000000 +0100 +++ new/poetry-1.8.3/docs/repositories.md 2024-05-03 16:24:55.000000000 +0200 @@ -47,6 +47,15 @@ Many shells do not save commands to history when they are prefixed by a space character. For more information, please refer to your shell's documentation. {{% /warning %}} +{{% note %}} +If you would like to provide the password interactively, you can simply omit `<password>` in your command. And +Poetry will prompt you to enter the credential manually. + +```bash +poetry config http-basic.foo <username> +``` +{{% /note %}} + Once this is done, you can add dependencies to your project from this source. ```bash @@ -76,6 +85,16 @@ {{% /note %}} +{{% note %}} +When configuring a repository using environment variables, note that correct suffixes need to be used. + +```bash +export POETRY_REPOSITORIES_FOO_URL=https://pypi.example.org/legacy/ +export POETRY_HTTP_BASIC_FOO_USERNAME=<username> +export POETRY_HTTP_BASIC_FOO_PASSWORD=<password> +``` +{{% /note %}} + Now, all the is left is to build and publish your project using the [`publish`]({{< relref "cli#publish" >}}). @@ -492,6 +511,10 @@ ```bash poetry config pypi-token.pypi <my-token> ``` +If you have configured **testpypi** as a [Publishable Repository](#publishable-repositories), the token can be set using +```bash +poetry config pypi-token.testpypi <your-token> +``` If you still want to use your username and password, you can do so with the following call to `config`. @@ -522,12 +545,6 @@ valid credentials. It will need to be properly installed into Poetry's virtualenv, preferably by installing a plugin. -If you are letting Poetry manage your virtual environments you will want a virtualenv -seeder installed in Poetry's virtualenv that installs the desired keyring backend -during `poetry install`. To again use Azure DevOps as an example: [azure-devops-artifacts-helpers](https://pypi.org/project/azure-devops-artifacts-helpers/) -provides such a seeder. This would of course best achieved by installing a Poetry plugin -if it exists for you use case instead of doing it yourself. - {{% /note %}} Alternatively, you can use environment variables to provide the credentials: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-1.8.2/poetry.lock new/poetry-1.8.3/poetry.lock --- old/poetry-1.8.2/poetry.lock 2024-03-02 15:56:12.000000000 +0100 +++ new/poetry-1.8.3/poetry.lock 2024-05-03 16:24:55.000000000 +0200 @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.0 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. [[package]] name = "build" @@ -902,17 +902,17 @@ [[package]] name = "pkginfo" -version = "1.9.6" +version = "1.10.0" description = "Query metadata from sdists / bdists / installed packages." optional = false python-versions = ">=3.6" files = [ - {file = "pkginfo-1.9.6-py3-none-any.whl", hash = "sha256:4b7a555a6d5a22169fcc9cf7bfd78d296b0361adad412a346c1226849af5e546"}, - {file = "pkginfo-1.9.6.tar.gz", hash = "sha256:8fd5896e8718a4372f0ea9cc9d96f6417c9b986e23a4d116dda26b62cc29d046"}, + {file = "pkginfo-1.10.0-py3-none-any.whl", hash = "sha256:889a6da2ed7ffc58ab5b900d888ddce90bce912f2d2de1dc1c26f4cb9fe65097"}, + {file = "pkginfo-1.10.0.tar.gz", hash = "sha256:5df73835398d10db79f8eecd5cd86b1f6d29317589ea70796994d49399af6297"}, ] [package.extras] -testing = ["pytest", "pytest-cov"] +testing = ["pytest", "pytest-cov", "wheel"] [[package]] name = "platformdirs" @@ -1595,4 +1595,4 @@ [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "85d42389685870cb956cc70109a816d5a68c1ea2987121679180ddd1aa4c4498" +content-hash = "71646f3e3fae85c295e3852270969facafc502957e00610217e52c41c35fb270" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-1.8.2/pyproject.toml new/poetry-1.8.3/pyproject.toml --- old/poetry-1.8.2/pyproject.toml 2024-03-02 15:56:12.000000000 +0100 +++ new/poetry-1.8.3/pyproject.toml 2024-05-03 16:24:55.000000000 +0200 @@ -1,6 +1,6 @@ [tool.poetry] name = "poetry" -version = "1.8.2" +version = "1.8.3" description = "Python dependency management and packaging made easy." authors = ["Sébastien Eustace <sebastien@eustace.io>"] maintainers = [ @@ -45,7 +45,7 @@ # packaging uses calver, so version is unclamped packaging = ">=23.1" pexpect = "^4.7.0" -pkginfo = "^1.9.4" +pkginfo = "^1.10" platformdirs = ">=3.0.0,<5" pyproject-hooks = "^1.0.0" requests = "^2.26" @@ -102,9 +102,6 @@ target-version = "py38" [tool.ruff.lint] -unfixable = [ - "ERA", # do not autoremove commented out code -] extend-select = [ "B", # flake8-bugbear "C4", # flake8-comprehensions @@ -124,6 +121,12 @@ "B905", # use explicit 'strict=' parameter with 'zip()' "N818", # Exception name should be named with an Error suffix ] +extend-safe-fixes = [ + "TCH", # move import from and to TYPE_CHECKING blocks +] +unfixable = [ + "ERA", # do not autoremove commented out code +] [tool.ruff.lint.flake8-tidy-imports] ban-relative-imports = "all" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-1.8.2/src/poetry/console/commands/add.py new/poetry-1.8.3/src/poetry/console/commands/add.py --- old/poetry-1.8.2/src/poetry/console/commands/add.py 2024-03-02 15:56:12.000000000 +0100 +++ new/poetry-1.8.3/src/poetry/console/commands/add.py 2024-05-03 16:24:55.000000000 +0200 @@ -16,7 +16,7 @@ class AddCommand(InstallerCommand, InitCommand): name = "add" - description = "Adds a new dependency to <comment>pyproject.toml</>." + description = "Adds a new dependency to <comment>pyproject.toml</> and installs it." arguments = [argument("name", "The packages to add.", multiple=True)] options = [ @@ -79,6 +79,8 @@ - A git url (<b>git+https://github.com/python-poetry/poetry.git</b>) - A git url with a revision\ (<b>git+https://github.com/python-poetry/poetry.git#develop</b>) + - A subdirectory of a git repository\ + (<b>git+https://github.com/python-poetry/poetry.git#subdirectory=tests/fixtures/sample_project</b>) - A git SSH url (<b>git+ssh://github.com/python-poetry/poetry.git</b>) - A git SSH url with a revision\ (<b>git+ssh://github.com/python-poetry/poetry.git#develop</b>) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-1.8.2/src/poetry/console/commands/new.py new/poetry-1.8.3/src/poetry/console/commands/new.py --- old/poetry-1.8.2/src/poetry/console/commands/new.py 2024-03-02 15:56:12.000000000 +0100 +++ new/poetry-1.8.3/src/poetry/console/commands/new.py 2024-05-03 16:24:55.000000000 +0200 @@ -19,7 +19,7 @@ option( "readme", None, - "Specify the readme file format. One of md (default) or rst", + "Specify the readme file format. Default is md.", flag=False, ), ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-1.8.2/src/poetry/console/commands/self/self_command.py new/poetry-1.8.3/src/poetry/console/commands/self/self_command.py --- old/poetry-1.8.2/src/poetry/console/commands/self/self_command.py 2024-03-02 15:56:12.000000000 +0100 +++ new/poetry-1.8.3/src/poetry/console/commands/self/self_command.py 2024-05-03 16:24:55.000000000 +0200 @@ -73,6 +73,7 @@ package.python_versions = ".".join(str(v) for v in self.env.version_info[:3]) content = Factory.create_pyproject_from_package(package=package) + content["tool"]["poetry"]["package-mode"] = False # type: ignore[index] for key in preserved: content["tool"]["poetry"][key] = preserved[key] # type: ignore[index] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-1.8.2/src/poetry/console/commands/shell.py new/poetry-1.8.3/src/poetry/console/commands/shell.py --- old/poetry-1.8.2/src/poetry/console/commands/shell.py 2024-03-02 15:56:12.000000000 +0100 +++ new/poetry-1.8.3/src/poetry/console/commands/shell.py 2024-05-03 16:24:55.000000000 +0200 @@ -1,8 +1,8 @@ from __future__ import annotations +import os import sys -from os import environ from typing import TYPE_CHECKING from typing import cast @@ -17,9 +17,12 @@ name = "shell" description = "Spawns a shell within the virtual environment." - help = """The <info>shell</> command spawns a shell, according to the -<comment>$SHELL</> environment variable, within the virtual environment. -If one doesn't exist yet, it will be created. + help = f"""The <info>shell</> command spawns a shell within the project's virtual environment. + +By default, the current active shell is detected and used. Failing that, +the shell defined via the environment variable <comment>{'COMSPEC' if os.name == 'nt' else 'SHELL'}</> is used. + +If a virtual environment does not exist, it will be created. """ def handle(self) -> int: @@ -41,14 +44,14 @@ env = cast("VirtualEnv", env) # Setting this to avoid spawning unnecessary nested shells - environ["POETRY_ACTIVE"] = "1" + os.environ["POETRY_ACTIVE"] = "1" shell = Shell.get() shell.activate(env) - environ.pop("POETRY_ACTIVE") + os.environ.pop("POETRY_ACTIVE") return 0 def _is_venv_activated(self) -> bool: - return bool(environ.get("POETRY_ACTIVE")) or getattr( + return bool(os.environ.get("POETRY_ACTIVE")) or getattr( sys, "real_prefix", sys.prefix ) == str(self.env.path) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-1.8.2/src/poetry/inspection/info.py new/poetry-1.8.3/src/poetry/inspection/info.py --- old/poetry-1.8.2/src/poetry/inspection/info.py 2024-03-02 15:56:12.000000000 +0100 +++ new/poetry-1.8.3/src/poetry/inspection/info.py 2024-05-03 16:24:55.000000000 +0200 @@ -245,6 +245,11 @@ :param dist: The distribution instance to parse information from. """ + if dist.metadata_version not in pkginfo.distribution.HEADER_ATTRS: + # This check can be replaced once upstream implements strict parsing + # https://bugs.launchpad.net/pkginfo/+bug/2058697 + raise ValueError(f"Unknown metadata version: {dist.metadata_version}") + requirements = None if dist.requires_dist: @@ -539,8 +544,8 @@ try: wheel = pkginfo.Wheel(str(path)) return cls._from_distribution(wheel) - except ValueError: - return PackageInfo() + except ValueError as e: + raise PackageInfoError(path, e) @classmethod def from_bdist(cls, path: Path) -> PackageInfo: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-1.8.2/src/poetry/installation/executor.py new/poetry-1.8.3/src/poetry/installation/executor.py --- old/poetry-1.8.2/src/poetry/installation/executor.py 2024-03-02 15:56:12.000000000 +0100 +++ new/poetry-1.8.3/src/poetry/installation/executor.py 2024-05-03 16:24:55.000000000 +0200 @@ -106,6 +106,10 @@ self._shutdown = False self._hashes: dict[str, str] = {} + # Cache whether decorated output is supported. + # https://github.com/python-poetry/cleo/issues/423 + self._decorated_output: bool = self._io.output.is_decorated() + @property def installations_count(self) -> int: return self._executed["install"] @@ -123,7 +127,7 @@ return self._enabled def supports_fancy_output(self) -> bool: - return self._io.output.is_decorated() and not self._dry_run + return self._decorated_output and not self._dry_run def disable(self) -> Executor: self._enabled = False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-1.8.2/src/poetry/repositories/http_repository.py new/poetry-1.8.3/src/poetry/repositories/http_repository.py --- old/poetry-1.8.2/src/poetry/repositories/http_repository.py 2024-03-02 15:56:12.000000000 +0100 +++ new/poetry-1.8.3/src/poetry/repositories/http_repository.py 2024-05-03 16:24:55.000000000 +0200 @@ -4,6 +4,7 @@ import hashlib from contextlib import contextmanager +from contextlib import suppress from pathlib import Path from typing import TYPE_CHECKING from typing import Any @@ -374,7 +375,11 @@ hash_name = get_highest_priority_hash_type( set(link.hashes.keys()), link.filename ) - known_hash = getattr(hashlib, hash_name)() if hash_name else None + known_hash = None + with suppress(ValueError, AttributeError): + # Handle ValueError here as well since under FIPS environments + # this is what is raised (e.g., for MD5) + known_hash = getattr(hashlib, hash_name)() if hash_name else None required_hash = hashlib.sha256() chunksize = 4096 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-1.8.2/src/poetry/utils/env/script_strings.py new/poetry-1.8.3/src/poetry/utils/env/script_strings.py --- old/poetry-1.8.2/src/poetry/utils/env/script_strings.py 2024-03-02 15:56:12.000000000 +0100 +++ new/poetry-1.8.3/src/poetry/utils/env/script_strings.py 2024-05-03 16:24:55.000000000 +0200 @@ -82,7 +82,7 @@ "platform_release": platform.release(), "platform_system": platform.system(), "platform_version": platform.version(), - "python_full_version": platform.python_version(), + "python_full_version": platform.python_version().rstrip("+"), "platform_python_implementation": platform.python_implementation(), "python_version": ".".join(platform.python_version_tuple()[:2]), "sys_platform": sys.platform, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-1.8.2/src/poetry/utils/env/system_env.py new/poetry-1.8.3/src/poetry/utils/env/system_env.py --- old/poetry-1.8.2/src/poetry/utils/env/system_env.py 2024-03-02 15:56:12.000000000 +0100 +++ new/poetry-1.8.3/src/poetry/utils/env/system_env.py 2024-05-03 16:24:55.000000000 +0200 @@ -71,7 +71,8 @@ "platform_release": platform.release(), "platform_system": platform.system(), "platform_version": platform.version(), - "python_full_version": platform.python_version(), + # Workaround for https://github.com/python/cpython/issues/99968 + "python_full_version": platform.python_version().rstrip("+"), "platform_python_implementation": platform.python_implementation(), "python_version": ".".join(platform.python_version().split(".")[:2]), "sys_platform": sys.platform, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-1.8.2/src/poetry/vcs/git/backend.py new/poetry-1.8.3/src/poetry/vcs/git/backend.py --- old/poetry-1.8.2/src/poetry/vcs/git/backend.py 2024-03-02 15:56:12.000000000 +0100 +++ new/poetry-1.8.3/src/poetry/vcs/git/backend.py 2024-05-03 16:24:55.000000000 +0200 @@ -182,7 +182,7 @@ @staticmethod def get_name_from_source_url(url: str) -> str: - return re.sub(r"(.git)?$", "", url.rsplit("/", 1)[-1]) + return re.sub(r"(.git)?$", "", url.rstrip("/").rsplit("/", 1)[-1]) @classmethod def _fetch_remote_refs(cls, url: str, local: Repo) -> FetchPackResult: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-1.8.2/tests/console/commands/self/test_install.py new/poetry-1.8.3/tests/console/commands/self/test_install.py --- old/poetry-1.8.2/tests/console/commands/self/test_install.py 1970-01-01 01:00:00.000000000 +0100 +++ new/poetry-1.8.3/tests/console/commands/self/test_install.py 2024-05-03 16:24:55.000000000 +0200 @@ -0,0 +1,62 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING + +import pytest + +from poetry.console.commands.self.install import SelfInstallCommand + + +if TYPE_CHECKING: + from cleo.testers.command_tester import CommandTester + + from tests.types import CommandTesterFactory + + +@pytest.fixture +def tester(command_tester_factory: CommandTesterFactory) -> CommandTester: + return command_tester_factory("self install") + + +@pytest.mark.parametrize( + "pyproject_content", + ( + None, + """\ +[tool.poetry] +name = "poetry-instance" +version = "1.2" +description = "" +authors = [] +license = "" +# no package-mode -> defaults to true + +[tool.poetry.dependencies] +python = "3.9" +poetry = "1.2" +""", + ), +) +def test_self_install( + tester: CommandTester, + pyproject_content: str | None, +) -> None: + command = tester.command + assert isinstance(command, SelfInstallCommand) + pyproject_path = command.system_pyproject + if pyproject_content: + pyproject_path.write_text(pyproject_content) + else: + assert not pyproject_path.exists() + + tester.execute() + + expected_output = """\ +Updating dependencies +Resolving dependencies... + +Writing lock file +""" + + assert tester.io.fetch_output() == expected_output + assert tester.io.fetch_error() == "" Binary files old/poetry-1.8.2/tests/fixtures/distributions/demo_metadata_version_unknown-0.1.0-py2.py3-none-any.whl and new/poetry-1.8.3/tests/fixtures/distributions/demo_metadata_version_unknown-0.1.0-py2.py3-none-any.whl differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-1.8.2/tests/fixtures/extended_with_no_setup/extended/extended.c new/poetry-1.8.3/tests/fixtures/extended_with_no_setup/extended/extended.c --- old/poetry-1.8.2/tests/fixtures/extended_with_no_setup/extended/extended.c 2024-03-02 15:56:12.000000000 +0100 +++ new/poetry-1.8.3/tests/fixtures/extended_with_no_setup/extended/extended.c 2024-05-03 16:24:55.000000000 +0200 @@ -10,7 +10,7 @@ { "hello", (PyCFunction) hello, - NULL, + METH_NOARGS, PyDoc_STR("Say hello.") }, {NULL} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-1.8.2/tests/inspection/test_info.py new/poetry-1.8.3/tests/inspection/test_info.py --- old/poetry-1.8.2/tests/inspection/test_info.py 2024-03-02 15:56:12.000000000 +0100 +++ new/poetry-1.8.3/tests/inspection/test_info.py 2024-05-03 16:24:55.000000000 +0200 @@ -179,6 +179,20 @@ assert info._source_url == demo_wheel.resolve().as_posix() +def test_info_from_wheel_metadata_version_unknown( + fixture_dir: FixtureDirGetter, +) -> None: + path = ( + fixture_dir("distributions") + / "demo_metadata_version_unknown-0.1.0-py2.py3-none-any.whl" + ) + + with pytest.raises(PackageInfoError) as e: + PackageInfo.from_wheel(path) + + assert "Unknown metadata version: 999.3" in str(e.value) + + def test_info_from_wheel_metadata(demo_wheel_metadata: RawMetadata) -> None: info = PackageInfo.from_metadata(demo_wheel_metadata) demo_check_info(info) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-1.8.2/tests/repositories/test_http_repository.py new/poetry-1.8.3/tests/repositories/test_http_repository.py --- old/poetry-1.8.2/tests/repositories/test_http_repository.py 2024-03-02 15:56:12.000000000 +0100 +++ new/poetry-1.8.3/tests/repositories/test_http_repository.py 2024-05-03 16:24:55.000000000 +0200 @@ -1,5 +1,6 @@ from __future__ import annotations +import contextlib import shutil from pathlib import Path @@ -12,6 +13,7 @@ from packaging.metadata import parse_email from poetry.core.packages.utils.link import Link +from poetry.inspection.info import PackageInfoError from poetry.inspection.lazy_wheel import HTTPRangeRequestUnsupported from poetry.repositories.http_repository import HTTPRepository from poetry.utils.helpers import HTTPRangeRequestSupported @@ -116,13 +118,18 @@ # 1. range request and download mock_metadata_from_wheel_url.side_effect = HTTPRangeRequestUnsupported - repo._get_info_from_wheel(link) + + with contextlib.suppress(PackageInfoError): + repo._get_info_from_wheel(link) + assert mock_metadata_from_wheel_url.call_count == 1 assert mock_download.call_count == 1 assert mock_download.call_args[1]["raise_accepts_ranges"] is False # 2. only download - repo._get_info_from_wheel(link) + with contextlib.suppress(PackageInfoError): + repo._get_info_from_wheel(link) + assert mock_metadata_from_wheel_url.call_count == 1 assert mock_download.call_count == 2 assert mock_download.call_args[1]["raise_accepts_ranges"] is True @@ -130,26 +137,105 @@ # 3. download and range request mock_metadata_from_wheel_url.side_effect = None mock_download.side_effect = HTTPRangeRequestSupported - repo._get_info_from_wheel(link) + + with contextlib.suppress(PackageInfoError): + repo._get_info_from_wheel(link) + assert mock_metadata_from_wheel_url.call_count == 2 assert mock_download.call_count == 3 assert mock_download.call_args[1]["raise_accepts_ranges"] is True # 4. only range request - repo._get_info_from_wheel(link) + with contextlib.suppress(PackageInfoError): + repo._get_info_from_wheel(link) + assert mock_metadata_from_wheel_url.call_count == 3 assert mock_download.call_count == 3 # 5. range request and download mock_metadata_from_wheel_url.side_effect = HTTPRangeRequestUnsupported mock_download.side_effect = None - repo._get_info_from_wheel(link) + + with contextlib.suppress(PackageInfoError): + repo._get_info_from_wheel(link) + assert mock_metadata_from_wheel_url.call_count == 4 assert mock_download.call_count == 4 assert mock_download.call_args[1]["raise_accepts_ranges"] is False # 6. only range request mock_metadata_from_wheel_url.side_effect = None - repo._get_info_from_wheel(link) + + with contextlib.suppress(PackageInfoError): + repo._get_info_from_wheel(link) + assert mock_metadata_from_wheel_url.call_count == 5 assert mock_download.call_count == 4 + + +@pytest.mark.parametrize( + "mock_hashes", + [ + None, + {"sha256": "e216b70f013c47b82a72540d34347632c5bfe59fd54f5fe5d51f6a68b19aaf84"}, + {"md5": "be7589b4902793e66d7d979bd8581591"}, + ], +) +def test_calculate_sha256( + mocker: MockerFixture, mock_hashes: dict[str, Any] | None +) -> None: + filename = "poetry_core-1.5.0-py3-none-any.whl" + filepath = MockRepository.DIST_FIXTURES / filename + mock_download = mocker.patch( + "poetry.repositories.http_repository.download_file", + side_effect=lambda _, dest, *args, **kwargs: shutil.copy(filepath, dest), + ) + domain = "foo.com" + link = Link(f"https://{domain}/{filename}", hashes=mock_hashes) + repo = MockRepository() + + calculated_hash = repo.calculate_sha256(link) + + assert mock_download.call_count == 1 + assert ( + calculated_hash + == "sha256:e216b70f013c47b82a72540d34347632c5bfe59fd54f5fe5d51f6a68b19aaf84" + ) + + +def test_calculate_sha256_defaults_to_sha256_on_md5_errors( + mocker: MockerFixture, +) -> None: + raised_value_error = False + + def mock_hashlib_md5_error() -> None: + nonlocal raised_value_error + raised_value_error = True + raise ValueError( + "[digital envelope routines: EVP_DigestInit_ex] disabled for FIPS" + ) + + filename = "poetry_core-1.5.0-py3-none-any.whl" + filepath = MockRepository.DIST_FIXTURES / filename + mock_download = mocker.patch( + "poetry.repositories.http_repository.download_file", + side_effect=lambda _, dest, *args, **kwargs: shutil.copy(filepath, dest), + ) + mock_hashlib_md5 = mocker.patch("hashlib.md5", side_effect=mock_hashlib_md5_error) + + domain = "foo.com" + link = Link( + f"https://{domain}/{filename}", + hashes={"md5": "be7589b4902793e66d7d979bd8581591"}, + ) + repo = MockRepository() + + calculated_hash = repo.calculate_sha256(link) + + assert raised_value_error + assert mock_download.call_count == 1 + assert mock_hashlib_md5.call_count == 1 + assert ( + calculated_hash + == "sha256:e216b70f013c47b82a72540d34347632c5bfe59fd54f5fe5d51f6a68b19aaf84" + ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-1.8.2/tests/utils/env/test_system_env.py new/poetry-1.8.3/tests/utils/env/test_system_env.py --- old/poetry-1.8.2/tests/utils/env/test_system_env.py 1970-01-01 01:00:00.000000000 +0100 +++ new/poetry-1.8.3/tests/utils/env/test_system_env.py 2024-05-03 16:24:55.000000000 +0200 @@ -0,0 +1,19 @@ +from __future__ import annotations + +import sys + +from pathlib import Path +from typing import TYPE_CHECKING + +from poetry.utils.env import SystemEnv + + +if TYPE_CHECKING: + from pytest_mock import MockerFixture + + +def test_get_marker_env_untagged_cpython(mocker: MockerFixture) -> None: + mocker.patch("platform.python_version", return_value="3.11.9+") + env = SystemEnv(Path(sys.prefix)) + marker_env = env.get_marker_env() + assert marker_env["python_full_version"] == "3.11.9" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-1.8.2/tests/vcs/git/test_backend.py new/poetry-1.8.3/tests/vcs/git/test_backend.py --- old/poetry-1.8.2/tests/vcs/git/test_backend.py 2024-03-02 15:56:12.000000000 +0100 +++ new/poetry-1.8.3/tests/vcs/git/test_backend.py 2024-05-03 16:24:55.000000000 +0200 @@ -1,5 +1,8 @@ from __future__ import annotations +import pytest + +from poetry.vcs.git.backend import Git from poetry.vcs.git.backend import is_revision_sha @@ -24,3 +27,17 @@ def test_invalid_revision_sha_max_len() -> None: result = is_revision_sha(VALID_SHA + "42") assert result is False + + +@pytest.mark.parametrize( + ("url"), + [ + "git@github.com:python-poetry/poetry.git", + "https://github.com/python-poetry/poetry.git", + "https://github.com/python-poetry/poetry", + "https://github.com/python-poetry/poetry/", + ], +) +def test_get_name_from_source_url(url: str) -> None: + name = Git.get_name_from_source_url(url) + assert name == "poetry"
participants (1)
-
Source-Sync