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

CI: change how to install and run poetry #25

Merged
merged 3 commits into from
Nov 27, 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
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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..<expectation>..when..<condition>". I'm not saying it is the best option all the time, but it
formulation `test_should..<expectation>..when..<condition>`. I'm not saying it is the best option all the time, but it
often tends to be more readable.

## Code contribution
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
7 changes: 1 addition & 6 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -22,36 +21,32 @@ 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')


@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')


@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.
"""
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')


Expand Down
Loading