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-04-10 00:42:19
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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"
Sun Apr 10 00:42:19 2022 rev:3 rq:968061 version:1.2.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-python-lsp-black/python-python-lsp-black.changes
2022-03-25 21:55:18.090314074 +0100
+++
/work/SRC/openSUSE:Factory/.python-python-lsp-black.new.1900/python-python-lsp-black.changes
2022-04-10 00:42:31.948694712 +0200
@@ -1,0 +2,15 @@
+Sat Apr 9 21:17:31 UTC 2022 - Ben Greiner <[email protected]>
+
+- Update to 1.2.0
+ * This release fixes formatting of Python files with non-UNIX
+ line endings, adds plugin configuration support and black
+ configuration caching to improve performance.
+ * Official support for Python 3.10 by @wlcx (PR 31).
+ * Correctly format files and ranges with line endings other than
+ LF by @ccordoba12 (PR 28).
+ * Plugin configuration support and black configuration caching by
+ @ccordoba12 and @haplo (PR 26).
+ * Fixed PyPI badge in Readme (PR 32).
+ * Updated pre-commit hooks' versions (PR 33).
+
+-------------------------------------------------------------------
Old:
----
python-lsp-black-1.1.0.tar.gz
New:
----
python-lsp-black-1.2.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-python-lsp-black.spec ++++++
--- /var/tmp/diff_new_pack.ZGKpoW/_old 2022-04-10 00:42:32.568687817 +0200
+++ /var/tmp/diff_new_pack.ZGKpoW/_new 2022-04-10 00:42:32.572687773 +0200
@@ -19,18 +19,19 @@
%{?!python_module:%define python_module() python3-%{**}}
%define skip_python2 1
Name: python-python-lsp-black
-Version: 1.1.0
+Version: 1.2.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_module base >= 3.7}
BuildRequires: %{python_module setuptools}
BuildRequires: python-rpm-macros
# SECTION test requirements
-BuildRequires: %{python_module black >= 19.3b0}
+BuildRequires: %{python_module black >= 22.1.0}
BuildRequires: %{python_module pytest}
-BuildRequires: %{python_module python-lsp-server}
+BuildRequires: %{python_module python-lsp-server >= 1.4.0}
BuildRequires: %{python_module toml}
# /SECTION
BuildRequires: fdupes
++++++ python-lsp-black-1.1.0.tar.gz -> python-lsp-black-1.2.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-lsp-black-1.1.0/PKG-INFO
new/python-lsp-black-1.2.0/PKG-INFO
--- old/python-lsp-black-1.1.0/PKG-INFO 2022-01-31 00:21:43.735670300 +0100
+++ new/python-lsp-black-1.2.0/PKG-INFO 2022-03-28 20:24:00.489029200 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: python-lsp-black
-Version: 1.1.0
+Version: 1.2.0
Summary: Black plugin for the Python LSP Server
Home-page: https://github.com/python-lsp/python-lsp-black
Author: Python LSP contributors
@@ -11,10 +11,10 @@
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/psf/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/psf/black) plugin for the [Python LSP
Server](https://github.com/python-lsp/python-lsp-server).
## Install
@@ -32,8 +32,31 @@
- 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/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.
+ - `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.
+ - The plugin can cache the black configuration that applies to each
Python file, this
+ improves performance of the plugin. When configuration caching is
enabled any changes to
+ black's configuration will need the LSP server to be restarted.
Configuration caching
+ can be disabled with the `cache_config` option, see *Configuration*
below.
+
+ # Configuration
+
+ The plugin follows [python-lsp-server's
+
configuration](https://github.com/python-lsp/python-lsp-server/#configuration).
These are
+ the valid configuration keys:
+
+ - `pylsp.plugins.black.enabled`: boolean to enable/disable the plugin.
+ - `pylsp.plugins.black.cache_config`: a boolean to enable black
configuration caching (see
+ *Usage*). `false` by default.
+ - `pylsp.plugins.black.line_length`: an integer that maps to [black's
+
`max-line-length`](https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#line-length)
+ setting. Defaults to 88 (same as black's default). This can also be
set through black's
+ configuration files, which should be preferred for multi-user
projects.
+ - `pylsp.plugins.black.preview`: a boolean to enable or disable
[black's `--preview`
+
setting](https://black.readthedocs.io/en/stable/the_black_code_style/future_style.html#preview-style).
# Development
@@ -46,8 +69,8 @@
```
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:
+ install them to run automatically when creating a git commit, thus
avoiding seeing errors
+ when you create a pull request:
```shell
pre-commit install
@@ -77,6 +100,6 @@
Classifier: Programming Language :: Python
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
-Requires-Python: >=3.6
+Requires-Python: >=3.7
Description-Content-Type: text/markdown
Provides-Extra: dev
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-lsp-black-1.1.0/README.md
new/python-lsp-black-1.2.0/README.md
--- old/python-lsp-black-1.1.0/README.md 2022-01-31 00:12:22.000000000
+0100
+++ new/python-lsp-black-1.2.0/README.md 2022-03-28 20:17:42.000000000
+0200
@@ -1,9 +1,9 @@
# python-lsp-black
-[](https://pypi.org/project/python-lsp-black)
[](https://github.com/psf/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/psf/black) plugin for the [Python LSP
Server](https://github.com/python-lsp/python-lsp-server).
## Install
@@ -21,8 +21,31 @@
- 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/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.
+- `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.
+- The plugin can cache the black configuration that applies to each Python
file, this
+ improves performance of the plugin. When configuration caching is enabled
any changes to
+ black's configuration will need the LSP server to be restarted.
Configuration caching
+ can be disabled with the `cache_config` option, see *Configuration* below.
+
+# Configuration
+
+The plugin follows [python-lsp-server's
+configuration](https://github.com/python-lsp/python-lsp-server/#configuration).
These are
+the valid configuration keys:
+
+- `pylsp.plugins.black.enabled`: boolean to enable/disable the plugin.
+- `pylsp.plugins.black.cache_config`: a boolean to enable black configuration
caching (see
+ *Usage*). `false` by default.
+- `pylsp.plugins.black.line_length`: an integer that maps to [black's
+
`max-line-length`](https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#line-length)
+ setting. Defaults to 88 (same as black's default). This can also be set
through black's
+ configuration files, which should be preferred for multi-user projects.
+- `pylsp.plugins.black.preview`: a boolean to enable or disable [black's
`--preview`
+
setting](https://black.readthedocs.io/en/stable/the_black_code_style/future_style.html#preview-style).
# Development
@@ -35,8 +58,8 @@
```
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:
+install them to run automatically when creating a git commit, thus avoiding
seeing errors
+when you create a pull request:
```shell
pre-commit install
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-lsp-black-1.1.0/pylsp_black/plugin.py
new/python-lsp-black-1.2.0/pylsp_black/plugin.py
--- old/python-lsp-black-1.1.0/pylsp_black/plugin.py 2022-01-31
00:09:55.000000000 +0100
+++ new/python-lsp-black-1.2.0/pylsp_black/plugin.py 2022-03-28
20:17:42.000000000 +0200
@@ -1,14 +1,18 @@
import logging
import os
+from functools import lru_cache
from pathlib import Path
from typing import Dict, Optional
import black
import toml
from pylsp import hookimpl
+from pylsp._utils import get_eol_chars
+from pylsp.config.config import Config
logger = logging.getLogger(__name__)
+
GLOBAL_CONFIG: Optional[Path] = None
try:
if os.name == "nt":
@@ -25,19 +29,34 @@
@hookimpl(tryfirst=True)
-def pylsp_format_document(document):
- return format_document(document)
+def pylsp_format_document(config, document):
+ return format_document(config, document)
@hookimpl(tryfirst=True)
-def pylsp_format_range(document, range):
+def pylsp_format_range(config, document, range):
range["start"]["character"] = 0
range["end"]["line"] += 1
range["end"]["character"] = 0
- return format_document(document, range)
+ return format_document(config, document, range)
+
+@hookimpl
+def pylsp_settings():
+ """Configuration options that can be set on the client."""
+ return {
+ "plugins": {
+ "black": {
+ "enabled": True,
+ "line_length": 88,
+ "preview": False,
+ "cache_config": False,
+ }
+ }
+ }
-def format_document(document, range=None):
+
+def format_document(client_config, document, range=None):
if range:
start = range["start"]["line"]
end = range["end"]["line"]
@@ -49,7 +68,7 @@
"end": {"line": len(document.lines), "character": 0},
}
- config = load_config(document.path)
+ config = load_config(document.path, client_config)
try:
formatted_text = format_text(text=text, config=config)
@@ -68,8 +87,25 @@
string_normalization=not config["skip_string_normalization"],
)
try:
- # will raise black.NothingChanged, we want to bubble that exception up
- return black.format_file_contents(text, fast=config["fast"], mode=mode)
+ # Black's format_file_contents only works reliably when eols are '\n'.
It gives
+ # an error for '\r' and produces wrong formatting for '\r\n'. So we
replace
+ # those eols by '\n' before formatting and restore them afterwards.
+ replace_eols = False
+ eol_chars = get_eol_chars(text)
+ if eol_chars is not None and eol_chars != "\n":
+ replace_eols = True
+ text = text.replace(eol_chars, "\n")
+
+ # Will raise black.NothingChanged, we want to bubble that exception up
+ formatted_text = black.format_file_contents(
+ text, fast=config["fast"], mode=mode
+ )
+
+ # Restore eols if necessary.
+ if replace_eols:
+ formatted_text = formatted_text.replace("\n", eol_chars)
+
+ return formatted_text
except (
# raised when the file has syntax errors
ValueError,
@@ -84,13 +120,17 @@
raise black.NothingChanged from e
-def load_config(filename: str) -> Dict:
+@lru_cache(100)
+def _load_config(filename: str, client_config: Config) -> Dict:
+ settings = client_config.plugin_settings("black")
+
defaults = {
- "line_length": 88,
+ "line_length": settings.get("line_length", 88),
"fast": False,
"pyi": filename.endswith(".pyi"),
"skip_string_normalization": False,
"target_version": set(),
+ "preview": settings.get("preview", False),
}
root = black.find_project_root((filename,))
@@ -139,6 +179,7 @@
black.TargetVersion.PY37,
black.TargetVersion.PY38,
black.TargetVersion.PY39,
+ black.TargetVersion.PY310,
}
else:
target_version = set()
@@ -148,3 +189,13 @@
logger.info("Using config from %s: %r", pyproject_filename, config)
return config
+
+
+def load_config(filename: str, client_config: Config) -> Dict:
+ settings = client_config.plugin_settings("black")
+
+ # Use the original, not cached function to load settings if requested
+ if not settings.get("cache_config", False):
+ return _load_config.__wrapped__(filename, client_config)
+
+ return _load_config(filename, client_config)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-lsp-black-1.1.0/pyproject.toml
new/python-lsp-black-1.2.0/pyproject.toml
--- old/python-lsp-black-1.1.0/pyproject.toml 2021-12-01 12:04:22.000000000
+0100
+++ new/python-lsp-black-1.2.0/pyproject.toml 2022-03-28 15:29:25.000000000
+0200
@@ -1,5 +1,5 @@
[tool.black]
-target-version = ['py36', 'py37', 'py38', 'py39']
+target-version = ['py36', 'py37', 'py38', 'py39', 'py310']
exclude = '''
/(
\.venv
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python-lsp-black-1.1.0/python_lsp_black.egg-info/PKG-INFO
new/python-lsp-black-1.2.0/python_lsp_black.egg-info/PKG-INFO
--- old/python-lsp-black-1.1.0/python_lsp_black.egg-info/PKG-INFO
2022-01-31 00:21:43.000000000 +0100
+++ new/python-lsp-black-1.2.0/python_lsp_black.egg-info/PKG-INFO
2022-03-28 20:24:00.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: python-lsp-black
-Version: 1.1.0
+Version: 1.2.0
Summary: Black plugin for the Python LSP Server
Home-page: https://github.com/python-lsp/python-lsp-black
Author: Python LSP contributors
@@ -11,10 +11,10 @@
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/psf/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/psf/black) plugin for the [Python LSP
Server](https://github.com/python-lsp/python-lsp-server).
## Install
@@ -32,8 +32,31 @@
- 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/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.
+ - `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.
+ - The plugin can cache the black configuration that applies to each
Python file, this
+ improves performance of the plugin. When configuration caching is
enabled any changes to
+ black's configuration will need the LSP server to be restarted.
Configuration caching
+ can be disabled with the `cache_config` option, see *Configuration*
below.
+
+ # Configuration
+
+ The plugin follows [python-lsp-server's
+
configuration](https://github.com/python-lsp/python-lsp-server/#configuration).
These are
+ the valid configuration keys:
+
+ - `pylsp.plugins.black.enabled`: boolean to enable/disable the plugin.
+ - `pylsp.plugins.black.cache_config`: a boolean to enable black
configuration caching (see
+ *Usage*). `false` by default.
+ - `pylsp.plugins.black.line_length`: an integer that maps to [black's
+
`max-line-length`](https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#line-length)
+ setting. Defaults to 88 (same as black's default). This can also be
set through black's
+ configuration files, which should be preferred for multi-user
projects.
+ - `pylsp.plugins.black.preview`: a boolean to enable or disable
[black's `--preview`
+
setting](https://black.readthedocs.io/en/stable/the_black_code_style/future_style.html#preview-style).
# Development
@@ -46,8 +69,8 @@
```
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:
+ install them to run automatically when creating a git commit, thus
avoiding seeing errors
+ when you create a pull request:
```shell
pre-commit install
@@ -77,6 +100,6 @@
Classifier: Programming Language :: Python
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
-Requires-Python: >=3.6
+Requires-Python: >=3.7
Description-Content-Type: text/markdown
Provides-Extra: dev
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/python-lsp-black-1.1.0/python_lsp_black.egg-info/requires.txt
new/python-lsp-black-1.2.0/python_lsp_black.egg-info/requires.txt
--- old/python-lsp-black-1.1.0/python_lsp_black.egg-info/requires.txt
2022-01-31 00:21:43.000000000 +0100
+++ new/python-lsp-black-1.2.0/python_lsp_black.egg-info/requires.txt
2022-03-28 20:24:00.000000000 +0200
@@ -1,5 +1,5 @@
-black>=19.3b0
-python-lsp-server
+black>=22.1.0
+python-lsp-server>=1.4.0
toml
[dev]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-lsp-black-1.1.0/setup.cfg
new/python-lsp-black-1.2.0/setup.cfg
--- old/python-lsp-black-1.1.0/setup.cfg 2022-01-31 00:21:43.735670300
+0100
+++ new/python-lsp-black-1.2.0/setup.cfg 2022-03-28 20:24:00.489029200
+0200
@@ -1,6 +1,6 @@
[metadata]
name = python-lsp-black
-version = 1.1.0
+version = 1.2.0
author = Python LSP contributors
author_email = [email protected]
description = Black plugin for the Python LSP Server
@@ -18,8 +18,8 @@
[options]
packages = find:
-install_requires = python-lsp-server; black>=19.3b0; toml
-python_requires = >= 3.6
+install_requires = python-lsp-server>=1.4.0; black>=22.1.0; toml
+python_requires = >= 3.7
[options.entry_points]
pylsp = pylsp_black = pylsp_black.plugin