diff --git a/.github/workflows/publish_docs.yml b/.github/workflows/publish_docs.yml deleted file mode 100644 index 88833dd..0000000 --- a/.github/workflows/publish_docs.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Deploy docs to GitHub Pages - -on: - push: - branches: ["devel"] - workflow_dispatch: - -permissions: - contents: read - pages: write - id-token: write - -concurrency: - group: "pages" - cancel-in-progress: false - -jobs: - build-and-deploy: - runs-on: ubuntu-latest - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Build documentation - uses: ./.github/actions/build-docs - with: - python-version: "3.10" - treat-warnings-as-errors: "false" - - - name: Setup Pages - uses: actions/configure-pages@v5 - - - name: Upload built docs - uses: actions/upload-pages-artifact@v3 - with: - path: docs/build/html/ - - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 diff --git a/.github/workflows/publish_pypi.yml b/.github/workflows/publish_pypi.yml index cf03ba3..985aeef 100644 --- a/.github/workflows/publish_pypi.yml +++ b/.github/workflows/publish_pypi.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest environment: name: pypi - url: https://pypi.org/project/template-python/ + url: https://pypi.org/project/plasma-simulation/ permissions: id-token: write contents: read diff --git a/.github/workflows/test_docs.yml b/.github/workflows/test_docs.yml deleted file mode 100644 index dce6436..0000000 --- a/.github/workflows/test_docs.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Test Documentation Build - -on: - push: - branches: - - main - - devel - pull_request: - branches: - - main - - devel - -defaults: - run: - shell: bash - -jobs: - test-docs: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Build documentation - uses: ./.github/actions/build-docs - with: - python-version: "3.10" - treat-warnings-as-errors: "true" - - - name: Upload docs artifact - uses: actions/upload-artifact@v4 - if: always() - with: - name: documentation - path: docs/build/html/ - retention-days: 7 diff --git a/.github/workflows/test_setup_script.yml b/.github/workflows/test_setup_script.yml deleted file mode 100644 index c1e9e4c..0000000 --- a/.github/workflows/test_setup_script.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: Test Setup Script - -on: - push: - branches: - - main - - devel - pull_request: - branches: - - main - - devel - -defaults: - run: - shell: bash - -jobs: - test-setup-script: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.10" - - - name: Run setup script - run: | - bash setup_project.sh my-test-app - - - name: Verify changes - run: | - # Check that src/app was moved to src/my_test_app - if [ ! -d "src/my_test_app" ]; then - echo "Error: src/my_test_app does not exist" - exit 1 - fi - - # Check that src/app no longer exists - if [ -d "src/app" ]; then - echo "Error: src/app still exists" - exit 1 - fi - - # Check that template-python was replaced in pyproject.toml - if grep -q "template-python" pyproject.toml; then - echo "Error: 'template-python' still found in pyproject.toml" - exit 1 - fi - - if ! grep -q "my-test-app" pyproject.toml; then - echo "Error: 'my-test-app' not found in pyproject.toml" - exit 1 - fi - - echo "✓ All checks passed!" - - - name: Install project with new name - run: | - pip install --upgrade pip - pip install -e . - - - name: Test renamed command works - run: | - my-test-app diff --git a/.github/workflows/test_tutorials.yml b/.github/workflows/test_tutorials.yml deleted file mode 100644 index 58a7e81..0000000 --- a/.github/workflows/test_tutorials.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Test Tutorials - -on: - push: - branches: - - main - - devel - pull_request: - branches: - - main - - devel - -jobs: - tutorials: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.10" - - - name: Cache pip - uses: actions/cache@v4 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }} - restore-keys: | - ${{ runner.os }}-pip- - - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install -y pandoc - - - name: Install project - run: | - pip install --upgrade pip - pip install ".[dev]" - - - name: Execute tutorials - run: | - jupyter nbconvert --to notebook --execute tutorials/*.ipynb --output-dir=/tmp --ExecutePreprocessor.timeout=300 diff --git a/README.md b/README.md index 8f49086..8a6ad0c 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# template-python +# plasma-simulation Template repository for python projects -Documentation: https://max-models.github.io/template-python/ +Documentation: https://max-models.github.io/plasma-simulation/ # Install @@ -23,7 +23,7 @@ pip install -e . Run the code with ``` -template-python +plasma-simulation ``` # Build docs @@ -50,9 +50,9 @@ This project is configured to automatically publish to PyPI using GitHub Actions 1. Go to your PyPI project settings 2. Navigate to "Publishing" → "Add a new publisher" 3. Configure the trusted publisher with these details: - - **PyPI Project Name**: `template-python` (or your project name) + - **PyPI Project Name**: `plasma-simulation` (or your project name) - **Owner**: Your GitHub username/organization - - **Repository name**: `template-python` + - **Repository name**: `plasma-simulation` - **Workflow name**: `publish_pypi.yml` - **Environment name**: `pypi` diff --git a/docs/Makefile b/docs/Makefile deleted file mode 100644 index d0c3cbf..0000000 --- a/docs/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# Minimal makefile for Sphinx documentation -# - -# You can set these variables from the command line, and also -# from the environment for the first two. -SPHINXOPTS ?= -SPHINXBUILD ?= sphinx-build -SOURCEDIR = source -BUILDDIR = build - -# Put it first so that "make" without argument is like "make help". -help: - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) - -.PHONY: help Makefile - -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/make.bat b/docs/make.bat deleted file mode 100644 index 747ffb7..0000000 --- a/docs/make.bat +++ /dev/null @@ -1,35 +0,0 @@ -@ECHO OFF - -pushd %~dp0 - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set SOURCEDIR=source -set BUILDDIR=build - -%SPHINXBUILD% >NUL 2>NUL -if errorlevel 9009 ( - echo. - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx - echo.installed, then set the SPHINXBUILD environment variable to point - echo.to the full path of the 'sphinx-build' executable. Alternatively you - echo.may add the Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.https://www.sphinx-doc.org/ - exit /b 1 -) - -if "%1" == "" goto help - -%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% -goto end - -:help -%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% - -:end -popd diff --git a/docs/source/_static/custom.css b/docs/source/_static/custom.css deleted file mode 100644 index fb0ac08..0000000 --- a/docs/source/_static/custom.css +++ /dev/null @@ -1,93 +0,0 @@ -/* Improved toctree styling */ - -/* Main page toctree container */ -.toctree-wrapper { - margin: 2rem 0; -} - -/* Toctree list styling */ -.toctree-wrapper ul { - padding-left: 0; - list-style: none; -} - -/* Toctree list items */ -.toctree-wrapper li { - margin: 0.4rem 0; - padding: 0.6rem 1rem; - border-bottom: 1.5px solid #c5d1e0; - border-left: 3px solid transparent; - transition: all 0.2s ease; -} - -.toctree-wrapper li:hover { - border-left-color: #4f46e5; - background: rgba(79, 70, 229, 0.03); -} - -.toctree-wrapper li:last-child { - border-bottom: 1.5px solid #c5d1e0; -} - -/* Toctree links */ -.toctree-wrapper a.reference { - font-size: 1.1rem; - font-weight: 500; - color: #1a365d; - text-decoration: none; - display: inline-block; - transition: all 0.2s ease; - padding: 0.25rem 0; -} - -.toctree-wrapper a.reference:hover { - color: #2563eb; - transform: translateX(5px); -} - -/* Nested toctree items */ -.toctree-wrapper ul ul { - padding-left: 1.5rem; - margin-top: 0.3rem; -} - -.toctree-wrapper ul ul li { - margin: 0.25rem 0; - padding: 0.4rem 0.8rem; - border-bottom: 1px solid #dce4f0; - border-left: 2px solid transparent; -} - -.toctree-wrapper ul ul li:hover { - border-left-color: #6366f1; - background: rgba(99, 102, 241, 0.03); -} - -.toctree-wrapper ul ul a.reference { - font-size: 1rem; - font-weight: 400; - color: #4a5568; -} - -.toctree-wrapper ul ul a.reference:hover { - color: #4f46e5; -} - -/* Toctree caption */ -.toctree-wrapper p.caption { - font-size: 1.3rem; - font-weight: 600; - color: #1e3a5f; - margin-bottom: 1rem; - padding-bottom: 0.5rem; - border-bottom: 3px solid #4f46e5; -} - -/* Improve spacing on main page */ -div.section > .toctree-wrapper { - background: linear-gradient(135deg, #f0f4f8 0%, #e8eef5 100%); - padding: 1.5rem; - border-radius: 12px; - box-shadow: 0 4px 6px rgba(79, 70, 229, 0.08); - border: 1px solid #dce4f0; -} diff --git a/docs/source/api/index.rst b/docs/source/api/index.rst deleted file mode 100644 index d1bd8af..0000000 --- a/docs/source/api/index.rst +++ /dev/null @@ -1,13 +0,0 @@ -API Reference -============= - -This section contains the automatically generated Python API reference. - -Modules -------- - -.. autosummary:: - :toctree: _autosummary - :recursive: - - app diff --git a/docs/source/conf.py b/docs/source/conf.py deleted file mode 100644 index 406c718..0000000 --- a/docs/source/conf.py +++ /dev/null @@ -1,101 +0,0 @@ -# Configuration file for the Sphinx documentation builder. -# -# For the full list of built-in configuration values, see the documentation: -# https://www.sphinx-doc.org/en/master/usage/configuration.html -import os -import shutil -import sys -from pathlib import Path - -sys.path.insert(0, os.path.abspath("../src")) - -# Copy tutorial notebooks from project root to docs/source/tutorials/ -tutorials_source = Path(__file__).parent.parent.parent / "tutorials" -tutorials_dest = Path(__file__).parent / "tutorials" - -if tutorials_source.exists(): - tutorials_dest.mkdir(exist_ok=True) - for notebook in tutorials_source.glob("*.ipynb"): - shutil.copy2(notebook, tutorials_dest / notebook.name) - - -# -- Project information ----------------------------------------------------- -# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information - -project = "python-template" -copyright = "2025, Max" -author = "Max" - -# -- General configuration --------------------------------------------------- - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = [ - "sphinx.ext.autodoc", - "sphinx.ext.autosummary", - "sphinx.ext.viewcode", - "sphinx.ext.napoleon", - "sphinxcontrib.mermaid", - "sphinx_design", - "nbsphinx", -] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ["_templates"] - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -# This pattern also affects html_static_path and html_extra_path. -exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "**/.ipynb_checkpoints"] - -# nbsphinx configuration -nbsphinx_execute = "always" # Execute notebooks during build - - -# -- Options for HTML output ------------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -# -html_theme = "sphinx_book_theme" - -html_theme_options = { - "repository_branch": "devel", - "show_toc_level": 2, - "secondary_sidebar_items": ["page-toc"], - "use_sidenotes": True, - "home_page_in_toc": True, - "collapse_navigation": False, - "navigation_depth": 2, - "icon_links": [ - { - "name": "GitHub", - "url": "https://github.com/max-models/template-projects/", - "icon": "fab fa-github", - "type": "fontawesome", - }, - { - "name": "⭐ Star us!", - "url": "https://github.com/max-models/template-projects/", - "icon": "fas fa-star", - "type": "fontawesome", - }, - ], -} - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -breathe_separate_member_pages = False -html_theme = "sphinx_book_theme" -html_static_path = ["_static"] -html_css_files = ["custom.css"] - -autosummary_generate = True - -autodoc_default_options = { - "members": True, - "undoc-members": False, - "show-inheritance": True, -} diff --git a/docs/source/getting_started.rst b/docs/source/getting_started.rst deleted file mode 100644 index 4890f2d..0000000 --- a/docs/source/getting_started.rst +++ /dev/null @@ -1,11 +0,0 @@ -Getting Started -=============== - -Learn how to install and use `template-python`. - -.. toctree:: - :maxdepth: 1 - - guides/install - guides/quickstart - tutorials diff --git a/docs/source/guides/install.rst b/docs/source/guides/install.rst deleted file mode 100644 index 04922ba..0000000 --- a/docs/source/guides/install.rst +++ /dev/null @@ -1,30 +0,0 @@ -Installation -============ - -Create and activate python environment:: - - python -m venv env - source env/bin/activate - pip install --upgrade pip - -Install the code and requirements with pip:: - - pip install -e . - -Run the code with:: - - template-python - - -Build docs -========== - -:: - - make html - cd ../ - open docs/_build/html/index.html - - -.. toctree:: - :maxdepth: 1 diff --git a/docs/source/guides/quickstart.rst b/docs/source/guides/quickstart.rst deleted file mode 100644 index 4bea978..0000000 --- a/docs/source/guides/quickstart.rst +++ /dev/null @@ -1,16 +0,0 @@ -Quickstart -========== - -First, ensure that ``template-python`` is installed on your system. - -Basic Usage ------------ - -After installation, you can run the application with:: - - template-python - -For more details, see the :doc:`install` guide. - -.. toctree:: - :maxdepth: 1 diff --git a/docs/source/index.rst b/docs/source/index.rst deleted file mode 100644 index 85109c7..0000000 --- a/docs/source/index.rst +++ /dev/null @@ -1,11 +0,0 @@ -template-python Documentation -============================= - -Write the documentation of your python package here. - -.. toctree:: - :maxdepth: 1 - :caption: Documentation - - getting_started - api/index diff --git a/docs/source/tutorials.rst b/docs/source/tutorials.rst deleted file mode 100644 index fed41de..0000000 --- a/docs/source/tutorials.rst +++ /dev/null @@ -1,10 +0,0 @@ -Tutorials -========= - -Here are a few tutorials to help you get started. - -.. toctree:: - :maxdepth: 1 - :glob: - - tutorials/* diff --git a/pyproject.toml b/pyproject.toml index b27f9e9..19beef9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" requires = [ "setuptools", "wheel" ] [project] -name = "template-python" +name = "plasma-simulation" version = "0.1" description = "Template python repository." readme = "README.md" @@ -26,7 +26,7 @@ optional-dependencies.dev = [ "black[jupyter]", "isort", "ruff", - "template-python[test,docs]", + "plasma-simulation[test,docs]", ] # https://medium.com/@pratikdomadiya123/build-project-documentation-quickly-with-the-sphinx-python-2a9732b66594 optional-dependencies.docs = [ @@ -44,8 +44,8 @@ optional-dependencies.docs = [ "sphinx-design", ] optional-dependencies.test = [ "coverage", "pytest" ] -urls."Source" = "https://github.com/max-models/template-python" -scripts.template-python = "app.main:main" +urls."Source" = "https://github.com/max-models/plasma-simulation" +scripts.plasma-simulation = "plasma_simulation.main:main" [tool.setuptools.packages.find] where = [ "src" ] diff --git a/rules/devel_rules.json b/rules/devel_rules.json deleted file mode 100644 index fdcb5e2..0000000 --- a/rules/devel_rules.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "devel rules", - "target": "branch", - "source_type": "Repository", - "enforcement": "active", - "conditions": { - "ref_name": { - "exclude": [], - "include": ["~DEFAULT_BRANCH", "refs/heads/devel"] - } - }, - "rules": [ - { - "type": "deletion" - }, - { - "type": "non_fast_forward" - }, - { - "type": "pull_request", - "parameters": { - "required_approving_review_count": 1, - "dismiss_stale_reviews_on_push": true, - "require_code_owner_review": true, - "require_last_push_approval": true, - "required_review_thread_resolution": true, - "automatic_copilot_code_review_enabled": false, - "allowed_merge_methods": ["merge", "squash"] - } - } - ], - "bypass_actors": [] -} diff --git a/rules/main_rules.json b/rules/main_rules.json deleted file mode 100644 index ec1cd51..0000000 --- a/rules/main_rules.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "main rules", - "target": "branch", - "source_type": "Repository", - "enforcement": "active", - "conditions": { - "ref_name": { - "exclude": [], - "include": ["refs/heads/master", "refs/heads/main"] - } - }, - "rules": [ - { - "type": "deletion" - }, - { - "type": "non_fast_forward" - }, - { - "type": "pull_request", - "parameters": { - "required_approving_review_count": 1, - "dismiss_stale_reviews_on_push": true, - "require_code_owner_review": true, - "require_last_push_approval": true, - "required_review_thread_resolution": true, - "automatic_copilot_code_review_enabled": false, - "allowed_merge_methods": ["rebase"] - } - } - ], - "bypass_actors": [] -} diff --git a/setup_project.sh b/setup_project.sh deleted file mode 100755 index a245bd0..0000000 --- a/setup_project.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -# Get the directory where this script is located -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -cd "$SCRIPT_DIR" - -if [[ $# -ne 1 ]]; then - echo "Usage: $0 " - exit 1 -fi - -APPNAME="$1" -APPNAME_UNDERSCORE="${APPNAME//-/_}" - -# 1. Find and replace "template-python" with app name -grep -rl "template-python" . --exclude-dir=.git --exclude-dir=docs/build | while IFS= read -r file; do - LC_ALL=C sed -i.bak "s/template-python/${APPNAME}/g" "$file" - rm -f "${file}.bak" -done - -# Also replace template_python with appname_underscore -grep -rl "template_python" . --exclude-dir=.git --exclude-dir=docs/build | while IFS= read -r file; do - LC_ALL=C sed -i.bak "s/template_python/${APPNAME_UNDERSCORE}/g" "$file" - rm -f "${file}.bak" -done - -# 2. Move src/app to src/ -if [[ -d "src/app" ]]; then - mv src/app "src/${APPNAME_UNDERSCORE}" -else - echo "Error: src/app does not exist" - exit 1 -fi - -# 3. Replace import in src/**/*.py and entry points -# from app.main import main -> from .main import main -# Also replace "app.main:main" -> ".main:main" in pyproject.toml - -find src -type f -name "*.py" -print0 | while IFS= read -r -d '' file; do - LC_ALL=C sed -i.bak \ - "s/from app\.main import main/from ${APPNAME_UNDERSCORE}.main import main/g" \ - "$file" - rm -f "${file}.bak" -done - -# Replace app.main:main entry point in pyproject.toml -if [[ -f "pyproject.toml" ]]; then - LC_ALL=C sed -i.bak "s/app\.main:main/${APPNAME_UNDERSCORE}.main:main/g" "pyproject.toml" - rm -f "pyproject.toml.bak" -fi - -# 4. Update docs/source/api/index.rst to reference the new module name -if [[ -f "docs/source/api/index.rst" ]]; then - LC_ALL=C sed -i.bak "s/^ app$/ ${APPNAME_UNDERSCORE}/" "docs/source/api/index.rst" - rm -f "docs/source/api/index.rst.bak" -fi - -# 5. Remove the test_setup_script.yml workflow since it's no longer needed -if [[ -f ".github/workflows/test_setup_script.yml" ]]; then - rm -f ".github/workflows/test_setup_script.yml" -fi - - -echo "Done:" -echo " Replaced 'template-python' → '${APPNAME}'" -echo " Replaced 'template_python' → '${APPNAME_UNDERSCORE}'" -echo " Moved src/app → src/${APPNAME_UNDERSCORE}" -echo " Replaced import statements and entry points" -echo " Removed .github/workflows/test_setup_script.yml" -echo "You can now remove this script with: rm setup_project.sh" diff --git a/src/app/main.py b/src/plasma_simulation/main.py similarity index 100% rename from src/app/main.py rename to src/plasma_simulation/main.py diff --git a/src/app/tests/unit/__init__.py b/src/plasma_simulation/tests/unit/__init__.py similarity index 100% rename from src/app/tests/unit/__init__.py rename to src/plasma_simulation/tests/unit/__init__.py diff --git a/src/app/tests/unit/test_app.py b/src/plasma_simulation/tests/unit/test_app.py similarity index 71% rename from src/app/tests/unit/test_app.py rename to src/plasma_simulation/tests/unit/test_app.py index 5e9299e..04c3681 100644 --- a/src/app/tests/unit/test_app.py +++ b/src/plasma_simulation/tests/unit/test_app.py @@ -1,5 +1,5 @@ def test_import_app(): - from app.main import main + from plasma_simulation.main import main print("app imported") main() diff --git a/tutorials/example_tutorial.ipynb b/tutorials/example_tutorial.ipynb deleted file mode 100644 index da4e6f7..0000000 --- a/tutorials/example_tutorial.ipynb +++ /dev/null @@ -1,43 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "0", - "metadata": {}, - "source": [ - "# Tutorial 1" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1", - "metadata": {}, - "outputs": [], - "source": [ - "print(\"Example tutorial which will be published in the docs!\")" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.13.3" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -}