Hello tox.
This commit is contained in:
parent
168423dcf6
commit
69862f69af
|
@ -11,10 +11,7 @@ authors = [
|
||||||
{name = "Julien Palard", email = "julien@palard.fr"},
|
{name = "Julien Palard", email = "julien@palard.fr"},
|
||||||
]
|
]
|
||||||
requires-python = ">= 3.7"
|
requires-python = ">= 3.7"
|
||||||
dependencies = [
|
dependencies = []
|
||||||
"matplotlib >= 3.1, <4",
|
|
||||||
"sympy >= 1.2, <2",
|
|
||||||
]
|
|
||||||
dynamic = ["version"]
|
dynamic = ["version"]
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
|
@ -31,3 +28,5 @@ find = {}
|
||||||
|
|
||||||
[tool.setuptools.dynamic.version]
|
[tool.setuptools.dynamic.version]
|
||||||
attr = "sequences.__version__"
|
attr = "sequences.__version__"
|
||||||
|
|
||||||
|
[tool.black]
|
|
@ -1,4 +1,4 @@
|
||||||
"""La doc"""
|
"""Sequences implementations."""
|
||||||
|
|
||||||
__version__ = "0.1b1"
|
__version__ = "0.1b1"
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"""Package entry point."""
|
||||||
|
|
||||||
from sequences.sequences import main
|
from sequences.sequences import main
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,16 +1,19 @@
|
||||||
|
"""Implementation of a few (one actually) integer sequences."""
|
||||||
|
|
||||||
# from functools import lru_cache
|
# from functools import lru_cache
|
||||||
lru_cache = __import__("functools").lru_cache
|
lru_cache = __import__("functools").lru_cache
|
||||||
|
|
||||||
|
|
||||||
@lru_cache(1024)
|
@lru_cache(1024)
|
||||||
def fib(n: int) -> int:
|
def fib(n: int) -> int:
|
||||||
"""La doc de fib"""
|
"""Compute the fib sequence value for n."""
|
||||||
if n < 2:
|
if n < 2:
|
||||||
return 1
|
return 1
|
||||||
return fib(n - 1) + fib(n - 2)
|
return fib(n - 1) + fib(n - 2)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
"""Run the fib function from command line."""
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
|
10
tests/test_fib.py
Normal file
10
tests/test_fib.py
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
from sequences import fib
|
||||||
|
|
||||||
|
|
||||||
|
def test_fib_head():
|
||||||
|
assert fib(0) == fib(1) == 1
|
||||||
|
|
||||||
|
|
||||||
|
def test_fib_next():
|
||||||
|
assert fib(2) > 1
|
||||||
|
assert fib(3) > 1
|
53
tox.ini
Normal file
53
tox.ini
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
[flake8]
|
||||||
|
max-line-length = 88
|
||||||
|
|
||||||
|
[tox]
|
||||||
|
envlist = py3{7,8,9,10,11,12,13}, flake8, mypy, black, pylint, pydocstyle, isort, ruff, bandit
|
||||||
|
isolated_build = True
|
||||||
|
skip_missing_interpreters = True
|
||||||
|
|
||||||
|
[testenv]
|
||||||
|
deps =
|
||||||
|
pytest
|
||||||
|
commands = pytest
|
||||||
|
|
||||||
|
[testenv:flake8]
|
||||||
|
deps =
|
||||||
|
flake8
|
||||||
|
flake8-bugbear
|
||||||
|
skip_install = True
|
||||||
|
commands = flake8 --max-complexity=8 tests/ sequences
|
||||||
|
|
||||||
|
[testenv:black]
|
||||||
|
deps = black
|
||||||
|
skip_install = True
|
||||||
|
commands = black --check --diff tests/ sequences
|
||||||
|
|
||||||
|
[testenv:mypy]
|
||||||
|
deps = mypy
|
||||||
|
skip_install = True
|
||||||
|
commands = mypy --ignore-missing-imports sequences
|
||||||
|
|
||||||
|
[testenv:pylint]
|
||||||
|
deps = pylint
|
||||||
|
commands = pylint --disable import-outside-toplevel sequences
|
||||||
|
|
||||||
|
[testenv:pydocstyle]
|
||||||
|
deps = pydocstyle
|
||||||
|
skip_install = True
|
||||||
|
commands = pydocstyle sequences
|
||||||
|
|
||||||
|
[testenv:isort]
|
||||||
|
deps = isort
|
||||||
|
skip_install = True
|
||||||
|
commands = isort --profile=black --check sequences
|
||||||
|
|
||||||
|
[testenv:ruff]
|
||||||
|
deps = ruff
|
||||||
|
skip_install = True
|
||||||
|
commands = ruff check sequences
|
||||||
|
|
||||||
|
[testenv:bandit]
|
||||||
|
deps = bandit
|
||||||
|
skip_install = True
|
||||||
|
commands = bandit sequences
|
Loading…
Reference in New Issue
Block a user