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

feat: drop Python 3.7 support #417

Merged
merged 2 commits into from
Nov 30, 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/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ htmlcov/
.tox/
.coverage
.coverage.*
cov.pth
.cache
nosetests.xml
coverage.xml
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ There are also other Language Servers with "general" in their descriptons, or at
* https://github.com/jose-elias-alvarez/null-ls.nvim (Neovim only)

## Tests
All Pygls sub-tasks require the Poetry `poe` plugin: https://github.com/nat-n/poethepoet

* `poetry install --all-extras`
* `poetry run test`
* `poetry run test-pyodide`
* `poetry run poe test`
* `poetry run poe test-pyodide`


## Contributing
Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Features
Python Versions
---------------

*pygls* works with Python 3.7.16+.
*pygls* works with Python 3.8+.

User Guide
----------
Expand Down
2 changes: 1 addition & 1 deletion docs/source/pages/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ In order to setup and run the example VSCode extension, you need following softw
installed:

* `Visual Studio Code <https://code.visualstudio.com/>`_ editor
* `Python 3.7.16+ <https://www.python.org/downloads/>`_
* `Python 3.8+ <https://www.python.org/downloads/>`_
* `vscode-python <https://marketplace.visualstudio.com/items?itemName=ms-python.python>`_ extension
* A clone of the `pygls <https://github.com/openlawlibrary/pygls>`_ repository

Expand Down
2 changes: 1 addition & 1 deletion docs/source/pages/user-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ Depending on the use case, handlers can be registered in three different ways:
*Asynchronous* Functions (*Coroutines*)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

*pygls* supports ``python 3.7+`` which has a keyword ``async`` to
*pygls* supports ``python 3.8+`` which has a keyword ``async`` to
specify coroutines.

The code snippet below shows how to register a command as a coroutine:
Expand Down
846 changes: 372 additions & 474 deletions poetry.lock

Large diffs are not rendered by default.

38 changes: 23 additions & 15 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,42 @@ documentation = "https://pygls.readthedocs.io/en/latest"
license = "Apache 2.0"
readme = "README.md"

# You may want to use the Poetry "Up" plugin to automatically update all dependencies to
# their latest major versions. But bear in mind that this is a library, so the non-development
# dependency versions will be forced on downstream users. Therefore the very latest versions
# may be too restrictive.
# See https://github.com/MousaZeidBaker/poetry-plugin-up
[tool.poetry.dependencies]
python = ">=3.7.9,<4"
python = ">=3.8"
lsprotocol = "2023.0.0"
websockets = { version = "^11.0.3", optional = true }
websockets = { version = ">=11.0.3", optional = true }

[tool.poetry.extras]
ws = ["websockets"]

[tool.poetry.group.dev.dependencies]
# Replaces (amongst many other things) flake8 and bandit
ruff = "^0.0.275"
ruff = ">=0.1.6"
# TODO `poethepoet>=0.20` needs python 3.8
poethepoet = "^0.19.0"
mypy = "^1.4.1"
poethepoet = ">=0.24.4"
mypy = ">=1.7.1"
# TODO `black>=23` needs python 3.8
black = "22.8"
black = ">=23.11.0"

[tool.poetry.group.test.dependencies]
coverage = { version = "^7.2.1", extras = ["toml"] }
pytest = "7.1.2"
pytest-asyncio = "^0.21.0"
# Note: `coverage` requires that your Python was built with system `sqlite` development files
coverage = { version = ">=7.3.2", extras = ["toml"] }
pytest = ">=7.4.3"
# TODO: tests freeze on v0.21.1
pytest-asyncio = "0.21.0"

[tool.poetry.group.docs.dependencies]
# TODO `sphinx==7` needs python 3.8
sphinx = "^5"
# TODO `sphinx-rtd-theme==1.3.0` will support `sphinx==7`
sphinx-rtd-theme = "^1.2.2"
# TODO `sphinx>=7.26` needs python 3.9
sphinx = ">=7.1.2"
sphinx-rtd-theme = ">=1.3.0"

[tool.poetry.group.pyodide.dependencies]
selenium = "^4.10.0"
selenium = "^4.15.2"

[tool.pytest.ini_options]
asyncio_mode = "auto"
Expand All @@ -55,6 +61,7 @@ check_commit_style = "npx commitlint --from origin/main --to HEAD --verbose --co
generate_client = "python scripts/generate_client.py --output pygls/lsp/client.py"
generate_contributors_md = "python scripts/generate_contributors_md.py"
black_check = "black --check ."
poetry_lock_check = "poetry check"

[tool.poe.tasks.test]
env = { COVERAGE_PROCESS_START = "pyproject.toml" }
Expand All @@ -73,7 +80,8 @@ sequence = [
"mypy",
"check_generated_client",
"check_commit_style",
"black_check"
"black_check",
"poetry_lock_check"
]
ignore_fail = "return_non_zero"

Expand Down
9 changes: 2 additions & 7 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@
############################################################################
import asyncio
import pathlib
import sys

import pytest
from lsprotocol import types, converters

from pygls import uris, IS_PYODIDE, IS_WIN
from pygls import uris, IS_PYODIDE
from pygls.feature_manager import FeatureManager
from pygls.workspace import Workspace

Expand Down Expand Up @@ -84,11 +83,7 @@ def event_loop():
"""Redefine `pytest-asyncio's default event_loop fixture to match the scope
of our client fixture."""

# Only required for Python 3.7 on Windows.
if sys.version_info.minor == 7 and IS_WIN:
policy = asyncio.WindowsProactorEventLoopPolicy()
else:
policy = asyncio.get_event_loop_policy()
policy = asyncio.get_event_loop_policy()

loop = policy.new_event_loop()
yield loop
Expand Down
Loading