From 1e693aa1afff0a37dd94a62910c5d574f1f89fcf Mon Sep 17 00:00:00 2001 From: JosePizarro3 Date: Wed, 25 Sep 2024 14:18:24 +0200 Subject: [PATCH] Added python3.10 and python3.11 --- .github/workflows/actions.yml | 37 +++++++++++++-------------- .github/workflows/coveralls.yml | 44 +++++++++++++++++++++++++++++++++ .github/workflows/publish.yml | 22 ++++++++--------- README.md | 8 ++++-- pyproject.toml | 2 ++ 5 files changed, 80 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/coveralls.yml diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index f80ffed..8fe977a 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -9,46 +9,43 @@ permissions: checks: write pull-requests: write +env: + UV_SYSTEM_PYTHON: true + jobs: install-and-test: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python_version: ["3.9", "3.10", "3.11"] steps: - uses: actions/checkout@v4 - - name: Set up Python 3.9 + - name: Set up Python ${{matrix.python_version}} uses: actions/setup-python@v5 with: - python-version: 3.9 + python-version: ${{matrix.python_version}} + - name: Install uv + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh - name: Install dependencies run: | pip install --upgrade pip - pip install uv - uv pip install -e '.[dev]' --index-url https://gitlab.mpcdf.mpg.de/api/v4/projects/2187/packages/pypi/simple --system - uv pip install coveralls --system + uv pip install -e '.[dev]' - name: mypy run: | python -m mypy --ignore-missing-imports --follow-imports=silent --no-strict-optional src/nomad_parser_wannier90/schema_packages src/nomad_parser_wannier90/parsers tests - - name: Build coverage file - run: | - pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=src tests | tee pytest-coverage.txt - - name: Pytest coverage comment - uses: MishaKav/pytest-coverage-comment@main - with: - pytest-coverage-path: pytest-coverage.txt - junitxml-path: pytest.xml - - name: Submit to coveralls - continue-on-error: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Test with pytest run: | - coveralls --service=github + python -m pytest -sv tests build-and-install: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Set up Python 3.9 + - name: Set up Python 3.11 uses: actions/setup-python@v5 with: - python-version: 3.9 + python-version: 3.11 - name: Build the package run: | pip install uv diff --git a/.github/workflows/coveralls.yml b/.github/workflows/coveralls.yml new file mode 100644 index 0000000..3698481 --- /dev/null +++ b/.github/workflows/coveralls.yml @@ -0,0 +1,44 @@ +name: Testing with coveralls Report +on: [push] + +# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs +# `contents` is for permission to the contents of the repository. +# `pull-requests` is for permission to pull request +permissions: + contents: write + checks: write + pull-requests: write + +env: + UV_SYSTEM_PYTHON: true + +jobs: + coveralls-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: 3.11 + - name: Install uv + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh + - name: Install dependencies + run: | + uv pip install -e '.[dev]' + uv pip install coveralls + - name: Build coverage file + run: | + pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=src tests | tee pytest-coverage.txt + - name: Pytest coverage comment + uses: MishaKav/pytest-coverage-comment@main + with: + pytest-coverage-path: pytest-coverage.txt + junitxml-path: pytest.xml + - name: Submit to coveralls + continue-on-error: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + coveralls --service=github diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d4e4675..b4dca46 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -15,27 +15,27 @@ on: permissions: contents: read +env: + UV_SYSTEM_PYTHON: true + jobs: deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Set up Python 3.9 - uses: actions/setup-python@v3 + - uses: actions/checkout@v4 + - name: Set up Python 3.11 + uses: actions/setup-python@v5 with: - python-version: '3.9' - + python-version: 3.11 + - name: Install uv + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh - name: Install dependencies run: | pip install --upgrade pip - pip install build - + uv pip install build - name: Build package run: python -m build - - name: Publish package to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: diff --git a/README.md b/README.md index b870979..4f534b7 100644 --- a/README.md +++ b/README.md @@ -9,14 +9,18 @@ This is a plugin for [NOMAD](https://nomad-lab.eu) which contains the parser and ## Getting started -`nomad-parser-wannier90` can be installed as a PyPI package using `pip`. We require features from the `nomad-lab` package which are not publicly available in PyPI, so an extra flag `--index-url` needs to be specified when pip installing this package: +`nomad-parser-wannier90` can be installed as a PyPI package using `pip`: + +> [!WARNING] +> Unfortunately, the current plugin mechanism is not supported by the latest nomad-lab version on PyPI and therefore an index url pointing to the NOMAD Gitlab registry needs to be added. + ```sh pip install nomad-parser-wannier90 --index-url https://gitlab.mpcdf.mpg.de/api/v4/projects/2187/packages/pypi/simple ``` ## Development -If you want to develop locally this package, clone the project and in the workspace folder, create a virtual environment (note this project uses Python 3.9): +If you want to develop locally this package, clone the project and in the workspace folder, create a virtual environment (you can use Python 3.9, 3.10, or 3.11): ```sh git clone https://github.com/nomad-coe/nomad-parser-wannier90.git cd nomad-parser-wannier90 diff --git a/pyproject.toml b/pyproject.toml index 7d7a7eb..aae023d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,6 +8,8 @@ classifiers = [ "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "License :: OSI Approved :: Apache Software License", ] name = "nomad-parser-wannier90"