Initial commit

This commit is contained in:
Julien Palard 2023-11-23 17:19:43 +01:00
commit 168423dcf6
Signed by: mdk
GPG Key ID: 0EFC1AC1006886F8
5 changed files with 66 additions and 0 deletions

0
README.md Normal file
View File

33
pyproject.toml Normal file
View File

@ -0,0 +1,33 @@
[build-system]
requires = ["setuptools >= 61", "wheel"]
build-backend = "setuptools.build_meta" # hatch, pbm, poetry, flit, ...
[project]
name = "sequences"
description = "Implementation of fib."
readme = "README.md"
license = {text = "MIT License"}
authors = [
{name = "Julien Palard", email = "julien@palard.fr"},
]
requires-python = ">= 3.7"
dependencies = [
"matplotlib >= 3.1, <4",
"sympy >= 1.2, <2",
]
dynamic = ["version"]
[project.urls]
homepage = "https://github.com/JulienPalard/sequences"
[project.scripts]
fib = "sequences.sequences:main"
[tool.setuptools]
include-package-data = false
[tool.setuptools.packages]
find = {}
[tool.setuptools.dynamic.version]
attr = "sequences.__version__"

7
sequences/__init__.py Normal file
View File

@ -0,0 +1,7 @@
"""La doc"""
__version__ = "0.1b1"
from sequences.sequences import fib
__all__ = ["fib"]

3
sequences/__main__.py Normal file
View File

@ -0,0 +1,3 @@
from sequences.sequences import main
main()

23
sequences/sequences.py Normal file
View File

@ -0,0 +1,23 @@
# from functools import lru_cache
lru_cache = __import__("functools").lru_cache
@lru_cache(1024)
def fib(n: int) -> int:
"""La doc de fib"""
if n < 2:
return 1
return fib(n-1) + fib(n-2)
def main():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("n", type=int)
args = parser.parse_args()
print(fib(args.n))
if __name__ == "__main__":
main()