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

Migrate to Poetry and modernise #349

Merged
merged 6 commits into from
Jul 29, 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
154 changes: 97 additions & 57 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,101 +4,141 @@ on:
- push
- pull_request

defaults:
run:
shell: bash

jobs:
pre_job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: 'outdated_runs'
cancel_others: 'true'
skip_after_successful_duplicate: 'false'

test:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2

- uses: actions/checkout@v3
- name: Use Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"

- name: pip cache
uses: actions/cache@v2
- name: Install Poetry
uses: snok/install-poetry@v1
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Install Python dependencies
run: python -m pip install --upgrade pip tox

- name: tox
run: tox -e py
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --all-extras
- name: Run tests
run: |
source $VENV # Only needed because of Github Action caching
poe test

test-pyodide:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: actions/checkout@v3
- name: Use Python "3.10"
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-in-project: true
- name: Install Dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |

sudo apt update
sudo apt install chromium-browser chromium-chromedriver

python -m pip install --upgrade pip
python -m pip install -r tests/pyodide_testrunner/requirements.txt

poetry install --with pyodide
- name: Run Testsuite
run: python tests/pyodide_testrunner/run.py
run: |
source $VENV
poe test-pyodide

build:
lint:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Use Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Get pip cache dir
id: pip-cache
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --all-extras --with dev
- name: Run lints
run: |
echo "::set-output name=dir::$(pip cache dir)"
source $VENV
poe lint

- name: pip cache
uses: actions/cache@v2
build:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Install Python dependencies
run: python -m pip install --upgrade build

- name: Build packges (sdist and wheel)
fetch-depth: 0
- name: Use Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --all-extras
- name: Build packages (sdist and wheel)
run: |
git describe --tags --abbrev=0
python -m build

poetry build
- name: Upload builds
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: build-artifacts
path: "dist/*"
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Release Pygls to PyPI

on:
release:
types: [published]

jobs:
relase:
name: "🚀 Release 🚢"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use Python "3.10"
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Generate the latest changelog
uses: orhun/git-cliff-action@v2
id: git-cliff
with:
args: --verbose --latest
- name: Update the changelog
run: |
cat "${{ steps.git-cliff.outputs.contents }} | "sed -i "3r /dev/stdin" CHANGELOG.md
git config --global user.name 'Github Action'
git config --global user.email 'github.action@users.noreply.github.com'
git commit -am "chore: update changelog"
git push
- name: Update CONTRIBUTORS.md
run: |
poetry run poe generate_contributors_md
if [[ $(git diff --stat CONTRIBUTORS.md) != '' ]]; then
git commit -am "chore: update CONTRIBUTORS.md"
git push
fi
- name: Release
run: |
poetry build
poetry publish --username "__token__" --password ${{ secrets.PYPI_API_TOKEN }}
15 changes: 6 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog][keepachangelog],
and this project adheres to [Semantic Versioning][semver].

## [Unreleased]
### Added
### Extra Notes
#### Added

