Skip to content

Commit

Permalink
Update typehints, polish project.
Browse files Browse the repository at this point in the history
  • Loading branch information
riga committed Mar 11, 2024
1 parent e3bca7c commit 1fa45b1
Show file tree
Hide file tree
Showing 16 changed files with 650 additions and 429 deletions.
71 changes: 41 additions & 30 deletions .github/workflows/lint_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
push:

jobs:
lint:
linting:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
Expand All @@ -19,63 +19,73 @@ jobs:
pip install .[dev]
- name: Lint 🔍
run: flake8 scinum tests
run: ./tests/linting.sh

pypi:
typecheck:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ["38", "39", "310", "311", "312"]
name: typecheck (python ${{ matrix.python }})
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup python 🐍
uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Install dependencies ☕️
run: |
pip install -U pip setuptools
pip install -U twine build
- name: Check bundling 📦
run: python -m build
pip install .[dev]
- name: Check setup 🚦
run: twine check "dist/scinum-*.tar.gz"
- name: Typecheck 📋
run: ./tests/typecheck.sh

test:
unittest:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
name: test (python ${{ matrix.python-version }})
python: ["37", "38", "39", "310", "311", "312"]
name: unittest (python ${{ matrix.python }})
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup Python ${{ matrix.python-version }} 🐍
- name: Install dependencies ☕️
run: |
pip install -U pip setuptools
pip install .[dev]
- name: Test 🎢
run: ./tests/unittest.sh

pypi:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup python 🐍
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
python-version: 3.9

- name: Install dependencies ☕️
run: |
pip install -U pip setuptools
pip install .[dev]
pip install -U twine build
- name: Test 🎢
run: python -m unittest tests
- name: Check bundling 📦
run: python -m build

- name: Check setup 🚦
run: twine check "dist/scinum-*.tar.gz"

coverage:
runs-on: ubuntu-latest
Expand All @@ -96,11 +106,12 @@ jobs:
pip install .[dev]
- name: Run coverage test 🎢
run: pytest --cov=scinum --cov-report xml:coverage.xml tests
run: ./tests/coverage.sh

- name: Upload report 🔝
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: unittests
fail_ci_if_error: false
4 changes: 2 additions & 2 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ jobs:
run: python -m build

- name: Publish package 🐍
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@v1.8.14
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
skip_existing: true
skip-existing: true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ docs/_build
.ipynb_checkpoints
.coverage
coverage*.xml
.vscode
.python-version
7 changes: 1 addition & 6 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,4 @@
-r ../requirements_dev.txt

# documentation packages
sphinx~=6.2.1
sphinx-autodoc-typehints~=1.22,<1.23
sphinx-book-theme~=1.0.1
sphinx-lfs-content~=1.1.3
autodocsumm~=0.2.11
myst-parser~=2.0.0
-r ../requirements_docs.txt
10 changes: 8 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Development Status :: 4 - Beta",
"Development Status :: 5 - Production/Stable",
"Operating System :: OS Independent",
"License :: OSI Approved :: BSD License",
"Intended Audience :: Developers",
Expand All @@ -51,7 +51,7 @@ Repository = "https://github.com/riga/scinum.git"
version = {attr = "scinum.__init__.__version__"}
readme = {file = ["README.md"], content-type = "text/markdown"}
dependencies = {file = ["requirements.txt"]}
optional-dependencies = {dev = {file = ["requirements_dev.txt"]}}
optional-dependencies = {dev = {file = ["requirements_dev.txt"]}, docs = {file = ["requirements_docs.txt"]}}


[tool.setuptools]
Expand All @@ -63,3 +63,9 @@ include-package-data = false

include = ["scinum"]
exclude = ["tests/*"]


[tool.mypy]

disable_error_code = ["no-redef", "valid-type"]
exclude = ["tests", "build", "docs"]
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
typing_extensions~=4.7.0;python_version<"3.8"
15 changes: 11 additions & 4 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ PyYAML
numpy
uncertainties

flake8>=4.0
flake8-commas>=2.1
flake8-quotes>=3.3
pytest-cov>=3.0
mypy~=1.8.0;python_version>="3.8"
flake8~=7.0.0;python_version>="3.8"
flake8~=5.0.0;python_version<"3.8"
flake8-commas~=2.1.0
flake8-quotes~=3.3.2
pytest~=7.4.4
pytest-cov~=4.1.0
ipykernel~=6.29.0;python_version>="3.8"
ipykernel~=6.16.0;python_version<"3.8"
types-docutils~=0.20.0;python_version>="3.8"
types-docutils~=0.20.0;python_version<"3.8"
6 changes: 6 additions & 0 deletions requirements_docs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
sphinx~=6.2.1
sphinx-autodoc-typehints~=1.22,<1.23
sphinx-book-theme~=1.0.1
sphinx-lfs-content~=1.1.3
autodocsumm~=0.2.11
myst-parser~=2.0.0
Loading

0 comments on commit 1fa45b1

Please sign in to comment.