From e2b07186041e8cfbc1a223a2aaa2eca4264e6df1 Mon Sep 17 00:00:00 2001 From: Manuel Jimenez Diaz <224836252+mjimenez-arch@users.noreply.github.com> Date: Fri, 10 Jul 2026 08:34:10 +0000 Subject: [PATCH] Add console entrypoint for zdplasmapy --- .devcontainer/devcontainer.json | 2 +- main.py | 23 ++++++++++++----------- pyproject.toml | 12 +++++++++--- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index a099d30..5338bb9 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -13,5 +13,5 @@ ] } }, - "postCreateCommand": "pip3 install -r requirements.txt && bash external/setup_loki_b.sh --non-interactive && echo 'Workspace ready. Run: make regtest'" + "postCreateCommand": "pip3 install -r requirements.txt && python3 -m pip install --user --upgrade 'setuptools>=64' 'wheel>=0.42' 'pip>=24' && python3 -m pip install --user -e . && echo 'export PATH=\"$HOME/.local/bin:$PATH\"' >> ~/.bashrc && source ~/.bashrc && bash external/setup_loki_b.sh --non-interactive && echo 'Workspace ready. Run: make regtest'" } \ No newline at end of file diff --git a/main.py b/main.py index 7211060..f2a2ed2 100644 --- a/main.py +++ b/main.py @@ -13,10 +13,20 @@ from pathlib import Path -def main(config_path): +def main(): """ Main entry point for running the global plasma model using a YAML config. """ + # Allow passing YAML file as command-line arg + config_path = sys.argv[1] if len(sys.argv) > 1 else "cases/ashida1995/config.yml" + + if not os.path.isfile(config_path): + print(f"Error: Config file not found: {config_path}") + print("Usage: python main.py [path/to/config.yml]") + sys.exit(1) + + print(f"Using config: {config_path}\n") + try: model_definition = build_model_definition(config_path) except Exception as e: @@ -68,13 +78,4 @@ def main(config_path): if __name__ == "__main__": - # Allow passing YAML file as command-line arg - config_path = sys.argv[1] if len(sys.argv) > 1 else "cases/ashida1995/config.yml" - - if not os.path.isfile(config_path): - print(f"Error: Config file not found: {config_path}") - print("Usage: python main.py [path/to/config.yml]") - sys.exit(1) - - print(f"Using config: {config_path}\n") - main(config_path) + main() diff --git a/pyproject.toml b/pyproject.toml index 4578251..84b0870 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,10 +2,16 @@ name = "zdPlasmaPy" version = "0.1.0" +[project.scripts] +zdplasmapy = "main:main" + [build-system] -requires = ["setuptools>=61.0"] +requires = ["setuptools>=64.0"] build-backend = "setuptools.build_meta" -# Add this to the end of your pyproject.toml + +[tool.setuptools] +py-modules = ["main"] [tool.setuptools.packages.find] -where = ["src"] \ No newline at end of file +where = ["."] +include = ["src*"] \ No newline at end of file