From e09cbeafe8df442afff2016ba853abec1049be62 Mon Sep 17 00:00:00 2001 From: Kevin Tewouda Date: Mon, 27 Nov 2023 12:44:58 +0100 Subject: [PATCH] CI: change how to install and run poetry (#25) * docs: updated README.md and CONTRIBUTING.md * ci: removed poetry installation in noxfile.py now the CI install poetry via pipx * ci: limited poetry version (<1.8.0) --- .github/workflows/ci.yml | 6 ++++-- .github/workflows/publish.yml | 6 ++++-- CONTRIBUTING.md | 4 ++-- README.md | 1 + noxfile.py | 7 +------ 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2fd07ab..605cb12 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,8 +29,10 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python }} - - name: Install python dependencies - run: python -m pip install -U pip nox + - name: Install python pre-requisites + run: python -m pip install -U pip nox pipx + - name: Install poetry + run: pipx install "poetry<1.8.0" - name: Lint run: nox -s lint if: matrix.os == 'ubuntu-latest' && matrix.python == '3.12' diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 4cfc9f8..181f9bd 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -16,8 +16,10 @@ jobs: uses: actions/setup-python@v4 with: python-version: 3.8 - - name: Install python dependencies - run: python -m pip install -U pip nox + - name: Install python pre-requisites + run: python -m pip install -U pip nox pipx + - name: Install poetry + run: pipx install "poetry<1.8.0" - name: Build and deploy run: nox -s deploy env: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 93f1d9a..535646d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -35,9 +35,9 @@ If you want to propose a new feature: ## Code style Here are some preferences I have when coding: -- Use single quotes wherever possible. Unfortunately `black` does not allow to enforce this rule. + - When writing a test function, the name should be as obvious as possible about what we want to test. I prefer the - formulation "test_should....when..". I'm not saying it is the best option all the time, but it + formulation `test_should....when..`. I'm not saying it is the best option all the time, but it often tends to be more readable. ## Code contribution diff --git a/README.md b/README.md index 2f327b8..1345cd7 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ [![Documentation Status](https://readthedocs.org/projects/pyws/badge/?version=latest)](https://pyws.readthedocs.io/en/latest/?badge=latest) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/lewoudar/ws) [![License Apache 2](https://img.shields.io/hexpm/l/plug.svg)](http://www.apache.org/licenses/LICENSE-2.0) +[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://github.com/lewoudar/certipie) A simple yet powerful websocket cli. diff --git a/noxfile.py b/noxfile.py index 8e048d1..585ae6b 100644 --- a/noxfile.py +++ b/noxfile.py @@ -13,7 +13,6 @@ def lint(session): """Performs pep8 and security checks.""" source_code = 'ws' - session.install('poetry>=1.0.0,<1.5.0') session.run('poetry', 'install', '--only', 'lint') session.run('ruff', 'check', source_code) session.run('bandit', '-r', source_code) @@ -22,7 +21,6 @@ def lint(session): @nox.session(python=PYTHON_VERSIONS[-1]) def safety(session): """Checks vulnerabilities of the installed packages.""" - session.install('poetry>=1.0.0,<1.5.0') session.run('poetry', 'install', '--only', 'security') session.run('safety', 'check') @@ -30,7 +28,6 @@ def safety(session): @nox.session(python=PYTHON_VERSIONS) def tests(session): """Runs the test suite.""" - session.install('poetry>=1.0.0,<1.5.0') session.run('poetry', 'install', '--with', 'test') session.run('pytest') @@ -38,12 +35,11 @@ def tests(session): @nox.session(python=PYTHON_VERSIONS[-1]) def docs(session): """Builds the documentation.""" - session.install('poetry>=1.0.0,<1.5.0') session.run('poetry', 'install', '--only', 'docs') session.run('mkdocs', 'build', '--clean') -@nox.session(python=PYTHON_VERSIONS[1]) +@nox.session(python=False) def deploy(session): """ Deploys on pypi. @@ -51,7 +47,6 @@ def deploy(session): if 'POETRY_PYPI_TOKEN_PYPI' not in os.environ: session.error('you must specify your pypi token api to deploy your package') - session.install('poetry>=1.0.0,<1.5.0') session.run('poetry', 'publish', '--build')