From 4f7762c1bb7ce719c72c466cebdb00d5def8ea5e Mon Sep 17 00:00:00 2001 From: HsiangNianian Date: Thu, 6 Nov 2025 11:26:52 +0800 Subject: refactor: refactor project structure and update configurations for MVP implementation --- .github/workflows/CI.yml | 4 ++-- Cargo.lock | 2 +- Cargo.toml | 6 ++---- README.md | 4 ++-- maturin_template/__init__.py | 0 maturin_template/__main__.py | 18 ------------------ mvp/__init__.py | 0 mvp/__main__.py | 18 ++++++++++++++++++ pyproject.toml | 13 ++++++++----- src/main.rs | 2 +- 10 files changed, 34 insertions(+), 33 deletions(-) delete mode 100644 maturin_template/__init__.py delete mode 100644 maturin_template/__main__.py create mode 100644 mvp/__init__.py create mode 100644 mvp/__main__.py diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 34d6b29..f165f9d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,4 +1,4 @@ -# This file is autogenerated by maturin v1.8.2 +# This file is autogenerated by maturin v1.9.6 # To update, run # # maturin generate-ci github @@ -155,7 +155,7 @@ jobs: steps: - uses: actions/download-artifact@v4 - name: Generate artifact attestation - uses: actions/attest-build-provenance@v1 + uses: actions/attest-build-provenance@v2 with: subject-path: 'wheels-*/*' - name: Publish to PyPI diff --git a/Cargo.lock b/Cargo.lock index 07b9981..26fbfe6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -111,7 +111,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] -name = "maturin_template" +name = "mvp" version = "0.1.0" dependencies = [ "clap", diff --git a/Cargo.toml b/Cargo.toml index 45ed7d6..af366c2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,13 +1,11 @@ [package] -name = "maturin_template" +name = "mvp" version = "0.1.0" edition = "2021" -# 生成 CLI 可执行文件 [[bin]] -name = "maturin_template" # CLI 名称与 Python 包名一致 +name = "mvp" path = "src/main.rs" [dependencies] -# 例如添加 clap 处理 CLI 参数 clap = { version = "4.0", features = ["derive"] } \ No newline at end of file diff --git a/README.md b/README.md index e1f971e..1d71f9f 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ -# maturin-template +# MVP -> maturin template for bin(and cli program). \ No newline at end of file +> MVP Implementation in Rust and Python by HydroRoll-Team \ No newline at end of file diff --git a/maturin_template/__init__.py b/maturin_template/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/maturin_template/__main__.py b/maturin_template/__main__.py deleted file mode 100644 index 02df57d..0000000 --- a/maturin_template/__main__.py +++ /dev/null @@ -1,18 +0,0 @@ -import subprocess -import sys - -def run_cli(*args): - result = subprocess.run( - ["maturin_template", *args], - capture_output=True, - text=True - ) - return result.stdout - -def main(): - args = sys.argv[1:] - print(run_cli(*args)) - return 0 - -if __name__ == "__main__": - sys.exit(main()) \ No newline at end of file diff --git a/mvp/__init__.py b/mvp/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/mvp/__main__.py b/mvp/__main__.py new file mode 100644 index 0000000..2402016 --- /dev/null +++ b/mvp/__main__.py @@ -0,0 +1,18 @@ +import subprocess +import sys + +def run_cli(*args): + result = subprocess.run( + ["mvp", *args], + capture_output=True, + text=True + ) + return result.stdout + +def main(): + args = sys.argv[1:] + print(run_cli(*args)) + return 0 + +if __name__ == "__main__": + sys.exit(main()) \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 7297f99..73ec6d0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,13 +3,13 @@ requires = ["maturin>=1.0,<2.0"] build-backend = "maturin" [project] -name = "maturin_template" +name = "mvp" dynamic = ["version"] -description = "A Rust CLI bundled as a Python package" +description = "MVP Implementation in Rust and Python by HydroRoll-Team" authors = [ - { name = "Your Name", email = "your.email@example.com" } + { name = "HsiangNianian", email = "leader@hydroroll.team" } ] -requires-python = ">=3.8" +requires-python = ">=3.11" readme = "README.md" license = { text = "MIT" } classifiers = [ @@ -18,7 +18,10 @@ classifiers = [ "Programming Language :: Python :: 3", ] +[project.scripts] +mvp = "mvp.__main__:main" + [tool.maturin] bindings = "bin" # manifest-path = "Cargo.toml" -module-name = "maturin_template" \ No newline at end of file +module-name = "mvp" \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index c3c3fd4..c3fd598 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,4 +10,4 @@ struct Args { fn main() { let args = Args::parse(); println!("Hello from CLI, {}!", args.name); -} \ No newline at end of file +} -- cgit v1.2.3-70-g09d2