Skip to content

Commit

Permalink
Migrate from setuptools and setup.py to poetry and pyproject.toml
Browse files Browse the repository at this point in the history
closes aiiie#29
  • Loading branch information
Nicoretti committed Feb 6, 2022
1 parent 081602b commit 4e850fd
Show file tree
Hide file tree
Showing 8 changed files with 1,301 additions and 98 deletions.
21 changes: 11 additions & 10 deletions .github/workflows/gh-pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,25 @@ jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.3.1

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Checkout
uses: actions/checkout@v2.3.1

- name: Install dependencies
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
poetry install
- name: Build
- name: Build Documenations
run: |
cd docs
make html
touch ./_build/html/.nojekyll
poetry run python -m nox -s docs
touch docs/_build/html/.nojekyll
- name: Deploy
uses: JamesIves/github-pages-deploy-action@4.1.7
Expand Down
18 changes: 11 additions & 7 deletions .github/workflows/verifier.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Verfier

on: [push, pull_request]
on: [ push, pull_request ]

jobs:
build:
Expand All @@ -18,20 +18,24 @@ jobs:
- "3.10"

steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v2

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
- name: Install Dependencies
run: |
sudo apt-get install -y bash
sudo apt-get install -u zsh
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Full verification
poetry install
- name: Verifier
run: |
nox
poetry run python -m nox
- name: Coveralls
uses: coverallsapp/github-action@master
with:
Expand Down
5 changes: 0 additions & 5 deletions MANIFEST.in

This file was deleted.

40 changes: 26 additions & 14 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import tempfile
from pathlib import Path

import nox
Expand All @@ -7,22 +8,33 @@
nox.options.sessions = [
"isort",
"code_format",
"check_manifest",
"pylint",
"integration",
"coverage",
]


def _common_prepare(session):
def _prepare(session):
session.env["PYTHONPATH"] = f"{BASEPATH}"
session.install(f'-r{BASEPATH / "requirements.txt"}')
with tempfile.TemporaryDirectory() as tmp:
requirements = Path(tmp) / "requirements.txt"
session.run_always(
"poetry",
"export",
"--dev",
"--without-hashes",
"-o",
f"{requirements}",
silent=True,
external=True,
)
session.install(f"-r{requirements}")
session.install(f"{BASEPATH}")


@nox.session
def code_format(session):
_common_prepare(session)
_prepare(session)
session.run(
"python",
"-m",
Expand All @@ -36,27 +48,21 @@ def code_format(session):

@nox.session
def isort(session):
_common_prepare(session)
_prepare(session)
session.run("python", "-m", "isort", "-v", "--check", f"{BASEPATH}")


@nox.session
def check_manifest(session):
_common_prepare(session)
session.run("python", "-m", "check_manifest", f"{BASEPATH}")


@nox.session
def pylint(session):
_common_prepare(session)
_prepare(session)
session.run("python", "-m", "pylint", f'{BASEPATH / "prysk"}')
session.run("python", "-m", "pylint", f'{BASEPATH / "scripts"}')


@nox.session
@nox.parametrize("shell", ["dash", "bash", "zsh"])
def integration(session, shell):
_common_prepare(session)
session.install(f"{BASEPATH}")
session.env["TESTOPTS"] = f"--shell={shell}"
session.run(
"prysk", f"--shell={shell}", f'{BASEPATH / "test" / "integration" / "prysk"}'
Expand All @@ -65,7 +71,7 @@ def integration(session, shell):

@nox.session
def coverage(session):
_common_prepare(session)
_prepare(session)
session.env["COVERAGE"] = "coverage"
session.env["COVERAGE_FILE"] = f'{BASEPATH / ".coverage"}'
command = [
Expand All @@ -87,3 +93,9 @@ def coverage(session):
)
session.run("coverage", "report", "--fail-under=97")
session.run("coverage", "lcov")


@nox.session
def docs(session):
_prepare(session)
session.run("make", "-C", f'{BASEPATH / "docs"}', "html")
Loading

0 comments on commit 4e850fd

Please sign in to comment.