Skip to content

Instantly share code, notes, and snippets.

@stefanor
Last active April 19, 2025 23:40
Show Gist options
  • Select an option

  • Save stefanor/c6a59e920655c95406f9b221dfefb733 to your computer and use it in GitHub Desktop.

Select an option

Save stefanor/c6a59e920655c95406f9b221dfefb733 to your computer and use it in GitHub Desktop.

Revisions

  1. stefanor created this gist Apr 19, 2025.
    10 changes: 10 additions & 0 deletions Makefile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    check: build
    $(wildcard build/scripts-*/fibpy.py) 12

    build:
    python3 setup.py build

    clean:
    rm -rf build

    .PHONY: check clean
    14 changes: 14 additions & 0 deletions fibpy.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    #!/usr/bin/env python
    import sys


    def fib(n):
    if n < 0:
    raise ValueError()
    if n < 2:
    return 1
    return fib(n - 1) + fib(n - 2)


    if __name__ == '__main__':
    print(fib(int(sys.argv[1])))
    3 changes: 3 additions & 0 deletions pyproject.toml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    [build-system]
    requires = ["setuptools >= 70.1.0"]
    build-backend = 'setuptools.build_meta'
    10 changes: 10 additions & 0 deletions setup.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    #!/usr/bin/python3

    from setuptools import setup

    setup(
    name='fibpy',
    version='42.0.0',
    description='Pure Python Fibonacci',
    scripts=['fibpy.py'],
    )