From a85f39da99d46318bc06a1be5edabaa53db0247e Mon Sep 17 00:00:00 2001 From: Santhosh Sundaram Date: Thu, 15 Aug 2024 21:26:19 +0530 Subject: [PATCH] renamed all occurances of pybamm-cookiecutter to pybamm-cookie --- .github/workflows/test_on_push.yml | 9 ++-- .gitignore | 2 +- .pre-commit-config.yaml | 6 +-- CODE-OF-CONDUCT.md | 2 +- CONTRIBUTING.md | 30 +++++------ README.md | 54 +++++++++---------- docs/conf.py | 4 +- docs/index.md | 2 +- noxfile.py | 4 +- pyproject.toml | 22 ++++---- src/pybamm_cookie/__init__.py | 14 +++++ src/pybamm_cookie/__main__.py | 4 ++ .../cli.py | 14 ++--- .../py.typed | 0 .../version.pyi | 0 src/pybamm_cookiecutter/__init__.py | 14 ----- src/pybamm_cookiecutter/__main__.py | 4 -- template/{{ project_name }}/noxfile.py.jinja | 2 +- .../src/{{project_slug}}/entry_point.py.jinja | 2 +- .../workflows/test_on_push.yml | 4 +- .../template_tests/test_project_generation.py | 6 +-- 21 files changed, 100 insertions(+), 99 deletions(-) create mode 100644 src/pybamm_cookie/__init__.py create mode 100644 src/pybamm_cookie/__main__.py rename src/{pybamm_cookiecutter => pybamm_cookie}/cli.py (84%) rename src/{pybamm_cookiecutter => pybamm_cookie}/py.typed (100%) rename src/{pybamm_cookiecutter => pybamm_cookie}/version.pyi (100%) delete mode 100644 src/pybamm_cookiecutter/__init__.py delete mode 100644 src/pybamm_cookiecutter/__main__.py diff --git a/.github/workflows/test_on_push.yml b/.github/workflows/test_on_push.yml index c0a5702..063b388 100644 --- a/.github/workflows/test_on_push.yml +++ b/.github/workflows/test_on_push.yml @@ -6,6 +6,7 @@ on: push: branches: - main + - pybammcookie jobs: style: @@ -38,7 +39,7 @@ jobs: name: Template Generation/Project Tests (${{ matrix.os }} / Python ${{ matrix.python-version }}) steps: - - name: Checkout pybamm-cookiecutter + - name: Checkout pybamm-cookie uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} @@ -79,7 +80,7 @@ jobs: name: Doctests (ubuntu-latest / Python 3.12) steps: - - name: Check out pybamm-cookiecutter repository + - name: Check out pybamm-cookie repository uses: actions/checkout@v4 with: fetch-depth: 0 @@ -114,7 +115,7 @@ jobs: name: Generated Project Tests (${{ matrix.os }} / Python ${{ matrix.python-version }} / Backend ${{ matrix.backend }} / VCS ${{ matrix.vcs }}) steps: - - name: Checkout pybamm-cookiecutter + - name: Checkout pybamm-cookie uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} @@ -146,7 +147,7 @@ jobs: name: Generated Project Doctests (ubuntu-latest / Python 3.12) steps: - - name: Check out pybamm-cookiecutter repository + - name: Check out pybamm-cookie repository uses: actions/checkout@v4 with: fetch-depth: 0 diff --git a/.gitignore b/.gitignore index 05d3fdb..90080e4 100644 --- a/.gitignore +++ b/.gitignore @@ -128,7 +128,7 @@ cython_debug/ .vscode/ # hatch-vcs -src/pybamm_cookiecutter/_version.py +src/pybamm_cookie/_version.py # ruff .ruff_cache/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b4d5727..5e87d9c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,7 +15,7 @@ repos: - id: trailing-whitespace - id: end-of-file-fixer - id: check-yaml - files: "^(src/pybamm_cookiecutter|tests$)" + files: "^(src/pybamm_cookie|tests$)" - id: check-added-large-files - id: mixed-line-ending @@ -38,7 +38,7 @@ repos: rev: v0.5.7 hooks: - id: ruff - files: "^(src/pybamm_cookiecutter|tests$)" + files: "^(src/pybamm_cookie|tests$)" args: ["--fix", "--show-fixes"] # Documentation files @@ -62,7 +62,7 @@ repos: rev: v1.11.1 hooks: - id: mypy - files: "^(src/pybamm_cookiecutter|tests$)" + files: "^(src/pybamm_cookie|tests$)" exclude: CODE-OF-CONDUCT.md diff --git a/CODE-OF-CONDUCT.md b/CODE-OF-CONDUCT.md index 1b3efd2..93f4bdd 100644 --- a/CODE-OF-CONDUCT.md +++ b/CODE-OF-CONDUCT.md @@ -1,7 +1,7 @@ [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE-OF-CONDUCT.md) -# `pybamm-cookiecutter` Code of Conduct +# `pybamm-cookie` Code of Conduct ## Our Pledge diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d161e8e..83a541a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ -# Contributing to `pybamm-cookiecutter` +# Contributing to `pybamm-cookie` If you'd like to contribute to this project, please have a look at the [guidelines below](#workflow). @@ -13,7 +13,7 @@ Before you commit any code, please perform the following checks: ### Installing and using pre-commit -`pybamm-cookiecutter` uses a set of `pre-commit` hooks and the `pre-commit` bot to format and prettify the codebase. The hooks can be installed locally using - +`pybamm-cookie` uses a set of `pre-commit` hooks and the `pre-commit` bot to format and prettify the codebase. The hooks can be installed locally using - ```bash pip install pre-commit @@ -37,25 +37,25 @@ We use [Git](https://en.wikipedia.org/wiki/Git) and [GitHub](https://en.wikipedi 1. Create an [issue](https://guides.github.com/features/issues/) where new proposals can be discussed before any coding is done. 2. Create a [branch](https://help.github.com/articles/creating-and-deleting-branches-within-your-repository/) of this repo (ideally on your own [fork](https://help.github.com/articles/fork-a-repo/)), where all changes will be made. 3. Download the source code onto your local system, by [cloning](https://help.github.com/articles/cloning-a-repository/) the repository (or your fork of the repository). -4. Use `nox -s dev` or `pip install -e .[dev]` to install `pybamm-cookiecutter` in editable/development mode. +4. Use `nox -s dev` or `pip install -e .[dev]` to install `pybamm-cookie` in editable/development mode. 5. [Test](#testing) if your installation worked, using the test script: `nox -s test-generation` or `pytest`. You now have everything you need to start making changes! ### B. Writing your code -6. This project is developed in [Python](https://www.python.org)), and uses the [cookiecutter](https://cookiecutter.readthedocs.io/en/stable/) templating tool. For testing, we use [`pytest`](https://docs.pytest.org/en/). +6. This project is developed in [Python](https://www.python.org)), and uses the [copier](https://copier.readthedocs.io/) templating tool. For testing, we use [`pytest`](https://docs.pytest.org/en/). 7. Make sure to follow our [coding style guidelines](#coding-style-guidelines). 8. Commit your changes to your branch with [useful, descriptive commit messages](https://chris.beams.io/posts/git-commit/): Remember these are publicly visible and should still make sense a few months ahead in time. While developing, you can keep using the GitHub issue you're working on as a place for discussion. -### C. Merging your changes with `pybamm-cookiecutter` +### C. Merging your changes with `pybamm-cookie` 9. [Test your code!](#testing) -10. When you feel your code is finished, or at least warrants serious discussion, run the [pre-commit checks](#pre-commit-checks) and then create a [pull request](https://help.github.com/articles/about-pull-requests/) (PR) on [`pybamm-cookiecutter`'s GitHub page](https://github.com/pybamm-team/pybamm-cookiecutter). -11. Once a PR has been created, it will be reviewed by any member of the community. Changes might be suggested which you can make by simply adding new commits to the branch. When everything's finished, someone with the right GitHub permissions will merge your changes into pybamm-cookiecutter main repository. +10. When you feel your code is finished, or at least warrants serious discussion, run the [pre-commit checks](#pre-commit-checks) and then create a [pull request](https://help.github.com/articles/about-pull-requests/) (PR) on [`pybamm-cookie`'s GitHub page](https://github.com/pybamm-team/pybamm-cookie). +11. Once a PR has been created, it will be reviewed by any member of the community. Changes might be suggested which you can make by simply adding new commits to the branch. When everything's finished, someone with the right GitHub permissions will merge your changes into pybamm-cookie main repository. ## Coding style guidelines @@ -64,14 +64,14 @@ This project follows the [PEP8 recommendations](https://www.python.org/dev/peps/ ### Ruff -We use [ruff](https://github.com/charliermarsh/ruff) to check our PEP8 adherence. To try this on your system, navigate to the parent pybamm-cookiecutter directory in a console and type +We use [ruff](https://github.com/astral-sh/ruff) to check our PEP8 adherence. To try this on your system, navigate to the parent pybamm-cookie directory in a console and type ```bash python -m pip install pre-commit pre-commit run ruff ``` -Ruff is configured inside the file `pre-commit-config.yaml`, allowing us to ignore some errors. If you think some rules should be added or removed, please submit an [issue](https://github.com/pybamm-team/pybamm-cookiecutter/issues). +Ruff is configured inside the file `pre-commit-config.yaml`, allowing us to ignore some errors. If you think some rules should be added or removed, please submit an [issue](https://github.com/pybamm-team/pybamm-cookie/issues). If you performed the `pre-commit install` step above, your code changes will be checked against Ruff automatically when you try to commit them (see [Pre-commit checks](#pre-commit-checks)). @@ -109,7 +109,7 @@ Using [Sphinx](http://www.sphinx-doc.org/en/stable/) the documentation in `docs` ### Building the documentation -To test and debug the documentation, it's best to build it locally. To do this, navigate to your pybamm-cookiecutter directory in a console, and then type: +To test and debug the documentation, it's best to build it locally. To do this, navigate to your pybamm-cookie directory in a console, and then type: ``` nox -s docs @@ -119,9 +119,9 @@ And then visit the webpage served at `http://127.0.0.1:8000`. Each time a change ### Continuous Integration using GitHub Actions -Each change pushed to the `pybamm-cookiecutter` GitHub repository will trigger the tests to be run, using [GitHub Actions](https://github.com/features/actions). +Each change pushed to the `pybamm-cookie` GitHub repository will trigger the tests to be run, using [GitHub Actions](https://github.com/features/actions). -Tests are run for different operating systems, and for all Python versions officially supported by the `pybamm-cookiecutter` template. If you open a pull request (PR), feedback is directly available on the corresponding page. If all tests pass, a green tick will be displayed next to the corresponding test run. If one or more test(s) fail, a red cross will be displayed instead. +Tests are run for different operating systems, and for all Python versions officially supported by the `pybamm-cookie` template. If you open a pull request (PR), feedback is directly available on the corresponding page. If all tests pass, a green tick will be displayed next to the corresponding test run. If one or more test(s) fail, a red cross will be displayed instead. More details can be obtained by clicking on a specific run. @@ -131,6 +131,6 @@ Configuration files for various GitHub Actions workflows can be found in `.githu GitHub does some magic with particular filenames. In particular: -- The first page people see when they go to [our GitHub page](https://github.com/pybamm-team/pybamm-cookiecutter) displays the contents of [README.md](https://github.com/pybamm-team/pybamm-cookiecutter/blob/main/README.md), which is written in the [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) format. Some guidelines can be found [here](https://help.github.com/articles/about-readmes/). -- The license for using pybamm-cookiecutter is stored in [LICENSE](https://github.com/pybamm-team/pybamm-cookiecutter/blob/main/LICENSE.txt), and [automatically](https://help.github.com/articles/adding-a-license-to-a-repository/) linked to by GitHub. -- This file, [CONTRIBUTING.md](https://github.com/pybamm-team/pybamm-cookiecutter/blob/main/CONTRIBUTING.md) is recognised as the document that lists the contribution guidelines and a link is [automatically](https://github.com/blog/1184-contributing-guidelines) displayed when new issues or pull requests are created. +- The first page people see when they go to [our GitHub page](https://github.com/pybamm-team/pybamm-cookie) displays the contents of [README.md](https://github.com/pybamm-team/pybamm-cookie/blob/main/README.md), which is written in the [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) format. Some guidelines can be found [here](https://help.github.com/articles/about-readmes/). +- The license for using pybamm-cookie is stored in [LICENSE](https://github.com/pybamm-team/pybamm-cookie/blob/main/LICENSE.txt), and [automatically](https://help.github.com/articles/adding-a-license-to-a-repository/) linked to by GitHub. +- This file, [CONTRIBUTING.md](https://github.com/pybamm-team/pybamm-cookie/blob/main/CONTRIBUTING.md) is recognised as the document that lists the contribution guidelines and a link is [automatically](https://github.com/blog/1184-contributing-guidelines) displayed when new issues or pull requests are created. diff --git a/README.md b/README.md index f548c95..16df3bc 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# pybamm-cookiecutter +# pybamm-cookie @@ -11,28 +11,28 @@ [![GitHub Discussions][github-discussions-badge]][github-discussions-link] -[actions-badge]: https://github.com/pybamm-team/pybamm-cookiecutter/workflows/CI/badge.svg -[actions-link]: https://github.com/pybamm-team/pybamm-cookiecutter/actions -[conda-badge]: https://img.shields.io/conda/vn/conda-forge/pybamm-cookiecutter -[conda-link]: https://github.com/conda-forge/pybamm-cookiecutter-feedstock +[actions-badge]: https://github.com/pybamm-team/pybamm-cookie/workflows/CI/badge.svg +[actions-link]: https://github.com/pybamm-team/pybamm-cookie/actions +[conda-badge]: https://img.shields.io/conda/vn/conda-forge/pybamm-cookie +[conda-link]: https://github.com/conda-forge/pybamm-cookie-feedstock [github-discussions-badge]: https://img.shields.io/static/v1?label=Discussions&message=Ask&color=blue&logo=github -[github-discussions-link]: https://github.com/pybamm-team/pybamm-cookiecutter/discussions -[pypi-link]: https://pypi.org/project/pybamm-cookiecutter/ -[pypi-platforms]: https://img.shields.io/pypi/pyversions/pybamm-cookiecutter -[pypi-version]: https://img.shields.io/pypi/v/pybamm-cookiecutter -[rtd-badge]: https://readthedocs.org/projects/pybamm-cookiecutter/badge/?version=latest -[rtd-link]: https://pybamm-cookiecutter.readthedocs.io/en/latest/?badge=latest --> +[github-discussions-link]: https://github.com/pybamm-team/pybamm-cookie/discussions +[pypi-link]: https://pypi.org/project/pybamm-cookie/ +[pypi-platforms]: https://img.shields.io/pypi/pyversions/pybamm-cookie +[pypi-version]: https://img.shields.io/pypi/v/pybamm-cookie +[rtd-badge]: https://readthedocs.org/projects/pybamm-cookie/badge/?version=latest +[rtd-link]: https://pybamm-cookie.readthedocs.io/en/latest/?badge=latest --> [![Powered by NumFOCUS](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A)](http://numfocus.org) [![Copier](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/copier-org/copier/master/img/badge/badge-grayscale-inverted-border-red.json)](https://github.com/copier-org/copier) [![Test template and generated project](https://github.com/pybamm-team/pybamm-cookie/actions/workflows/test_on_push.yml/badge.svg)](https://github.com/pybamm-team/pybamm-cookie/actions/workflows/test_on_push.yml) -This repository contains a `copier` template for battery modeling projects using PyBaMM, released under the [BSD-3-Clause license](https://github.com/pybamm-team/pybamm-cookiecutter/blob/main/LICENSE). Currently under active development. +This repository contains a `copier` template for battery modeling projects using PyBaMM, released under the [BSD-3-Clause license](https://github.com/pybamm-team/pybamm-cookie/blob/main/LICENSE). Currently under active development. -## 📄 Using `pybamm-cookiecutter` +## 📄 Using `pybamm-cookie` -### Generating projects with `pybamm-cookiecutter` +### Generating projects with `pybamm-cookie` #### Manually using copier @@ -40,28 +40,28 @@ Install `copier` and `jinja2_time` extension using `pip`. ```bash pip install copier jinja2-time ``` -Generate a project from the `pybamm-cookiecutter` template. +Generate a project from the `pybamm-cookie` template. ```bash -copier copy https://github.com/pybamm-team/pybamm-cookiecutter.git . --trust +copier copy https://github.com/pybamm-team/pybamm-cookie.git . --trust # this will generate the project in the current working directory -copier copy https://github.com/pybamm-team/pybamm-cookiecutter.git path_to_copy_to/ --trust +copier copy https://github.com/pybamm-team/pybamm-cookie.git path_to_copy_to/ --trust # this will generate the project in the specified path ``` #### Using pipx (recommended) You can generate a project by executing the `pipx run` command which doesn't need any package installations. ```bash -pipx run pybamm-cookiecutter --path /path_to_copy_to +pipx run pybamm-cookie --path /path_to_copy_to ``` -Or if you wish to install the `pybamm-cookiecutter` package and then generate a project, you could do so with the help of following commands. +Or if you wish to install the `pybamm-cookie` package and then generate a project, you could do so with the help of following commands. ```bash -pipx install pybamm-cookiecutter # or pip install pybamm-cookiecutter +pipx install pybamm-cookie # or pip install pybamm-cookie ``` Navigate into the directory you want your project directory to reside in, or use `--path` argument to explicitly mention the path where you want your project to be generated. ```bash -pybamm-cookiecutter --path /path_to_copy_to +pybamm-cookie --path /path_to_copy_to ``` Copier will prompt you with various configurations and you may choose the ones that suit your use case. @@ -70,7 +70,7 @@ Copier will prompt you with various configurations and you may choose the ones t After generation, you can navigate to the generated project and run `nox -s generated-project-tests` to ensure if the project units are working as intended. -### Installing the `pybamm-cookiecutter` project +### Installing the `pybamm-cookie` project This refers to the project used for the development of this template. There are two ways to install this project: either through `nox` or `pip`. `nox` uses `uv pip` or `pip` internally, and in this case, creates a virtual environment for you to activate. To install, navigate to the root directory of this repository and execute either of these commands: @@ -82,14 +82,14 @@ or To check if the project was successfully installed, import the project inside Python. ```python -import pybamm_cookiecutter +import pybamm_cookie -pybamm_cookiecutter.__version__ +pybamm_cookie.__version__ ``` -## 🛠️ Contributing to `pybamm-cookiecutter` +## 🛠️ Contributing to `pybamm-cookie` -If you'd like to help us develop `pybamm-cookiecutter` by improving the template's features, writing documentation, or fixing embarrassing bugs, please have a look at these [guidelines](https://github.com/pybamm-team/pybamm-cookiecutter/blob/main/CONTRIBUTING.md). +If you'd like to help us develop `pybamm-cookie` by improving the template's features, writing documentation, or fixing embarrassing bugs, please have a look at these [guidelines](https://github.com/pybamm-team/pybamm-cookie/blob/main/CONTRIBUTING.md). ## 📫 Get in touch @@ -98,6 +98,6 @@ For any questions, comments, suggestions or bug reports, please see the ## 📃 License -The `pybamm-cookiecutter` project is open source code. For more information about its license, see [LICENSE](https://github.com/pybamm-team/pybamm-cookiecutter/blob/main/LICENSE). +The `pybamm-cookie` project is open source code. For more information about its license, see [LICENSE](https://github.com/pybamm-team/pybamm-cookie/blob/main/LICENSE). diff --git a/docs/conf.py b/docs/conf.py index 57b965c..682e06d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,9 +1,9 @@ import importlib.metadata -project = "pybamm-cookiecutter" +project = "pybamm-cookie" copyright = "2018-2023, The PyBaMM Team" author = "Agriya Khetarpal" -version = release = importlib.metadata.version("pybamm_cookiecutter") +version = release = importlib.metadata.version("pybamm_cookie") extensions = [ "myst_parser", diff --git a/docs/index.md b/docs/index.md index 200fe27..3913a18 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,4 +1,4 @@ -# pybamm-cookiecutter +# pybamm-cookie ```{toctree} :maxdepth: 2 diff --git a/noxfile.py b/noxfile.py index 721d245..1a98032 100644 --- a/noxfile.py +++ b/noxfile.py @@ -52,11 +52,11 @@ def run_coverage(session): session.install("setuptools", silent=False) session.install("coverage", silent=False) session.install("-e", ".[dev]", silent=False) - session.run("pytest", "--cov=src/pybamm_cookiecutter", "--cov-report=xml", "tests/") + session.run("pytest", "--cov=src/pybamm_cookie", "--cov-report=xml", "tests/") @nox.session(name="dev") def set_dev(session): - """Install pybamm-cookiecutter in editable mode""" + """Install pybamm-cookie in editable mode""" session.install("virtualenv") session.run("virtualenv", os.fsdecode(VENV_DIR), silent=True) python = os.fsdecode(VENV_DIR.joinpath("bin/python")) diff --git a/pyproject.toml b/pyproject.toml index bd36195..6a7e5b0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["hatchling", "hatch-vcs"] build-backend = "hatchling.build" [project] -name = "pybamm-cookiecutter" +name = "pybamm-cookie" authors = [ { name = "Agriya Khetarpal", email = "agriyakhetarpal@outlook.com" }, { name = "Santhosh Sundaram", email = "santhoshsundaram9650@gmail.com" }, @@ -57,31 +57,31 @@ docs = [ ] [project.scripts] -pybamm-cookiecutter = "pybamm_cookiecutter.cli:pybamm_cookiecutter_cli" +pybamm-cookie = "pybamm_cookie.cli:pybamm_cookie_cli" [project.entry-points."pipx.run"] -pybamm-cookiecutter = "pybamm_cookiecutter.cli:pybamm_cookiecutter_cli" +pybamm-cookie = "pybamm_cookie.cli:pybamm_cookie_cli" [project.urls] -Homepage = "https://github.com/pybamm-team/pybamm-cookiecutter" -"Bug Tracker" = "https://github.com/pybamm-team/pybamm-cookiecutter/issues" -Discussions = "https://github.com/pybamm-team/pybamm-cookiecutter/discussions" -Changelog = "https://github.com/pybamm-team/pybamm-cookiecutter/releases" +Homepage = "https://github.com/pybamm-team/pybamm-cookie" +"Bug Tracker" = "https://github.com/pybamm-team/pybamm-cookie/issues" +Discussions = "https://github.com/pybamm-team/pybamm-cookie/discussions" +Changelog = "https://github.com/pybamm-team/pybamm-cookie/releases" [tool.hatch] version.source = "vcs" -build.hooks.vcs.version-file = "src/pybamm_cookiecutter/_version.py" +build.hooks.vcs.version-file = "src/pybamm_cookie/_version.py" envs.default.dependencies = [ "pybamm", ] [tool.hatch.build.targets.wheel] -only-include = ["src/pybamm_cookiecutter", "/template", "copier.yml", "LICENSE", "LICENSES-bundled.txt"] +only-include = ["src/pybamm_cookie", "/template", "copier.yml", "LICENSE", "LICENSES-bundled.txt"] sources = ["src"] [tool.mypy] packages = [ - "src/pybamm_cookiecutter", + "src/pybamm_cookie", "tests" ] python_version = "3.11" @@ -100,7 +100,7 @@ allow_redefinition = true disable_error_code = ["call-overload", "operator"] [tool.coverage] -run.source = ["pybamm_cookiecutter"] +run.source = ["pybamm_cookie"] port.exclude_lines = [ 'pragma: no cover', ] diff --git a/src/pybamm_cookie/__init__.py b/src/pybamm_cookie/__init__.py new file mode 100644 index 0000000..f74ef5e --- /dev/null +++ b/src/pybamm_cookie/__init__.py @@ -0,0 +1,14 @@ +""" +Copyright (c) 2023 The PyBaMM Team. All rights reserved. + +pybamm-cookie: A template for creating battery modeling projects based on PyBaMM +""" +from __future__ import annotations + +from pybamm_cookie.cli import pybamm_cookie_cli +from pybamm_cookie._version import __version__ + +__all__ : list[str] = [ + "__version__", + "pybamm_cookie_cli", +] diff --git a/src/pybamm_cookie/__main__.py b/src/pybamm_cookie/__main__.py new file mode 100644 index 0000000..69b862c --- /dev/null +++ b/src/pybamm_cookie/__main__.py @@ -0,0 +1,4 @@ +if __name__ == "__main__": + from pybamm_cookie.cli import pybamm_cookie_cli + + pybamm_cookie_cli() diff --git a/src/pybamm_cookiecutter/cli.py b/src/pybamm_cookie/cli.py similarity index 84% rename from src/pybamm_cookiecutter/cli.py rename to src/pybamm_cookie/cli.py index 2891d32..4eac748 100644 --- a/src/pybamm_cookiecutter/cli.py +++ b/src/pybamm_cookie/cli.py @@ -7,7 +7,7 @@ project_root = Path(__file__).resolve().parent.parent TEMPLATE = str(project_root) -def pybamm_cookiecutter_cli(): +def pybamm_cookie_cli(): """ Command Line Interface (CLI) for generating PyBaMM based projects using copier. @@ -17,9 +17,9 @@ def pybamm_cookiecutter_cli(): Examples ------- - $ pybamm-cookiecutter + $ pybamm-cookie Generates a project in the current working directory of the terminal. - $ pybamm-cookiecutter --path /myproject + $ pybamm-cookie --path /myproject Generates a project in the `myproject` directory. """ try: @@ -31,11 +31,11 @@ def pybamm_cookiecutter_cli(): help = "The destination path for project generation. The default is the current working directory" ) - from pybamm_cookiecutter import __version__ as version + from pybamm_cookie import __version__ as version parser.add_argument( '--version', action='version', - version=f'PyBaMM Cookiecutter CLI Version - {version}' + version=f'pybamm-cookie CLI Version - {version}' ) parser.add_argument( @@ -53,8 +53,8 @@ def pybamm_cookiecutter_cli(): print(Fore.RED + "Execution stopped by the user" + Fore.RESET) except Exception as error: print(Fore.RED + "Error caused by an exception: " + Fore.RESET, error) - print(Fore.CYAN + "If you are unsure what the error is, feel free to open an issue at" + Fore.YELLOW +" - https://github.com/pybamm-team/pybamm-cookiecutter/issues" + Fore.RESET) + print(Fore.CYAN + "If you are unsure what the error is, feel free to open an issue at" + Fore.YELLOW +" - https://github.com/pybamm-team/pybamm-cookie/issues" + Fore.RESET) if __name__ == '__main__': - pybamm_cookiecutter_cli() + pybamm_cookie_cli() diff --git a/src/pybamm_cookiecutter/py.typed b/src/pybamm_cookie/py.typed similarity index 100% rename from src/pybamm_cookiecutter/py.typed rename to src/pybamm_cookie/py.typed diff --git a/src/pybamm_cookiecutter/version.pyi b/src/pybamm_cookie/version.pyi similarity index 100% rename from src/pybamm_cookiecutter/version.pyi rename to src/pybamm_cookie/version.pyi diff --git a/src/pybamm_cookiecutter/__init__.py b/src/pybamm_cookiecutter/__init__.py deleted file mode 100644 index aca1fa6..0000000 --- a/src/pybamm_cookiecutter/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -""" -Copyright (c) 2023 The PyBaMM Team. All rights reserved. - -pybamm-cookiecutter: A template for creating battery modeling projects based on PyBaMM -""" -from __future__ import annotations - -from pybamm_cookiecutter.cli import pybamm_cookiecutter_cli -from pybamm_cookiecutter._version import __version__ - -__all__ : list[str] = [ - "__version__", - "pybamm_cookiecutter_cli", -] diff --git a/src/pybamm_cookiecutter/__main__.py b/src/pybamm_cookiecutter/__main__.py deleted file mode 100644 index 36ef9ca..0000000 --- a/src/pybamm_cookiecutter/__main__.py +++ /dev/null @@ -1,4 +0,0 @@ -if __name__ == "__main__": - from pybamm_cookiecutter.cli import pybamm_cookiecutter_cli - - pybamm_cookiecutter_cli() diff --git a/template/{{ project_name }}/noxfile.py.jinja b/template/{{ project_name }}/noxfile.py.jinja index e6b4b11..8541438 100644 --- a/template/{{ project_name }}/noxfile.py.jinja +++ b/template/{{ project_name }}/noxfile.py.jinja @@ -62,7 +62,7 @@ def run_coverage(session): @nox.session(name="dev") def set_dev(session): - """Install pybamm-cookiecutter in editable mode""" + """Install pybamm-cookie in editable mode""" session.install("virtualenv") session.run("virtualenv", os.fsdecode(VENV_DIR), silent=True) python = os.fsdecode(VENV_DIR.joinpath("bin/python")) diff --git a/template/{{ project_name }}/src/{{project_slug}}/entry_point.py.jinja b/template/{{ project_name }}/src/{{project_slug}}/entry_point.py.jinja index c23243c..52a4c1e 100644 --- a/template/{{ project_name }}/src/{{project_slug}}/entry_point.py.jinja +++ b/template/{{ project_name }}/src/{{project_slug}}/entry_point.py.jinja @@ -39,7 +39,7 @@ from typing import Callable class EntryPoint(Mapping): """ - Dict-like interface for accessing parameter sets and models through entry points in cookiecutter template. + Dict-like interface for accessing parameter sets and models through entry points in copier template. Access via :py:data:`{{project_slug}}.parameter_sets` for parameter_sets Access via :py:data:`{{project_slug}}.Model` for Models diff --git a/template/{{ project_name }}/{% if ci == 'github' %}.github{% endif %}/workflows/test_on_push.yml b/template/{{ project_name }}/{% if ci == 'github' %}.github{% endif %}/workflows/test_on_push.yml index a3b6d6e..1faf0fa 100644 --- a/template/{{ project_name }}/{% if ci == 'github' %}.github{% endif %}/workflows/test_on_push.yml +++ b/template/{{ project_name }}/{% if ci == 'github' %}.github{% endif %}/workflows/test_on_push.yml @@ -33,7 +33,7 @@ jobs: name: Template Generation/Project Tests (${{ matrix.os }} / Python ${{ matrix.python-version }}) steps: - - name: Checkout pybamm-cookiecutter + - name: Checkout pybamm-cookie uses: actions/checkout@v4 with: fetch-depth: 0 @@ -74,7 +74,7 @@ jobs: name: Doctests (ubuntu-latest / Python 3.12) steps: - - name: Check out pybamm-cookiecutter repository + - name: Check out pybamm-cookie repository uses: actions/checkout@v4 - name: Set up Python diff --git a/tests/template_tests/test_project_generation.py b/tests/template_tests/test_project_generation.py index 8bcec51..143ac07 100644 --- a/tests/template_tests/test_project_generation.py +++ b/tests/template_tests/test_project_generation.py @@ -1,4 +1,4 @@ -import pybamm_cookiecutter as m +import pybamm_cookie as m import pytest import os import subprocess @@ -29,7 +29,7 @@ def test_template_with_extra_answers(copie): # codespell:ignore copie "project_name": "test-bake-project", "email": "pybamm@pybamm.org", "project_slug": "pybamm_cookie", - "project_short_description": "This is an example pybamm cookiecutter template", + "project_short_description": "This is an example pybamm-cookie template", "url": "pybamm.org", } result = copie.copy(extra_answers=extra_context) # codespell:ignore copie @@ -45,6 +45,6 @@ def test_cli(): Testing if the CLI works and returns a successful exit code on execution """ os.mkdir("testcli") - return_code = subprocess.run(["pybamm-cookiecutter", "--defaults"], cwd = "./testcli") + return_code = subprocess.run(["pybamm-cookie", "--defaults"], cwd = "./testcli") shutil.rmtree("testcli") assert return_code