Skip to content

Commit

Permalink
Drop support for python 2 and 3.6, version 2.0.0 (#17).
Browse files Browse the repository at this point in the history
* Start drop of py 27 and 36 support.

* Add type hints.
  • Loading branch information
riga authored Oct 11, 2023
1 parent 011443e commit fc4f189
Show file tree
Hide file tree
Showing 15 changed files with 824 additions and 552 deletions.
57 changes: 15 additions & 42 deletions .github/workflows/lint_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Install dependencies ☕️
run: |
pip install -U pip
pip install -r requirements_test.txt
pip install -U pip setuptools
pip install .[dev]
- name: Lint 🔍
run: flake8 scinum.py tests setup.py
run: flake8 scinum tests

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

Expand All @@ -36,14 +36,14 @@ jobs:

- name: Install dependencies ☕️
run: |
pip install -U pip
pip install twine
pip install -U pip setuptools
pip install -U twine build
- name: Check bundling 📦
run: python setup.py sdist
run: python -m build

- name: Check setup 🚦
run: twine check "dist/$( python setup.py --fullname ).tar.gz"
run: twine check "dist/scinum-*.tar.gz"

test:
runs-on: ubuntu-latest
Expand All @@ -59,7 +59,7 @@ jobs:
name: test (python ${{ matrix.python-version }})
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false

Expand All @@ -70,35 +70,8 @@ jobs:

- name: Install dependencies ☕️
run: |
pip install -U pip
pip install -r requirements_test.txt
- name: Test 🎢
run: python -m unittest tests

test_legacy:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python-version:
- "3.6"
name: test (python ${{ matrix.python-version }})
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
with:
persist-credentials: false

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

- name: Install dependencies ☕️
run: |
pip install -U pip
pip install -r requirements_test.txt
pip install -U pip setuptools
pip install .[dev]
- name: Test 🎢
run: python -m unittest tests
Expand All @@ -107,7 +80,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false

Expand All @@ -118,8 +91,8 @@ jobs:

- name: Install dependencies ☕️
run: |
pip install -U pip
pip install -r requirements_test.txt
pip install -U pip setuptools
pip install .[dev]
- name: Run coverage test 🎢
run: pytest --cov=scinum --cov-report xml:coverage.xml tests
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎
uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false

Expand All @@ -17,8 +17,13 @@ jobs:
with:
python-version: 3.9

- name: Install dependencies ☕️
run: |
pip install -U pip setuptools
pip install -U twine build
- name: Bundle 📦
run: python setup.py sdist
run: python -m build

- name: Publish package 🐍
uses: pypa/gh-action-pypi-publish@master
Expand Down
17 changes: 17 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.11"

submodules:
include: all
recursive: true

sphinx:
configuration: docs/conf.py

python:
install:
- requirements: docs/requirements.txt
5 changes: 3 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
include scinum.py setup.py requirements.txt requirements_docs.txt README.md LICENSE .flake8
global-exclude *.py[cod] __pycache__ .github
graft scinum
include requirements.txt requirements_dev.txt README.md LICENSE .flake8
global-exclude *.py[cod] __pycache__ .github tests/*
69 changes: 53 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,55 @@
![scinum logo](https://media.githubusercontent.com/media/riga/scinum/master/assets/logo250.png "scinum logo")

[![Lint and test](https://github.com/riga/scinum/actions/workflows/lint_and_test.yml/badge.svg)](https://github.com/riga/scinum/actions/workflows/lint_and_test.yml)
[![Documentation Status](https://readthedocs.org/projects/scinum/badge/?version=latest)](http://scinum.readthedocs.org/en/latest/?badge=latest)
[![Cover coverage](https://codecov.io/gh/riga/scinum/branch/master/graph/badge.svg?token=bvykpaUaHQ)](https://codecov.io/gh/riga/scinum)
[![Package Status](https://img.shields.io/pypi/v/scinum.svg?style=flat)](https://pypi.python.org/pypi/scinum)
[![License](https://img.shields.io/github/license/riga/scinum.svg)](https://github.com/riga/scinum/blob/master/LICENSE)
[![PyPI downloads](https://img.shields.io/pypi/dm/scinum.svg)](https://pypi.python.org/pypi/scinum)
<!-- marker-before-logo -->

<p align="center">
<a href="https://github.com/riga/scinum">
<img alt="scinum logo" src="https://media.githubusercontent.com/media/riga/scinum/master/assets/logo250.png" />
</a>
</p>

<!-- marker-after-logo -->

<!-- marker-before-badges -->

<p align="center">
<a href="https://github.com/riga/scinum/actions/workflows/lint_and_test.yml">
<img alt="Lint and test" src="https://github.com/riga/scinum/actions/workflows/lint_and_test.yml/badge.svg" />
</a>
<a href="http://scinum.readthedocs.org/en/latest/?badge=latest">
<img alt="Documentation Status" src="https://readthedocs.org/projects/scinum/badge/?version=latest" />
</a>
<a href="https://codecov.io/gh/riga/scinum">
<img alt="Cover coverage" src="https://codecov.io/gh/riga/scinum/branch/master/graph/badge.svg?token=bvykpaUaHQ" />
</a>
<img alt="Python version" src="https://img.shields.io/badge/Python-%E2%89%A53.7-blue" />
<a href="https://pypi.python.org/pypi/scinum">
<img alt="Package Status" src="https://img.shields.io/pypi/v/scinum.svg?style=flat" />
</a>
<a href="https://pypi.python.org/pypi/scinum">
<img alt="PyPI downloads" src="https://img.shields.io/pypi/dm/scinum.svg" />
</a>
<a href="https://github.com/riga/scinum/blob/master/LICENSE">
<img alt="License" src="https://img.shields.io/github/license/riga/scinum.svg" />
</a>
<a href="https://colab.research.google.com/github/riga/scinum/blob/master/example.ipynb">
<img alt="Example notebook on Colab" src="https://colab.research.google.com/assets/colab-badge.svg" />
</a>
<a href="https://mybinder.org/v2/gh/riga/scinum/master?filepath=example.ipynb">
<img alt="Example notebook on Binder" src="https://mybinder.org/badge_logo.svg" />
</a>
</p>

<!-- marker-after-badges -->

<!-- marker-before-header -->

scinum provides a simple `Number` class that wraps plain floats or [NumPy](http://www.numpy.org/) arrays and adds support for multiple uncertainties, automatic (gaussian) error propagation, and scientific rounding.

**Note**: Support for Python versions 2.7 and 3.6 has been dropped starting from v2.0.0.
Checkout the [legacy/v1.4 branch](https://github.com/riga/scinum/tree/legacy/v1.4) for legacy support.

<!-- marker-after-header -->

<!-- marker-before-body -->

### Usage

Expand Down Expand Up @@ -242,7 +283,7 @@ Numpy is an optional dependency.

### Contributing

If you like to contribute, I'm happy to receive pull requests.
If you like to contribute, pull requests are happily accepted.
Just make sure to add a new test cases and run them via:

```bash
Expand All @@ -252,13 +293,7 @@ Just make sure to add a new test cases and run them via:

##### Testing

In general, tests should be run for different environments:

- Python 2.7
- Python 3.X (X ≥ 5)


##### Docker
In general, tests should be run for all python versions ≥ 3.7.

To run tests in a docker container, do:

Expand All @@ -274,3 +309,5 @@ docker run --rm -v `pwd`:/scinum -w /scinum python:3.8 python -m unittest tests

- Source hosted at [GitHub](https://github.com/riga/scinum)
- Report issues, questions, feature requests on [GitHub Issues](https://github.com/riga/scinum/issues)

<!-- marker-after-body -->
1 change: 0 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
html_favicon = "../assets/favicon.ico"
html_theme = "sphinx_book_theme"
html_theme_options = {
"logo_only": True,
"show_navbar_depth": 2,
"repository_url": "https://github.com/riga/scinum",
"use_repository_button": True,
Expand Down
13 changes: 13 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# main packages
-r ../requirements.txt

# dev packages
-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
Loading

0 comments on commit fc4f189

Please sign in to comment.