From 5aada8e610787abf5fa471bf677372d4c345a97a Mon Sep 17 00:00:00 2001 From: Vasily Negrebetskiy Date: Wed, 21 May 2025 21:35:16 +0400 Subject: [PATCH 1/5] bump-my-version --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index f0a7c74..9eab55a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,6 +36,7 @@ dev = [ "pytest-stub>=1.1.0", "pytest>=8.3.5", "pytest-virtualenv>=1.8.1", + "bump-my-version>=1.1.4", ] [build-system] From 98582d20db2795c25a33c3f106ab67ef9696b19f Mon Sep 17 00:00:00 2001 From: Vasily Negrebetskiy Date: Wed, 21 May 2025 21:40:16 +0400 Subject: [PATCH 2/5] bmv config --- pyproject.toml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 9eab55a..0911f42 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -84,3 +84,25 @@ name = "testpypi" url = "https://test.pypi.org/simple/" publish-url = "https://test.pypi.org/legacy/" explicit = true + +[tool.bumpversion] +current_version = "0.1.3" +parse = "(?P\\d+)\\.(?P\\d+)\\.(?P\\d+)" +serialize = ["{major}.{minor}.{patch}"] +search = "{current_version}" +replace = "{new_version}" +regex = false +ignore_missing_version = false +ignore_missing_files = false +tag = false +sign_tags = false +tag_name = "v{new_version}" +tag_message = "Bump version: {current_version} → {new_version}" +allow_dirty = false +commit = false +message = "Bump version: {current_version} → {new_version}" +moveable_tags = [] +commit_args = "" +setup_hooks = [] +pre_commit_hooks = [] +post_commit_hooks = [] From 509459bdc0cb6cd63de70d42ade19a932d361f54 Mon Sep 17 00:00:00 2001 From: Vasily Negrebetskiy Date: Wed, 21 May 2025 21:42:16 +0400 Subject: [PATCH 3/5] Config fix --- pyproject.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 0911f42..c5dbd6b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -94,13 +94,13 @@ replace = "{new_version}" regex = false ignore_missing_version = false ignore_missing_files = false -tag = false +tag = true sign_tags = false tag_name = "v{new_version}" -tag_message = "Bump version: {current_version} → {new_version}" +tag_message = "Bump version: {current_version} → {new_version}" allow_dirty = false -commit = false -message = "Bump version: {current_version} → {new_version}" +commit = true +message = "Bump version: {current_version} → {new_version}" moveable_tags = [] commit_args = "" setup_hooks = [] From 60bb357eb5aedb79f865bcdbc51321d4d1fcfb91 Mon Sep 17 00:00:00 2001 From: Vasily Negrebetskiy Date: Wed, 21 May 2025 22:15:36 +0400 Subject: [PATCH 4/5] Scripts --- DEVELOPMENT.md | 23 +++++++++++++++++++++++ scripts/install.sh | 10 ++++++++++ scripts/publish.sh | 10 ++++++++++ 3 files changed, 43 insertions(+) create mode 100644 DEVELOPMENT.md create mode 100755 scripts/install.sh create mode 100755 scripts/publish.sh diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md new file mode 100644 index 0000000..7867c59 --- /dev/null +++ b/DEVELOPMENT.md @@ -0,0 +1,23 @@ +# Development + +## Installing plugin in development + +Build wheels and install them with a script: + +```bash +uv build +./scripts/install.sh +``` + +The script takes the latest version from `dist/` (created by `uv build`) and injects it into `pylsp` environment. + +## Publishing + +```bash +UV_PUBLISH_TOKEN= ./script/publish.sh patch +``` + +This will do the following: +1. Increment the version in `pyproject.toml`, commit this change and tag it. +2. Build the package distribution. +3. Publish it to the PyPI. diff --git a/scripts/install.sh b/scripts/install.sh new file mode 100755 index 0000000..adec831 --- /dev/null +++ b/scripts/install.sh @@ -0,0 +1,10 @@ +#~/bin/bash +pipx uninject python-lsp-server starkiller +echo "Removed old Starkiller" + +uv build +echo "New version ready" + +WHEEL=`ls ./dist/starkiller-*-none-any.whl | sort -V | tail -1` +pipx inject python-lsp-server ${WHEEL}[pylsp] -f +echo "Installed ${WHEEL}" diff --git a/scripts/publish.sh b/scripts/publish.sh new file mode 100755 index 0000000..3822a53 --- /dev/null +++ b/scripts/publish.sh @@ -0,0 +1,10 @@ +#~/bin/bash +set -e + +uv run --no-sync bump-my-version bump ${1} + +NEW_VERSION=$(uv run --no-sync bump-my-version show current_version) +echo "Publishing v${NEW_VERSION}" + +uv build +uv publish From dd7d55c19c4f2d5ca9f17a576e13d37937c5305d Mon Sep 17 00:00:00 2001 From: Vasily Negrebetskiy Date: Fri, 30 May 2025 17:00:54 +0400 Subject: [PATCH 5/5] Minor fixes --- DEVELOPMENT.md | 20 ++++++++------------ scripts/{install.sh => install_plugin.sh} | 0 scripts/publish.sh | 10 ---------- starkiller/project.py | 2 +- starkiller/py.typed | 0 5 files changed, 9 insertions(+), 23 deletions(-) rename scripts/{install.sh => install_plugin.sh} (100%) delete mode 100755 scripts/publish.sh create mode 100644 starkiller/py.typed diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 7867c59..cfe9d93 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -1,23 +1,19 @@ # Development -## Installing plugin in development +## Installing plugin to debug -Build wheels and install them with a script: +Build wheels and install them with a shortcut script: ```bash -uv build -./scripts/install.sh +./scripts/install_plugin.sh ``` -The script takes the latest version from `dist/` (created by `uv build`) and injects it into `pylsp` environment. - ## Publishing +Increment the package version, build the distribution and publish the latest version: + ```bash -UV_PUBLISH_TOKEN= ./script/publish.sh patch +bump-my-version bump patch +uv build +UV_PUBLISH_TOKEN= uv publish ``` - -This will do the following: -1. Increment the version in `pyproject.toml`, commit this change and tag it. -2. Build the package distribution. -3. Publish it to the PyPI. diff --git a/scripts/install.sh b/scripts/install_plugin.sh similarity index 100% rename from scripts/install.sh rename to scripts/install_plugin.sh diff --git a/scripts/publish.sh b/scripts/publish.sh deleted file mode 100755 index 3822a53..0000000 --- a/scripts/publish.sh +++ /dev/null @@ -1,10 +0,0 @@ -#~/bin/bash -set -e - -uv run --no-sync bump-my-version bump ${1} - -NEW_VERSION=$(uv run --no-sync bump-my-version show current_version) -echo "Publishing v${NEW_VERSION}" - -uv build -uv publish diff --git a/starkiller/project.py b/starkiller/project.py index 9c6d2df..6bd38cb 100644 --- a/starkiller/project.py +++ b/starkiller/project.py @@ -143,7 +143,7 @@ def _find_definitions_follow_import( inames: set[ImportedName], find_definitions: set[str] ) -> set[str]: - module_short_name = module_name.split(".")[-1] + module_short_name = module_name.rsplit(".", maxsplit=1)[-1] found_definitions: set[str] = set() is_star = any(iname.name == "*" for iname in inames) diff --git a/starkiller/py.typed b/starkiller/py.typed new file mode 100644 index 0000000..e69de29