Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-python-lsp-black for
openSUSE:Factory checked in at 2022-03-25 21:54:58
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-python-lsp-black (Old)
and /work/SRC/openSUSE:Factory/.python-python-lsp-black.new.1900 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-python-lsp-black"
Fri Mar 25 21:54:58 2022 rev:2 rq:964847 version:1.1.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-python-lsp-black/python-python-lsp-black.changes
2021-07-16 22:13:22.154564334 +0200
+++
/work/SRC/openSUSE:Factory/.python-python-lsp-black.new.1900/python-python-lsp-black.changes
2022-03-25 21:55:18.090314074 +0100
@@ -1,0 +2,8 @@
+Fri Mar 25 12:39:20 UTC 2022 - Ben Greiner <[email protected]>
+
+- Update to 1.1.0
+ * Support global config as a fallback by @jdost in #19
+ * Fix TypeError when formatting with black 22.1.0+ by @wlcx in
+ #30
+
+-------------------------------------------------------------------
Old:
----
python-lsp-black-1.0.0.tar.gz
New:
----
python-lsp-black-1.1.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-python-lsp-black.spec ++++++
--- /var/tmp/diff_new_pack.4EAtBt/_old 2022-03-25 21:55:18.542314504 +0100
+++ /var/tmp/diff_new_pack.4EAtBt/_new 2022-03-25 21:55:18.550314512 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-python-lsp-black
#
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -19,19 +19,19 @@
%{?!python_module:%define python_module() python3-%{**}}
%define skip_python2 1
Name: python-python-lsp-black
-Version: 1.0.0
+Version: 1.1.0
Release: 0
Summary: Black plugin for the Python LSP Server
License: MIT
URL: https://github.com/python-lsp/python-lsp-black
Source:
https://files.pythonhosted.org/packages/source/p/python-lsp-black/python-lsp-black-%{version}.tar.gz
-BuildRequires: python-rpm-macros
BuildRequires: %{python_module setuptools}
+BuildRequires: python-rpm-macros
# SECTION test requirements
BuildRequires: %{python_module black >= 19.3b0}
+BuildRequires: %{python_module pytest}
BuildRequires: %{python_module python-lsp-server}
BuildRequires: %{python_module toml}
-BuildRequires: %{python_module pytest}
# /SECTION
BuildRequires: fdupes
Requires: python-black >= 19.3b0
++++++ python-lsp-black-1.0.0.tar.gz -> python-lsp-black-1.1.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-lsp-black-1.0.0/PKG-INFO
new/python-lsp-black-1.1.0/PKG-INFO
--- old/python-lsp-black-1.0.0/PKG-INFO 2021-05-18 20:00:18.865016000 +0200
+++ new/python-lsp-black-1.1.0/PKG-INFO 2022-01-31 00:21:43.735670300 +0100
@@ -1,18 +1,22 @@
Metadata-Version: 2.1
Name: python-lsp-black
-Version: 1.0.0
+Version: 1.1.0
Summary: Black plugin for the Python LSP Server
Home-page: https://github.com/python-lsp/python-lsp-black
Author: Python LSP contributors
-Author-email: [email protected]
+Author-email: [email protected]
License: UNKNOWN
+Project-URL: Bug Tracker, https://github.com/python-lsp/python-lsp-black/issues
+Project-URL: Changelog,
https://github.com/python-lsp/python-lsp-black/blob/master/CHANGELOG.md
+Project-URL: Source Code, https://github.com/python-lsp/python-lsp-black
Description: # python-lsp-black
-
[](https://pypi.org/project/python-lsp-black)
[](https://github.com/ambv/black)
+
[](https://pypi.org/project/python-lsp-black)
[](https://github.com/psf/black)
[](https://github.com/python-lsp/python-lsp-black/actions/workflows/python.yml)
+ > [Black](https://github.com/psf/black) plugin for the [Python LSP
Server](https://github.com/python-lsp/python-lsp-server).
- > [Black](https://github.com/ambv/black) plugin for the [Python LSP
Server](https://github.com/python-lsp/python-lsp-server).
+ ## Install
In the same `virtualenv` as `python-lsp-server`:
@@ -20,13 +24,54 @@
pip install python-lsp-black
```
+ # Usage
+
To avoid unexpected results you should make sure `yapf` and `autopep8`
are not installed.
- * `python-lsp-black` can either format an entire file or just the
selected text.
- * The code will only be formatted if it is syntactically valid Python.
- * Text selections are treated as if they were a separate Python file.
+ - `python-lsp-black` can either format an entire file or just the
selected text.
+ - The code will only be formatted if it is syntactically valid Python.
+ - Text selections are treated as if they were a separate Python file.
Unfortunately this means you can't format an indented block of code.
- * `python-lsp-black` will use your project's
[pyproject.toml](https://github.com/ambv/black#pyprojecttoml) if it has one.
+ - `python-lsp-black` will use your project's
[pyproject.toml](https://github.com/psf/black#pyprojecttoml) if it has one.
+ - `python-lsp-black` only officially supports the latest stable
version of [black](https://github.com/psf/black). An effort is made to keep
backwards-compatibility but older black versions will not be actively tested.
+
+ # Development
+
+ To install the project for development you need to specify the dev
optional dependencies:
+
+ ```shell
+ python -m venv .venv
+ . .venv/bin/activate
+ pip install -e .[dev]
+ ```
+
+ This project uses [pre-commit](https://pre-commit.com/) hooks to
control code quality,
+ install them to run them when creating a git commit, thus avoiding
seeing errors when you
+ create a pull request:
+
+ ```shell
+ pre-commit install
+ ```
+
+ To run tests:
+
+ ```shell
+ make test
+ ```
+
+ To run linters:
+
+ ```shell
+ make lint # just a shortcut to pre-commit run -a
+ make <linter_name> # black, flake8, isort, mypy
+ ```
+
+ To upgrade the version of the pre-commit hooks:
+
+ ```shell
+ pre-commit autoupdate
+ # check and git commit changes to .pre-commit-config.yaml
+ ```
Platform: UNKNOWN
Classifier: Programming Language :: Python
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-lsp-black-1.0.0/README.md
new/python-lsp-black-1.1.0/README.md
--- old/python-lsp-black-1.0.0/README.md 2021-05-18 19:56:35.000000000
+0200
+++ new/python-lsp-black-1.1.0/README.md 2022-01-31 00:12:22.000000000
+0100
@@ -1,10 +1,11 @@
# python-lsp-black
-[](https://pypi.org/project/python-lsp-black)
[](https://github.com/ambv/black)
+[](https://pypi.org/project/python-lsp-black)
[](https://github.com/psf/black)
[](https://github.com/python-lsp/python-lsp-black/actions/workflows/python.yml)
+> [Black](https://github.com/psf/black) plugin for the [Python LSP
Server](https://github.com/python-lsp/python-lsp-server).
-> [Black](https://github.com/ambv/black) plugin for the [Python LSP
Server](https://github.com/python-lsp/python-lsp-server).
+## Install
In the same `virtualenv` as `python-lsp-server`:
@@ -12,10 +13,51 @@
pip install python-lsp-black
```
+# Usage
+
To avoid unexpected results you should make sure `yapf` and `autopep8` are not
installed.
-* `python-lsp-black` can either format an entire file or just the selected
text.
-* The code will only be formatted if it is syntactically valid Python.
-* Text selections are treated as if they were a separate Python file.
+- `python-lsp-black` can either format an entire file or just the selected
text.
+- The code will only be formatted if it is syntactically valid Python.
+- Text selections are treated as if they were a separate Python file.
Unfortunately this means you can't format an indented block of code.
-* `python-lsp-black` will use your project's
[pyproject.toml](https://github.com/ambv/black#pyprojecttoml) if it has one.
+- `python-lsp-black` will use your project's
[pyproject.toml](https://github.com/psf/black#pyprojecttoml) if it has one.
+- `python-lsp-black` only officially supports the latest stable version of
[black](https://github.com/psf/black). An effort is made to keep
backwards-compatibility but older black versions will not be actively tested.
+
+# Development
+
+To install the project for development you need to specify the dev optional
dependencies:
+
+```shell
+python -m venv .venv
+. .venv/bin/activate
+pip install -e .[dev]
+```
+
+This project uses [pre-commit](https://pre-commit.com/) hooks to control code
quality,
+install them to run them when creating a git commit, thus avoiding seeing
errors when you
+create a pull request:
+
+```shell
+pre-commit install
+```
+
+To run tests:
+
+```shell
+make test
+```
+
+To run linters:
+
+```shell
+make lint # just a shortcut to pre-commit run -a
+make <linter_name> # black, flake8, isort, mypy
+```
+
+To upgrade the version of the pre-commit hooks:
+
+```shell
+pre-commit autoupdate
+# check and git commit changes to .pre-commit-config.yaml
+```
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-lsp-black-1.0.0/pylsp_black/plugin.py
new/python-lsp-black-1.1.0/pylsp_black/plugin.py
--- old/python-lsp-black-1.0.0/pylsp_black/plugin.py 2021-05-18
19:50:42.000000000 +0200
+++ new/python-lsp-black-1.1.0/pylsp_black/plugin.py 2022-01-31
00:09:55.000000000 +0100
@@ -1,9 +1,28 @@
-from typing import Dict
+import logging
+import os
+from pathlib import Path
+from typing import Dict, Optional
import black
import toml
from pylsp import hookimpl
+logger = logging.getLogger(__name__)
+
+GLOBAL_CONFIG: Optional[Path] = None
+try:
+ if os.name == "nt":
+ GLOBAL_CONFIG = Path.home() / ".black"
+ elif "XDG_CONFIG_HOME" in os.environ:
+ GLOBAL_CONFIG = Path(os.environ["XDG_CONFIG_HOME"]) / "black"
+ else:
+ GLOBAL_CONFIG = Path.home() / ".config" / "black"
+except Exception as e:
+ logger.error("Error determining black global config file path: %s", e)
+else:
+ if GLOBAL_CONFIG is not None and GLOBAL_CONFIG.exists():
+ logger.info("Found black global config file at %s", GLOBAL_CONFIG)
+
@hookimpl(tryfirst=True)
def pylsp_format_document(document):
@@ -34,16 +53,8 @@
try:
formatted_text = format_text(text=text, config=config)
- except (
- ValueError,
+ except black.NothingChanged:
# raised when the file is already formatted correctly
- black.NothingChanged,
- # raised when the file being formatted has an indentation error
- IndentationError,
- # raised when black produces invalid Python code or formats the file
- # differently on the second pass
- AssertionError,
- ):
return []
return [{"range": range, "newText": formatted_text}]
@@ -56,8 +67,21 @@
is_pyi=config["pyi"],
string_normalization=not config["skip_string_normalization"],
)
-
- return black.format_file_contents(text, fast=config["fast"], mode=mode)
+ try:
+ # will raise black.NothingChanged, we want to bubble that exception up
+ return black.format_file_contents(text, fast=config["fast"], mode=mode)
+ except (
+ # raised when the file has syntax errors
+ ValueError,
+ # raised when the file being formatted has an indentation error
+ IndentationError,
+ # raised when black produces invalid Python code or formats the file
+ # differently on the second pass
+ AssertionError,
+ ) as e:
+ # errors will show on lsp stderr stream
+ logger.error("Error formatting with black: %s", e)
+ raise black.NothingChanged from e
def load_config(filename: str) -> Dict:
@@ -71,14 +95,27 @@
root = black.find_project_root((filename,))
- pyproject_filename = root / "pyproject.toml"
+ # Black 22.1.0+ returns a tuple
+ if isinstance(root, tuple):
+ pyproject_filename = root[0] / "pyproject.toml"
+ else:
+ pyproject_filename = root / "pyproject.toml"
if not pyproject_filename.is_file():
- return defaults
+ if GLOBAL_CONFIG is not None and GLOBAL_CONFIG.exists():
+ pyproject_filename = GLOBAL_CONFIG
+ logger.info("Using global black config at %s", pyproject_filename)
+ else:
+ logger.info("Using defaults: %r", defaults)
+ return defaults
try:
pyproject_toml = toml.load(str(pyproject_filename))
except (toml.TomlDecodeError, OSError):
+ logger.warning(
+ "Error decoding pyproject.toml, using defaults: %r",
+ defaults,
+ )
return defaults
file_config = pyproject_toml.get("tool", {}).get("black", {})
@@ -108,4 +145,6 @@
config["target_version"] = target_version
+ logger.info("Using config from %s: %r", pyproject_filename, config)
+
return config
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-lsp-black-1.0.0/pyproject.toml
new/python-lsp-black-1.1.0/pyproject.toml
--- old/python-lsp-black-1.0.0/pyproject.toml 2021-05-18 19:11:34.000000000
+0200
+++ new/python-lsp-black-1.1.0/pyproject.toml 2021-12-01 12:04:22.000000000
+0100
@@ -1,5 +1,5 @@
[tool.black]
-target-version = ['py36', 'py37', 'py38']
+target-version = ['py36', 'py37', 'py38', 'py39']
exclude = '''
/(
\.venv
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python-lsp-black-1.0.0/python_lsp_black.egg-info/PKG-INFO
new/python-lsp-black-1.1.0/python_lsp_black.egg-info/PKG-INFO
--- old/python-lsp-black-1.0.0/python_lsp_black.egg-info/PKG-INFO
2021-05-18 20:00:18.000000000 +0200
+++ new/python-lsp-black-1.1.0/python_lsp_black.egg-info/PKG-INFO
2022-01-31 00:21:43.000000000 +0100
@@ -1,18 +1,22 @@
Metadata-Version: 2.1
Name: python-lsp-black
-Version: 1.0.0
+Version: 1.1.0
Summary: Black plugin for the Python LSP Server
Home-page: https://github.com/python-lsp/python-lsp-black
Author: Python LSP contributors
-Author-email: [email protected]
+Author-email: [email protected]
License: UNKNOWN
+Project-URL: Bug Tracker, https://github.com/python-lsp/python-lsp-black/issues
+Project-URL: Changelog,
https://github.com/python-lsp/python-lsp-black/blob/master/CHANGELOG.md
+Project-URL: Source Code, https://github.com/python-lsp/python-lsp-black
Description: # python-lsp-black
-
[](https://pypi.org/project/python-lsp-black)
[](https://github.com/ambv/black)
+
[](https://pypi.org/project/python-lsp-black)
[](https://github.com/psf/black)
[](https://github.com/python-lsp/python-lsp-black/actions/workflows/python.yml)
+ > [Black](https://github.com/psf/black) plugin for the [Python LSP
Server](https://github.com/python-lsp/python-lsp-server).
- > [Black](https://github.com/ambv/black) plugin for the [Python LSP
Server](https://github.com/python-lsp/python-lsp-server).
+ ## Install
In the same `virtualenv` as `python-lsp-server`:
@@ -20,13 +24,54 @@
pip install python-lsp-black
```
+ # Usage
+
To avoid unexpected results you should make sure `yapf` and `autopep8`
are not installed.
- * `python-lsp-black` can either format an entire file or just the
selected text.
- * The code will only be formatted if it is syntactically valid Python.
- * Text selections are treated as if they were a separate Python file.
+ - `python-lsp-black` can either format an entire file or just the
selected text.
+ - The code will only be formatted if it is syntactically valid Python.
+ - Text selections are treated as if they were a separate Python file.
Unfortunately this means you can't format an indented block of code.
- * `python-lsp-black` will use your project's
[pyproject.toml](https://github.com/ambv/black#pyprojecttoml) if it has one.
+ - `python-lsp-black` will use your project's
[pyproject.toml](https://github.com/psf/black#pyprojecttoml) if it has one.
+ - `python-lsp-black` only officially supports the latest stable
version of [black](https://github.com/psf/black). An effort is made to keep
backwards-compatibility but older black versions will not be actively tested.
+
+ # Development
+
+ To install the project for development you need to specify the dev
optional dependencies:
+
+ ```shell
+ python -m venv .venv
+ . .venv/bin/activate
+ pip install -e .[dev]
+ ```
+
+ This project uses [pre-commit](https://pre-commit.com/) hooks to
control code quality,
+ install them to run them when creating a git commit, thus avoiding
seeing errors when you
+ create a pull request:
+
+ ```shell
+ pre-commit install
+ ```
+
+ To run tests:
+
+ ```shell
+ make test
+ ```
+
+ To run linters:
+
+ ```shell
+ make lint # just a shortcut to pre-commit run -a
+ make <linter_name> # black, flake8, isort, mypy
+ ```
+
+ To upgrade the version of the pre-commit hooks:
+
+ ```shell
+ pre-commit autoupdate
+ # check and git commit changes to .pre-commit-config.yaml
+ ```
Platform: UNKNOWN
Classifier: Programming Language :: Python
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python-lsp-black-1.0.0/python_lsp_black.egg-info/requires.txt
new/python-lsp-black-1.1.0/python_lsp_black.egg-info/requires.txt
--- old/python-lsp-black-1.0.0/python_lsp_black.egg-info/requires.txt
2021-05-18 20:00:18.000000000 +0200
+++ new/python-lsp-black-1.1.0/python_lsp_black.egg-info/requires.txt
2022-01-31 00:21:43.000000000 +0100
@@ -1,10 +1,14 @@
-python-lsp-server
black>=19.3b0
+python-lsp-server
toml
[dev]
-isort>=5.0
flake8
-pytest
+isort>=5.0
mypy
+pre-commit
+pytest
pytest
+types-pkg_resources
+types-setuptools
+types-toml
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-lsp-black-1.0.0/setup.cfg
new/python-lsp-black-1.1.0/setup.cfg
--- old/python-lsp-black-1.0.0/setup.cfg 2021-05-18 20:00:18.865016000
+0200
+++ new/python-lsp-black-1.1.0/setup.cfg 2022-01-31 00:21:43.735670300
+0100
@@ -1,12 +1,16 @@
[metadata]
name = python-lsp-black
-version = 1.0.0
+version = 1.1.0
author = Python LSP contributors
-author_email = [email protected]
+author_email = [email protected]
description = Black plugin for the Python LSP Server
url = https://github.com/python-lsp/python-lsp-black
long_description = file: README.md
long_description_content_type = text/markdown
+project_urls =
+ Bug Tracker = https://github.com/python-lsp/python-lsp-black/issues
+ Changelog =
https://github.com/python-lsp/python-lsp-black/blob/master/CHANGELOG.md
+ Source Code = https://github.com/python-lsp/python-lsp-black
classifiers =
Programming Language :: Python
License :: OSI Approved :: MIT License
@@ -21,17 +25,20 @@
pylsp = pylsp_black = pylsp_black.plugin
[options.extras_require]
-dev = isort>=5.0; flake8; pytest; mypy; pytest
+dev = isort>=5.0; flake8; pre-commit; pytest; mypy; pytest;
types-pkg_resources; types-setuptools; types-toml
[flake8]
max-line-length = 88
ignore = E203
+exclude =
+ .venv
[mypy]
ignore_missing_imports = true
[isort]
profile = black
+skip_glob = [".venv"]
[egg_info]
tag_build =