Skip to content

Commit

Permalink
Merge pull request #26 from nschloe/update
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
nschloe committed Jan 30, 2022
2 parents 32b2cbe + 75f3599 commit c886394
Show file tree
Hide file tree
Showing 14 changed files with 90 additions and 104 deletions.
20 changes: 7 additions & 13 deletions .github/workflows/ci.yml
Expand Up @@ -12,24 +12,18 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v2
with:
python-version: "3.x"
- uses: actions/checkout@v2
- name: Lint with flake8
run: |
pip install flake8
flake8 .
- name: Lint with black
run: |
pip install black
black --check .
- name: Check out repo
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
- name: Run pre-commit
uses: pre-commit/action@v2.0.3

build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
steps:
- uses: actions/setup-python@v2
with:
Expand Down
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
@@ -0,0 +1,16 @@
repos:
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 22.1.0
hooks:
- id: black
language_version: python3

- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
32 changes: 0 additions & 32 deletions Makefile

This file was deleted.

22 changes: 22 additions & 0 deletions justfile
@@ -0,0 +1,22 @@
version := `python3 -c "from src.ndim.__about__ import __version__; print(__version__)"`

default:
@echo "\"just publish\"?"

publish:
@if [ "$(git rev-parse --abbrev-ref HEAD)" != "main" ]; then exit 1; fi
gh release create "v{{version}}"
flit publish

clean:
@find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
@rm -rf src/*.egg-info/ build/ dist/ .tox/

format:
isort .
black .
blacken-docs README.md

lint:
black --check .
flake8 .
39 changes: 37 additions & 2 deletions pyproject.toml
@@ -1,3 +1,38 @@
[build-system]
requires = ["setuptools>=42", "wheel"]
build-backend = "setuptools.build_meta"
requires = ["flit_core >=3.2,<4"]
build-backend = "flit_core.buildapi"

[tool.isort]
profile = "black"

[project]
name = "ndim"
authors = [{name = "Nico Schlömer", email = "nico.schloemer@gmail.com"}]
description = "Multidimensional volumes and monomial integrals"
readme = "README.md"
license = {file = "LICENSE"}
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Scientific/Engineering",
"Topic :: Utilities",
]
dynamic = ["version"]
requires-python = ">=3.6"
dependencies = [
"sympy"
]

[project.urls]
Code = "https://github.com/nschloe/ndim"
Issues = "https://github.com/nschloe/ndim/issues"
Funding = "https://github.com/sponsors/nschloe"
40 changes: 0 additions & 40 deletions setup.cfg

This file was deleted.

11 changes: 1 addition & 10 deletions src/ndim/__about__.py
@@ -1,10 +1 @@
try:
# Python 3.8
from importlib import metadata
except ImportError:
import importlib_metadata as metadata

try:
__version__ = metadata.version("ndim")
except Exception:
__version__ = "unknown"
__version__ = "0.1.6"
2 changes: 1 addition & 1 deletion src/ndim/nball.py
Expand Up @@ -17,7 +17,7 @@ def _recurrence(n):
return 1
elif n == 1:
return beta_one_half(lmbda + 1) * r ** (1 + 2 * lmbda)
return _recurrence(n - 2) * 2 * pi / (2 * lmbda + n) * r ** 2
return _recurrence(n - 2) * 2 * pi / (2 * lmbda + n) * r**2

return _recurrence(n)

Expand Down
2 changes: 1 addition & 1 deletion src/ndim/ncube.py
Expand Up @@ -4,7 +4,7 @@


def volume(n: int):
return 2 ** n
return 2**n


def integrate_monomial(exponents: List[int], symbolic: bool = False):
Expand Down
2 changes: 1 addition & 1 deletion src/ndim/nsphere.py
Expand Up @@ -12,7 +12,7 @@ def _recurrence(n):
return 2
elif n == 2:
return 2 * pi * r
return _recurrence(n - 2) * 2 * pi / (n - 2) * r ** 2
return _recurrence(n - 2) * 2 * pi / (n - 2) * r**2

return _recurrence(n)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_chebyshev1.py
Expand Up @@ -14,7 +14,7 @@ def closed(k):

def cases(k):
if k % 2 == 0:
return pi * factorial(k) / (2 ** k * factorial(k // 2) ** 2)
return pi * factorial(k) / (2**k * factorial(k // 2) ** 2)
return 0


Expand Down
2 changes: 1 addition & 1 deletion tests/test_chebyshev2.py
Expand Up @@ -18,7 +18,7 @@ def closed(k):

def cases(k):
if k % 2 == 0:
return pi * factorial(k) / (2 ** k * (k + 2) * factorial(k // 2) ** 2)
return pi * factorial(k) / (2**k * (k + 2) * factorial(k // 2) ** 2)
return 0


Expand Down
2 changes: 1 addition & 1 deletion tests/test_hermite_physicits.py
Expand Up @@ -14,7 +14,7 @@ def closed(k):

def cases(k):
if k % 2 == 0:
return sqrt(pi) * factorial(k) / (2 ** k * factorial(k // 2))
return sqrt(pi) * factorial(k) / (2**k * factorial(k // 2))
return 0


Expand Down
2 changes: 1 addition & 1 deletion tests/test_ncube.py
Expand Up @@ -8,7 +8,7 @@

@pytest.mark.parametrize("n", range(1, 10))
def test_volume(n):
ref = 2 ** n
ref = 2**n
tol = 1.0e-14
assert abs(ref - ndim.ncube.volume(n)) < abs(ref) * tol

Expand Down

0 comments on commit c886394

Please sign in to comment.