- Add `LanguageClient` with LSP methods autogenerated from type annotations in `lsprotocol` ([#328])
- Add base JSON-RPC `Client` with support for running servers in a subprocess and communicating over stdio. ([#328])
- Support work done progress cancel ([#253])
- Add support for `textDocument/inlayHint` and `inlayHint/resolve` requests ([#342])

### Changed
### Fixed
[#304]: https://github.com/openlawlibrary/pygls/issues/304
#### Changed
#### Fixed

- `pygls` no longer overrides the event loop for the current thread when given an explicit loop to use. ([#334])
- Fixed `MethodTypeNotRegisteredError` when registering a `TEXT_DOCUMENT_DID_SAVE` feature with options. ([#338])
Expand All @@ -26,7 +21,9 @@ and this project adheres to [Semantic Versioning][semver].
[#338]: https://github.com/openlawlibrary/pygls/discussions/338
[#253]: https://github.com/openlawlibrary/pygls/pull/253
[#342]: https://github.com/openlawlibrary/pygls/pull/342
[#304]: https://github.com/openlawlibrary/pygls/issues/304

# Pre Automation Changelog

## [1.0.2] - May 15th, 2023
### Changed
Expand Down
55 changes: 31 additions & 24 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
# Contributors (alphabetical)

- [@augb](https://github.com/augb)
- [Alex Carney](https://github.com/alcarney)
- [Brett Cannon](https://github.com/brettcannon/)
- [Daniel Elero](https://github.com/danixeee)
- [Daniel Miller](https://github.com/millerdev)
- [DeathAxe](https://github.com/deathaxe)
- [Denis Loginov](https://github.com/dinvlad)
- [Dillan Mills](https://github.com/DillanCMills)
- [Felicián Németh](https://github.com/nemethf)
- [Felix Yan](https://github.com/felixonmars)
- [Jelle van der Waa](https://github.com/jelly)
- [Jérome Perrin](https://github.com/perrinjerome)
- [Karthik Nadig](https://github.com/karthiknadig)
- [Laurence Warne](https://github.com/LaurenceWarne)
- [Matej Kašťák](https://github.com/MatejKastak)
- [Max O'Cull](https://github.com/Maxattax97)
- [Samuel Roeca](https://github.com/pappasam)
- [Tom BH](https://github.com/tombh)
- [Tomoya Tanjo](https://github.com/tom-tan)
- [bollwyvl](https://github.com/bollwyvl)
- [yorodm](https://github.com/yorodm)
- [Zanie Blue](https://github.com/zanieb)
# Contributors (contributions)
* [alcarney](https://github.com/alcarney) (57)
* [anu-ka](https://github.com/anu-ka) (1)
* [augb](https://github.com/augb) (35)
* [berquist](https://github.com/berquist) (1)
* [brettcannon](https://github.com/brettcannon) (2)
* [D4N](https://github.com/D4N) (1)
* [danixeee](https://github.com/danixeee) (321)
* [deathaxe](https://github.com/deathaxe) (24)
* [dependabot[bot]](https://github.com/apps/dependabot) (6)
* [dgreisen](https://github.com/dgreisen) (4)
* [DillanCMills](https://github.com/DillanCMills) (1)
* [dimbleby](https://github.com/dimbleby) (9)
* [dinvlad](https://github.com/dinvlad) (9)
* [eirikpre](https://github.com/eirikpre) (1)
* [felixonmars](https://github.com/felixonmars) (1)
* [HankBO](https://github.com/HankBO) (1)
* [jelly](https://github.com/jelly) (1)
* [KOLANICH](https://github.com/KOLANICH) (3)
* [LaurenceWarne](https://github.com/LaurenceWarne) (2)
* [MatejKastak](https://github.com/MatejKastak) (3)
* [muffinmad](https://github.com/muffinmad) (2)
* [nemethf](https://github.com/nemethf) (1)
* [otreblan](https://github.com/otreblan) (1)
* [pappasam](https://github.com/pappasam) (7)
* [perimosocordiae](https://github.com/perimosocordiae) (1)
* [perrinjerome](https://github.com/perrinjerome) (24)
* [renatav](https://github.com/renatav) (2)
* [tombh](https://github.com/tombh) (30)
* [tsugumi-sys](https://github.com/tsugumi-sys) (1)
* [zanieb](https://github.com/zanieb) (4)
1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

4 changes: 0 additions & 4 deletions PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,5 @@ _Please replace this description with a concise description of this Pull Request
- [ ] Tests have been included and/or updated, as appropriate
- [ ] Docstrings have been included and/or updated, as appropriate
- [ ] Standalone docs have been updated accordingly
- [ ] [CONTRIBUTORS.md][contributors] was updated, as appropriate
- [ ] Changelog has been updated, as needed (see [CHANGELOG.md][changelog])

[changelog]: https://github.com/openlawlibrary/pygls/blob/master/CHANGELOG.md
[commit messages]: https://chris.beams.io/posts/git-commit/
[contributors]: https://github.com/openlawlibrary/pygls/blob/master/CONTRIBUTORS.md
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ There are also other Language Servers with "general" in their descriptons, or at
* https://github.com/mattn/efm-langserver
* https://github.com/jose-elias-alvarez/null-ls.nvim (Neovim only)

## Tests

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


## Contributing

Your contributions to _pygls_ are most welcome ❤️ Please review the [Contributing](https://github.com/openlawlibrary/pygls/blob/master/CONTRIBUTING.md) and [Code of Conduct](https://github.com/openlawlibrary/pygls/blob/master/CODE_OF_CONDUCT.md) documents for how to get started.
Expand Down
34 changes: 0 additions & 34 deletions RELEASING.md

This file was deleted.

Loading
Loading