intial commit

This commit is contained in:
NATHAN Solal 2024-05-25 10:13:55 +02:00
commit 47915d7bcd
10 changed files with 157 additions and 0 deletions

13
.gitignore vendored Normal file
View file

@ -0,0 +1,13 @@
# python generated files
__pycache__/
*.py[oc]
build/
dist/
wheels/
*.egg-info
# venv
.venv
# ruff
.ruff_cache

1
.python-version Normal file
View file

@ -0,0 +1 @@
3.12.3

3
README.md Normal file
View file

@ -0,0 +1,3 @@
# test-pkg
Python packaging tests using Rye (and some typer CLI interface)

33
pyproject.toml Normal file
View file

@ -0,0 +1,33 @@
[project]
name = "test-pkg"
version = "0.1.0"
description = "Add your description here"
authors = [
{ name = "Otthorn", email = "otthorn@crans.org" }
]
dependencies = [
"typer>=0.12.3",
]
readme = "README.md"
requires-python = ">= 3.8"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.rye]
managed = true
dev-dependencies = []
[tool.hatch.metadata]
allow-direct-references = true
[tool.hatch.build.targets.wheel]
packages = ["src/test_pkg"]
[tool.ruff.lint]
select = ["I"]
[tool.rye.scripts]
test_pkg = { call = "test_pkg.utils:app" }
cli = { call = "test_pkg.cli:app" }

27
requirements-dev.lock Normal file
View file

@ -0,0 +1,27 @@
# generated by rye
# use `rye lock` or `rye sync` to update this lockfile
#
# last locked with the following flags:
# pre: false
# features: []
# all-features: false
# with-sources: false
# generate-hashes: false
-e file:.
click==8.1.7
# via typer
markdown-it-py==3.0.0
# via rich
mdurl==0.1.2
# via markdown-it-py
pygments==2.18.0
# via rich
rich==13.7.1
# via typer
shellingham==1.5.4
# via typer
typer==0.12.3
# via test-pkg
typing-extensions==4.12.0
# via typer

27
requirements.lock Normal file
View file

@ -0,0 +1,27 @@
# generated by rye
# use `rye lock` or `rye sync` to update this lockfile
#
# last locked with the following flags:
# pre: false
# features: []
# all-features: false
# with-sources: false
# generate-hashes: false
-e file:.
click==8.1.7
# via typer
markdown-it-py==3.0.0
# via rich
mdurl==0.1.2
# via markdown-it-py
pygments==2.18.0
# via rich
rich==13.7.1
# via typer
shellingham==1.5.4
# via typer
typer==0.12.3
# via test-pkg
typing-extensions==4.12.0
# via typer

4
src/test_pkg/__init__.py Normal file
View file

@ -0,0 +1,4 @@
import test_pkg.core as core
import test_pkg.utils as utils
__all__ = ["core", "utils"]

18
src/test_pkg/cli.py Normal file
View file

@ -0,0 +1,18 @@
import typer
app = typer.Typer(no_args_is_help=True)
@app.callback()
def callback():
"""
Nice defintion
"""
@app.command()
def do():
print("something")
@app.command()
def dont():
print("nothing")

6
src/test_pkg/core.py Normal file
View file

@ -0,0 +1,6 @@
from test_pkg.utils import do_something
def main():
do_something()
do_something()

25
src/test_pkg/utils.py Normal file
View file

@ -0,0 +1,25 @@
import time
import typer
from rich.progress import track
app = typer.Typer()
@app.command()
def do_something():
print("something")
@app.command()
def do(arg1: str = "b", arg2: str = "a"):
print(f"arg1 = {arg1}, arg2 = {arg2}")
@app.command()
def prog_test():
total = 0
for value in track(range(100), description="Processing..."):
# Fake processing time
time.sleep(0.01)
total += 1
print(f"Processed {total} things.")