Skip to content
Closed
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
9 changes: 0 additions & 9 deletions .flake8

This file was deleted.

23 changes: 13 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
name: Publish Package on PYPI
name: Publish Package on PyPI

on:
release:
types: [published]


jobs:
deploy:

runs-on: ubuntu-latest

steps:
Expand All @@ -16,14 +14,19 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
poetry install
- name: Build package
run: python setup.py sdist bdist_wheel
run: |
poetry build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
env:
PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish
36 changes: 17 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ name: Unit tests
on:
push:
branches:
-dev
-main
- "**"
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:

jobs:
build-linux:
check:
if: github.event.pull_request.draft == false
runs-on: ${{matrix.os}}
strategy:
Expand All @@ -22,24 +21,23 @@ jobs:
shell: bash -l {0}

steps:
- name: Git clone
- name: Checkout
uses: actions/checkout@v3
- name: Set up venv for ci
uses: conda-incubator/setup-miniconda@v2
- name: Python
uses: actions/setup-python@v4
with:
python-version: ${{matrix.python-version}}
environment-file: environment.ci.yml
- name: Lint with flake8
run: |
flake8
- name: Test with pytest
run: |
make coverage
- name: typing with mypy
run: |
mypy qolmat
echo you should uncomment mypy qolmat and delete this line
- name: Upload coverage reports to Codecov
python-version: ${{ matrix.python-version }}
- name: Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.3
- name: Lock
run: poetry lock --no-update
- name: Install
run: poetry install
- name: Checkers
run: make checkers
- name: Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
68 changes: 0 additions & 68 deletions .github/workflows/test_quick.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
*.ipynb
poetry.lock
# Byte-compiled / optimized / DLL files
data/
__pycache__/
*.py[cod]
*$py.class
Expand Down
20 changes: 4 additions & 16 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,8 @@ repos:
exclude: (docs/)
- id: trailing-whitespace
exclude: (docs/)
- repo: https://github.com/psf/black
rev: 22.8.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.3
hooks:
- id: black
args:
- "-l 99"
# Flake8
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.1.1
hooks:
- id: mypy
args: [--ignore-missing-imports]
additional_dependencies: [types-requests]
- id: ruff
- id: ruff-format
17 changes: 7 additions & 10 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,11 @@ You can create a virtual environment via `conda`:

.. code:: sh

$ conda env create -f environment.dev.yml
$ conda activate env_qolmat_dev

If you need to use pytorch, enter the command:

.. code:: sh

$ pip install -e .[pytorch]
$ pip install poetry
$ poetry config virtualenvs.in-project true
$ poetry lock
$ poetry install
$ poetry shell

Once the environment is installed, pre-commit is installed, but need to be activated using the following command:

Expand Down Expand Up @@ -78,7 +75,7 @@ These tests absolutely have to pass.

.. code:: sh

$ mypy qolmat
$ make check-types

Unit test
^^^^^^^^^
Expand All @@ -88,4 +85,4 @@ The coverage should on new features must be above 95%.

.. code:: sh

$ pytest -vs --cov-branch --cov=qolmat --pyargs tests --cov-report term-missing
$ make check-coverage
33 changes: 27 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
coverage:
pytest --cov-branch --cov=qolmat --cov-report=xml tests

doctest:
pytest --doctest-modules --pyargs qolmat
check-coverage:
poetry run pytest --cov-branch --cov=qolmat/ --cov-report=xml tests/

doc:
make html -C docs
check-poetry:
poetry check --lock

check-quality:
poetry run ruff check qolmat/ tests/

check-security:
poetry run bandit --recursive --configfile=pyproject.toml qolmat/

check-tests:
poetry run pytest tests/

check-types:
poetry run mypy qolmat/ tests/

checkers: check-coverage check-types

clean:
rm -rf .mypy_cache .pytest_cache .coverage*
rm -rf **__pycache__
make clean -C docs

coverage:
poetry run pytest --cov-branch --cov=qolmat --cov-report=xml tests

doc:
make html -C docs

doctest:
poetry run pytest --doctest-modules --pyargs qolmat
3 changes: 1 addition & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import os
import sys
import sphinx_gallery

import sphinx_rtd_theme

# If extensions (or modules to document with autodoc) are in another directory,
Expand Down Expand Up @@ -53,7 +53,6 @@
# see https://github.com/numpy/numpydoc/issues/69
numpydoc_show_class_members = False

from distutils.version import LooseVersion

# pngmath / imgmath compatibility layer for different sphinx versions
# import sphinx
Expand Down
18 changes: 0 additions & 18 deletions environment.ci.yml

This file was deleted.

37 changes: 0 additions & 37 deletions environment.dev.yml

This file was deleted.

14 changes: 0 additions & 14 deletions environment.doc.yml

This file was deleted.

Loading
Loading