From 4b3754041cfc46ab9452274790081a5f43d3cdd4 Mon Sep 17 00:00:00 2001 From: lordlogo2002 Date: Sun, 12 Jul 2026 13:40:24 +0200 Subject: [PATCH] init --- .env.example | 4 ++++ .gitignore | 10 +++++++++ Makefile | 53 +++++++++++++++++++++++++++++++++++++++++++++ README.md | 5 +++++ pyproject.toml | 33 ++++++++++++++++++++++++++++ src/ned/__init__.py | 3 +++ tests/test_core.py | 5 +++++ 7 files changed, 113 insertions(+) create mode 100644 .env.example create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 README.md create mode 100644 pyproject.toml create mode 100644 src/ned/__init__.py create mode 100644 tests/test_core.py diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..c9736e6 --- /dev/null +++ b/.env.example @@ -0,0 +1,4 @@ +GITEA_URL=https://git.chipperfluff.at/Hyperpyemia/NotEnoughDecorators.git +GITEA_OWNER=Hyperpyemia +GITEA_USERNAME=your-username +GITEA_TOKEN=replace-with-a-gitea-access-token diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6b216c9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +.env +.venv/ +__pycache__/ +*.py[cod] +*.egg-info/ +.pytest_cache/ +.ruff_cache/ +build/ +dist/ + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5f67c11 --- /dev/null +++ b/Makefile @@ -0,0 +1,53 @@ +SHELL := /bin/bash +.DEFAULT_GOAL := help + +PYTHON ?= python3 +VENV ?= .venv +VENV_BIN := $(VENV)/bin + +.PHONY: help venv install test lint format build check-publish-config publish clean + +help: ## Show the available commands + @awk 'BEGIN {FS = ":.*## "; printf "Usage: make \n\n"} /^[a-zA-Z_-]+:.*?## / {printf " %-22s %s\n", $$1, $$2}' $(MAKEFILE_LIST) + +venv: ## Create a local virtual environment + $(PYTHON) -m venv $(VENV) + +install: venv ## Install the package and development tools + $(VENV_BIN)/python -m pip install --upgrade pip + $(VENV_BIN)/python -m pip install -e '.[dev]' + +test: ## Run the test suite + $(VENV_BIN)/pytest + +lint: ## Check formatting and lint the code + $(VENV_BIN)/ruff check . + $(VENV_BIN)/ruff format --check . + +format: ## Format the Python code + $(VENV_BIN)/ruff check --fix . + $(VENV_BIN)/ruff format . + +build: ## Build wheel and source distributions + rm -rf build dist + $(VENV_BIN)/python -m build + +check-publish-config: ## Validate the Gitea package registry settings + @set -a; source .env 2>/dev/null || { echo "Missing .env (copy .env.example to .env)"; exit 1; }; set +a; \ + for variable in GITEA_URL GITEA_OWNER GITEA_USERNAME GITEA_TOKEN; do \ + if [[ -z "$${!variable}" ]]; then echo "Missing $$variable in .env"; exit 1; fi; \ + done + +publish: check-publish-config build ## Upload the package to the Gitea PyPI registry + @set -a; source .env; set +a; \ + TWINE_USERNAME="$$GITEA_USERNAME" \ + TWINE_PASSWORD="$$GITEA_TOKEN" \ + $(VENV_BIN)/python -m twine upload \ + --repository-url "$${GITEA_URL%/}/api/packages/$$GITEA_OWNER/pypi" \ + dist/* + +clean: ## Remove generated files + rm -rf .pytest_cache .ruff_cache build dist *.egg-info src/*.egg-info + find . -type d -name __pycache__ -prune -exec rm -rf {} + + find . -type f -name '*.py[co]' -delete + diff --git a/README.md b/README.md new file mode 100644 index 0000000..2b793c9 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# NED + +meow + +Used bootstrap v1.0.0 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..c4100a2 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,33 @@ +[build-system] +requires = ["hatchling>=1.25"] +build-backend = "hatchling.build" + +[project] +name = "NED" +version = "0.0.1" +description = "meow" +readme = "README.md" +requires-python = ">=3.10" +license = { text = "MIT" } +authors = [ + { name = "Chipperfluff", email = "contact@chipi.at" }, +] +dependencies = [] + +[project.optional-dependencies] +dev = [ + "build>=1.2", + "pytest>=8.0", + "ruff>=0.5", + "twine>=5.1", +] + +[tool.hatch.build.targets.wheel] +packages = ["src/ned"] + +[tool.pytest.ini_options] +testpaths = ["tests"] + +[tool.ruff] +line-length = 100 +target-version = "py310" diff --git a/src/ned/__init__.py b/src/ned/__init__.py new file mode 100644 index 0000000..c467bba --- /dev/null +++ b/src/ned/__init__.py @@ -0,0 +1,3 @@ +def hello(name: str = "world") -> str: + """Return a friendly greeting.""" + return f"Hello, {name}!" diff --git a/tests/test_core.py b/tests/test_core.py new file mode 100644 index 0000000..73b9c20 --- /dev/null +++ b/tests/test_core.py @@ -0,0 +1,5 @@ +from ned import hello + + +def test_hello() -> None: + assert hello("Gitea") == "Hello, Gitea!"