From adcd280bbd9443bd34592aff1de298e5756f03a3 Mon Sep 17 00:00:00 2001 From: Wong Ding Feng Date: Sun, 31 May 2026 22:16:36 +0800 Subject: [PATCH] init: auto-reverse CLI with Python 3.14t, uv, and Nix flakes Set up project scaffolding with free-threaded Python 3.14, uv for package management, and Nix flakes for dev tooling (treefmt-nix with nixfmt/ruff, pyright strict mode, direnv integration). Co-Authored-By: Claude Opus 4.6 --- .envrc | 1 + .gitignore | 16 +++++++ .python-version | 1 + README.md | 0 flake.lock | 82 ++++++++++++++++++++++++++++++++++++ flake.nix | 52 +++++++++++++++++++++++ pyproject.toml | 30 +++++++++++++ src/auto_reverse/__init__.py | 2 + uv.lock | 8 ++++ 9 files changed, 192 insertions(+) create mode 100644 .envrc create mode 100644 .gitignore create mode 100644 .python-version create mode 100644 README.md create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 pyproject.toml create mode 100644 src/auto_reverse/__init__.py create mode 100644 uv.lock diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f534a38 --- /dev/null +++ b/.gitignore @@ -0,0 +1,16 @@ +# Python-generated files +__pycache__/ +*.py[oc] +build/ +dist/ +wheels/ +*.egg-info + +# Virtual environments +.venv + +# Nix +result + +# direnv +.direnv diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..fb59d01 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.14+freethreaded diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..b352160 --- /dev/null +++ b/flake.lock @@ -0,0 +1,82 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1778716662, + "narHash": "sha256-m1Yf0wZ8j1OHjTc2UwHwyQRSnNeSgLJOd7q5Y45hzi4=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f7c1a2d347e4c52d5fb8d10cb4d94b5884e546fb", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1780030872, + "narHash": "sha256-u6WU/yd/o8iYQrHX3RAwO1hYa3LkoSL+WNQD0rJfJZQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e9a7635a57597d9754eccebdfc7045e6c8600e6b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1777168982, + "narHash": "sha256-GOkGPcboWE9BmGCRMLX3worL4EMnsnG8MyKmXNeYuhQ=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "f5901329dade4a6ea039af1433fb087bd9c1fe14", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs", + "treefmt-nix": "treefmt-nix" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1780220602, + "narHash": "sha256-eynAfOmbmxJnkp7YewvCEbShNnnYJ9gLLqkzsYtBPeM=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "db947814a175b7ca6ded66e21383d938df01c227", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..29cb4f1 --- /dev/null +++ b/flake.nix @@ -0,0 +1,52 @@ +{ + description = "auto-reverse — automated reverse engineering CLI"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; + treefmt-nix = { + url = "github:numtide/treefmt-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = + inputs@{ flake-parts, ... }: + flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + + imports = [ + inputs.treefmt-nix.flakeModule + ]; + + perSystem = + { pkgs, ... }: + { + treefmt = { + projectRootFile = "flake.nix"; + programs = { + nixfmt.enable = true; + ruff-check.enable = true; + ruff-format.enable = true; + }; + }; + + devShells.default = pkgs.mkShell { + packages = with pkgs; [ + uv + ruff + pyright + ]; + + shellHook = '' + export UV_PYTHON_PREFERENCE=only-system + ''; + }; + }; + }; +} diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..8e2805d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,30 @@ +[project] +name = "auto-reverse" +version = "0.1.0" +description = "Automated reverse engineering CLI tool" +readme = "README.md" +authors = [ + { name = "Wong Ding Feng", email = "dingfengwong@gmail.com" } +] +requires-python = ">=3.14" +dependencies = [] + +[project.scripts] +auto-reverse = "auto_reverse:main" + +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[tool.ruff] +target-version = "py314" +line-length = 120 + +[tool.ruff.lint] +select = ["E", "F", "W", "I", "N", "UP", "B", "A", "SIM", "TCH", "RUF"] + +[tool.pyright] +pythonVersion = "3.14" +typeCheckingMode = "strict" +venvPath = "." +venv = ".venv" diff --git a/src/auto_reverse/__init__.py b/src/auto_reverse/__init__.py new file mode 100644 index 0000000..1cefbbf --- /dev/null +++ b/src/auto_reverse/__init__.py @@ -0,0 +1,2 @@ +def main() -> None: + print("Hello from auto-reverse!") diff --git a/uv.lock b/uv.lock new file mode 100644 index 0000000..dc000be --- /dev/null +++ b/uv.lock @@ -0,0 +1,8 @@ +version = 1 +revision = 3 +requires-python = ">=3.14" + +[[package]] +name = "auto-reverse" +version = "0.1.0" +source = { editable = "." }