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

✨ Add support for Poetry 1.2.0 and above (including 1.5.1), deprecate support for Python 3.6 #28

Merged
merged 6 commits into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: ["3.7", "3.8", "3.9"]
fail-fast: false

steps:
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ It won't be helpful in other use cases like managing local app environments with

## How to use

Make sure you have Poetry version `1.2.0a1` or above. Read below for instructions to install it if you haven't.
Make sure you have Poetry version `1.2.0` or above. Read below for instructions to install it if you haven't.

### Install Poetry Version Plugin

Expand Down Expand Up @@ -137,7 +137,7 @@ authors = ["Rick Sanchez <rick@rick-citadel.com>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.6"
python = "^3.7"

[build-system]
requires = ["poetry-core"]
Expand Down Expand Up @@ -206,11 +206,11 @@ So, you could only create each version in a Git tag (for example, a GitHub relea

And then build the package on Continuous Integration (e.g. GitHub Actions). And this plugin would get the version of the package from that Git tag.

## Install Poetry `1.2.0a1`
## Install Poetry `1.2.0`

For this plugin to work, you need Poetry version `1.2.0a1` or above.
For this plugin to work, you need Poetry version `1.2.0` or above.

[Poetry `1.2.0a1` was released recently](https://python-poetry.org/blog/announcing-poetry-1-2-0a1.html).
[Poetry `1.2.0` was released recently](https://python-poetry.org/blog/announcing-poetry-1.2.0/).

There's a high chance you already have installed Poetry `1.1.x`.

Expand All @@ -234,13 +234,13 @@ $ python install-poetry.py --preview
--> 100%
```

🔍 Notice that the new installer file is named `install-poetry.py` instead of `get-poetry.py`. Also, notice that, currently, you need to set `--preview` for it to install the alpha version `1.2.0a1`.
🔍 Notice that the new installer file is named `install-poetry.py` instead of `get-poetry.py`. Also, notice that, currently, you need to set `--preview` for it to install the alpha version `1.2.0`.

You can check that it worked with:

```console
$ poetry --version
Poetry (version 1.2.0a1)
Poetry (version 1.2.0)
```

## Support for version in init file
Expand Down
8 changes: 4 additions & 4 deletions poetry_version_plugin/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
from typing import Any, Dict, Optional

from cleo.io.io import IO
from poetry.core.utils.helpers import module_name
from poetry.plugins.plugin import Plugin
from poetry.poetry import Poetry
from poetry.utils.helpers import module_name


class VersionPlugin(Plugin): # type: ignore
class VersionPlugin(Plugin):
def activate(self, poetry: Poetry, io: IO) -> None:
poetry_version_config: Optional[Dict[str, Any]] = poetry.pyproject.data.get(
"tool", {}
Expand Down Expand Up @@ -74,7 +74,7 @@
"dynamic version to __version__ "
f"variable from __init__.py: <b>{version}</b>"
)
poetry.package.set_version(version)
poetry.package._set_version(version)
return
message = (
"<b>poetry-version-plugin</b>: No valid __version__ variable found "
Expand All @@ -95,7 +95,7 @@
"<b>poetry-version-plugin</b>: Git tag found, setting "
f"dynamic version to: {tag}"
)
poetry.package.set_version(tag)
poetry.package._set_version(tag)

Check warning on line 98 in poetry_version_plugin/plugin.py

View check run for this annotation

Codecov / codecov/patch

poetry_version_plugin/plugin.py#L98

Added line #L98 was not covered by tests
return
else:
message = (
Expand Down
13 changes: 6 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "poetry-version-plugin"
version = "0.1.3"
version = "0.2.0"
description = "Poetry plugin for dynamically extracting the package version from a __version__ variable or a Git tag."
authors = ["Sebastián Ramírez <tiangolo@gmail.com>"]
homepage = "https://github.com/tiangolo/poetry-version-plugin"
Expand All @@ -24,7 +24,6 @@ classifiers = [
"Topic :: System :: Software Distribution",
"Development Status :: 3 - Alpha",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
Expand All @@ -33,14 +32,14 @@ classifiers = [
]

[tool.poetry.dependencies]
python = "^3.6"
poetry = "^1.2.0a1"
python = "^3.7"
poetry = "^1.2.0"

[tool.poetry.dev-dependencies]
pytest = "^5.2"
mypy = "^0.812"
mypy = "^1.4.1"
pytest = "^7.1.2"
flake8 = "^3.9.2"
black = {version = "^21.5-beta.1", python = ">3.6.2"}
black = "^23.3.0"
coverage = {extras = ["toml"], version = "^5.5"}
pkginfo = "^1.7.0"
autoflake = "^1.4"
Expand Down
Loading