From 302f8865c62d60ad2e94838b1c9af3e21c16790c Mon Sep 17 00:00:00 2001 From: Matthew Henderson Date: Mon, 4 Nov 2024 09:53:27 +0000 Subject: [PATCH 1/2] Create python-package.yml --- .github/workflows/python-package.yml | 44 ++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/python-package.yml diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 0000000..b452818 --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,44 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Python package + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.10", "3.11"] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install poetry + poetry install --with test + - name: Test with pytest + run: poetry run pytest From b4e26ce30fb4c038ff62dce9eb01591f0a69b0e4 Mon Sep 17 00:00:00 2001 From: Matthew Henderson Date: Mon, 4 Nov 2024 09:58:56 +0000 Subject: [PATCH 2/2] Move pytest to test dependency group. --- poetry.lock | 16 ++++++++-------- pyproject.toml | 4 +++- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/poetry.lock b/poetry.lock index 9ee7c90..50196f9 100644 --- a/poetry.lock +++ b/poetry.lock @@ -609,13 +609,13 @@ diagrams = ["jinja2", "railroad-diagrams"] [[package]] name = "pytest" -version = "7.4.4" +version = "8.3.3" description = "pytest: simple powerful testing with Python" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "pytest-7.4.4-py3-none-any.whl", hash = "sha256:b090cdf5ed60bf4c45261be03239c2c1c22df034fbffe691abe93cd80cea01d8"}, - {file = "pytest-7.4.4.tar.gz", hash = "sha256:2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280"}, + {file = "pytest-8.3.3-py3-none-any.whl", hash = "sha256:a6853c7375b2663155079443d2e45de913a911a11d669df02a50814944db57b2"}, + {file = "pytest-8.3.3.tar.gz", hash = "sha256:70b98107bd648308a7952b06e6ca9a50bc660be218d53c257cc1fc94fda10181"}, ] [package.dependencies] @@ -623,11 +623,11 @@ colorama = {version = "*", markers = "sys_platform == \"win32\""} exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} iniconfig = "*" packaging = "*" -pluggy = ">=0.12,<2.0" -tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} +pluggy = ">=1.5,<2" +tomli = {version = ">=1", markers = "python_version < \"3.11\""} [package.extras] -testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] +dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] [[package]] name = "python-dateutil" @@ -668,4 +668,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "bb25c04b30f6506c1379050531ca49f3d022cfc382fb337a86b1b6834168edf1" +content-hash = "34ce8985efa16adebf7598fcc4ffe48ce94cd5ce248334edcb2855ed8a231e00" diff --git a/pyproject.toml b/pyproject.toml index b246866..ff30565 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,9 +10,11 @@ readme = "README.md" python = "^3.10" networkx = "^3.1" matplotlib = "^3.7.2" -pytest = "^7.4.0" +[tool.poetry.group.test.dependencies] +pytest = "^8.3.3" + [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api"