Name | pybamm-cookie JSON |
Version |
0.1.2
JSON |
| download |
home_page | None |
Summary | A template for creating battery modeling projects based on PyBaMM |
upload_time | 2024-09-09 14:06:20 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | None |
keywords |
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# pybamm-cookie
<!-- TODO: configure badges -->
<!-- [![Actions Status][actions-badge]][actions-link]
[![Documentation Status][rtd-badge]][rtd-link]
[![PyPI version][pypi-version]][pypi-link]
[![Conda-Forge][conda-badge]][conda-link]
[![PyPI platforms][pypi-platforms]][pypi-link]
[![GitHub Discussions][github-discussions-badge]][github-discussions-link]
[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-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 -->

<!-- SPHINX-START -->
[](http://numfocus.org)
[](https://github.com/copier-org/copier)
[](https://github.com/pybamm-team/pybamm-cookie)
[](https://pypi.org/project/pybamm-cookie/)
[](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-cookie/blob/main/LICENSE). Currently under active development.
## π Using `pybamm-cookie`
### Generating projects with `pybamm-cookie`
#### Manually using copier
Install `copier` and `jinja2_time` extension using `pip`.
```bash
pip install copier jinja2-time
```
Generate a project from the `pybamm-cookie` template.
```bash
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-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-cookie --path /path_to_copy_to
```
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-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-cookie --path /path_to_copy_to
```
#### Using pip/pip inside venv
You can also perform a normal `pip` installation for the `pybamm-cookie` CLI and generate a project.
```bash
pip install pybamm-cookie
pybamm-cookie
```
Copier will prompt you with various configurations and you may choose the ones that suit your use case.
Additionally you can perform `pybamm-cookie -h` to know the list of actions you can perform with the CLI.
> [!NOTE]
> A `git` repository is automatically initialised when a project is created within a directory. To push the contents to the upstream GitHub repository, create a GitHub repository with the same name as your local repository and do not initialise your GitHub repository with any files such as licenses or README which might conflict with the local repository, follow these steps as listed in the [GitHub documentation](https://docs.github.com/en/migrations/importing-source-code/using-the-command-line-to-import-source-code/adding-locally-hosted-code-to-github#adding-a-local-repository-to-github-using-git).
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-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:
`nox -s dev`
or
`pip install -e .[dev]`
To check if the project was successfully installed, import the project inside Python.
```python
import pybamm_cookie
pybamm_cookie.__version__
```
### Project Layout
```bash
.
βββ .github
βΒ Β βββ workflows
βββ docs
βΒ Β βββ _static
βββ src
βΒ Β βββ pybamm_example_project
βΒ Β βββ models
βΒ Β βΒ Β βββ input
βΒ Β ββ parameters
βΒ Β Β Β βββ input
βββ tests
β βββ generated_project_tests
β βββ user_tests
ββ noxfile.py
ββ pyproject.toml
```
A basic generated project with `pybamm-cookie` has a directory structure like the one depicted above. Each directory has a special purpose and is highly recommended to use them for their specific purposes to avoid any errors.
- `docs/` contains the basic configuration for building documentation using [sphinx](https://www.sphinx-doc.org/).
- `src/` contains the main package files under a directory with your specified project name. This is where all your code should be written.
- `models/input/` - Contains the source code for battery models. Refer [PyBaMM models](https://docs.pybamm.org/en/latest/source/api/models/index.html) to learn how to write your own battery models.
- `parameters/input/` - Contains the source code for parameters sets. Refer [PyBaMM parameter sets](https://docs.pybamm.org/en/stable/source/api/parameters/parameter_sets.html) to learn more on parameter sets.
- `tests/` The tests directory contains two sub-directories -
- `generated_project_tests/` - Contains pre-defined tests for verifying if the units inside generated project work well. It can be verified using `nox -s generated-project-tests` or `pytest tests/generated_project_tests` command.
- `user_tests/` - This directory contains all the user written tests, the example tests can be copied and modified as per your own needs. We suggest you use [pytest](https://docs.pytest.org/en/stable/) to write tests. The tests can be then run by executing `nox -s user-tests` or `pytest tests/user_tests`.
- `noxfile.py` contains basic `nox sessions` for building documentation and runnings tests.
- `pyproject.toml` has project metadata and build backend configurations.
- `github/workflows/` has all the basic CI configurations to automate tests and builds on [GitHub Actions](https://github.com/features/actions).
## π Motivation
This project aims to enhance the usability of PyBaMM for both newcomers and experienced users alike by providing standardised templates that incorporate best practices and automation tools. The `pybamm-cookie` template is set to lower the barrier to battery modeling, making it easier for the research community to adopt PyBaMM for their battery modeling projects. The project also supports model entry points and parameter set entry points, allowing community contributors to create and share models/parameter sets of their repositories using the copier template without directly adding them upstream. This lets community contributors retain ownership and choose license terms and also grants flexibility to the PyBaMM team in supporting models. Support for all of GitHubβs functionality and infrastructure is contained within the template.
## π οΈ Contributing to `pybamm-cookie`
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
For any questions, comments, suggestions or bug reports, please see the
[contact page](https://www.pybamm.org/community).
## π 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).
## β¨ Credits
This project is highly inspired by these two projects -
- [SciCookie](https://github.com/osl-incubator/scicookie), a cookiecutter template developed by [Open Science Labs](https://opensciencelabs.org/) to provide a boilerplate to generate Python based projects with a hassle free experience.
- [scientific-python/cookie](https://github.com/scientific-python/cookie), a project that supports copier/cookiecutter/cruft template generation for new Python projects based on Scientific Python developer guide.
<!-- SPHINX-END -->
Raw data
{
"_id": null,
"home_page": null,
"name": "pybamm-cookie",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "PyBaMM Team <pybamm@pybamm.org>",
"keywords": null,
"author": null,
"author_email": "Agriya Khetarpal <agriyakhetarpal@outlook.com>, Santhosh Sundaram <santhoshsundaram9650@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/d5/ef/3280f0fe5fa42bd47a16badf6a5a383fcdbaa9677b8893ae2f353e2cc7b1/pybamm_cookie-0.1.2.tar.gz",
"platform": null,
"description": "# pybamm-cookie\n\n<!-- TODO: configure badges -->\n\n<!-- [![Actions Status][actions-badge]][actions-link]\n[![Documentation Status][rtd-badge]][rtd-link]\n\n[![PyPI version][pypi-version]][pypi-link]\n[![Conda-Forge][conda-badge]][conda-link]\n[![PyPI platforms][pypi-platforms]][pypi-link]\n\n[![GitHub Discussions][github-discussions-badge]][github-discussions-link]\n\n[actions-badge]: https://github.com/pybamm-team/pybamm-cookie/workflows/CI/badge.svg\n[actions-link]: https://github.com/pybamm-team/pybamm-cookie/actions\n[conda-badge]: https://img.shields.io/conda/vn/conda-forge/pybamm-cookie\n[conda-link]: https://github.com/conda-forge/pybamm-cookie-feedstock\n[github-discussions-badge]: https://img.shields.io/static/v1?label=Discussions&message=Ask&color=blue&logo=github\n[github-discussions-link]: https://github.com/pybamm-team/pybamm-cookie/discussions\n[pypi-link]: https://pypi.org/project/pybamm-cookie/\n[pypi-platforms]: https://img.shields.io/pypi/pyversions/pybamm-cookie\n[pypi-version]: https://img.shields.io/pypi/v/pybamm-cookie\n[rtd-badge]: https://readthedocs.org/projects/pybamm-cookie/badge/?version=latest\n[rtd-link]: https://pybamm-cookie.readthedocs.io/en/latest/?badge=latest -->\n\n\n<!-- SPHINX-START -->\n[](http://numfocus.org)\n[](https://github.com/copier-org/copier)\n[](https://github.com/pybamm-team/pybamm-cookie)\n[](https://pypi.org/project/pybamm-cookie/)\n[](https://github.com/pybamm-team/pybamm-cookie/actions/workflows/test_on_push.yml)\n\nThis 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.\n\n## \ud83d\udcc4 Using `pybamm-cookie`\n\n### Generating projects with `pybamm-cookie`\n\n#### Manually using copier\n\nInstall `copier` and `jinja2_time` extension using `pip`.\n```bash\npip install copier jinja2-time\n```\nGenerate a project from the `pybamm-cookie` template.\n\n```bash\ncopier copy https://github.com/pybamm-team/pybamm-cookie.git . --trust\n# this will generate the project in the current working directory\ncopier copy https://github.com/pybamm-team/pybamm-cookie.git path_to_copy_to/ --trust\n# this will generate the project in the specified path\n```\n#### Using pipx (recommended)\n\nYou can generate a project by executing the `pipx run` command which doesn't need any package installations.\n```bash\npipx run pybamm-cookie --path /path_to_copy_to\n```\n\nOr if you wish to install the `pybamm-cookie` package and then generate a project, you could do so with the help of following commands.\n```bash\npipx install pybamm-cookie # or pip install pybamm-cookie\n```\nNavigate 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.\n```bash\npybamm-cookie --path /path_to_copy_to\n```\n#### Using pip/pip inside venv\n\nYou can also perform a normal `pip` installation for the `pybamm-cookie` CLI and generate a project.\n```bash\npip install pybamm-cookie\npybamm-cookie\n```\n\nCopier will prompt you with various configurations and you may choose the ones that suit your use case.\nAdditionally you can perform `pybamm-cookie -h` to know the list of actions you can perform with the CLI.\n\n> [!NOTE]\n> A `git` repository is automatically initialised when a project is created within a directory. To push the contents to the upstream GitHub repository, create a GitHub repository with the same name as your local repository and do not initialise your GitHub repository with any files such as licenses or README which might conflict with the local repository, follow these steps as listed in the [GitHub documentation](https://docs.github.com/en/migrations/importing-source-code/using-the-command-line-to-import-source-code/adding-locally-hosted-code-to-github#adding-a-local-repository-to-github-using-git).\n\nAfter 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.\n\n### Installing the `pybamm-cookie` project\n\nThis 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.\nTo install, navigate to the root directory of this repository and execute either of these commands:\n\n`nox -s dev`\nor\n`pip install -e .[dev]`\n\nTo check if the project was successfully installed, import the project inside Python.\n\n```python\nimport pybamm_cookie\n\npybamm_cookie.__version__\n```\n### Project Layout\n```bash\n.\n\u251c\u2500\u2500 .github\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 workflows\n\u251c\u2500\u2500 docs\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 _static\n\u251c\u2500\u2500 src\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 pybamm_example_project\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 models\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 input\n\u2502\u00a0\u00a0 \u2514\u2500 parameters\n\u2502\u00a0\u00a0 \u00a0\u00a0 \u2514\u2500\u2500 input\n\u251c\u2500\u2500 tests\n\u2502 \u251c\u2500\u2500 generated_project_tests\n\u2502 \u2514\u2500\u2500 user_tests\n\u251c\u2500 noxfile.py\n\u2514\u2500 pyproject.toml\n```\nA basic generated project with `pybamm-cookie` has a directory structure like the one depicted above. Each directory has a special purpose and is highly recommended to use them for their specific purposes to avoid any errors.\n- `docs/` contains the basic configuration for building documentation using [sphinx](https://www.sphinx-doc.org/).\n- `src/` contains the main package files under a directory with your specified project name. This is where all your code should be written.\n - `models/input/` - Contains the source code for battery models. Refer [PyBaMM models](https://docs.pybamm.org/en/latest/source/api/models/index.html) to learn how to write your own battery models.\n - `parameters/input/` - Contains the source code for parameters sets. Refer [PyBaMM parameter sets](https://docs.pybamm.org/en/stable/source/api/parameters/parameter_sets.html) to learn more on parameter sets.\n- `tests/` The tests directory contains two sub-directories -\n - `generated_project_tests/` - Contains pre-defined tests for verifying if the units inside generated project work well. It can be verified using `nox -s generated-project-tests` or `pytest tests/generated_project_tests` command.\n - `user_tests/` - This directory contains all the user written tests, the example tests can be copied and modified as per your own needs. We suggest you use [pytest](https://docs.pytest.org/en/stable/) to write tests. The tests can be then run by executing `nox -s user-tests` or `pytest tests/user_tests`.\n- `noxfile.py` contains basic `nox sessions` for building documentation and runnings tests.\n- `pyproject.toml` has project metadata and build backend configurations.\n- `github/workflows/` has all the basic CI configurations to automate tests and builds on [GitHub Actions](https://github.com/features/actions).\n\n## \ud83d\ude80 Motivation\n\nThis project aims to enhance the usability of PyBaMM for both newcomers and experienced users alike by providing standardised templates that incorporate best practices and automation tools. The `pybamm-cookie` template is set to lower the barrier to battery modeling, making it easier for the research community to adopt PyBaMM for their battery modeling projects. The project also supports model entry points and parameter set entry points, allowing community contributors to create and share models/parameter sets of their repositories using the copier template without directly adding them upstream. This lets community contributors retain ownership and choose license terms and also grants flexibility to the PyBaMM team in supporting models. Support for all of GitHub\u2019s functionality and infrastructure is contained within the template.\n\n## \ud83d\udee0\ufe0f Contributing to `pybamm-cookie`\n\nIf 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).\n\n## \ud83d\udceb Get in touch\n\nFor any questions, comments, suggestions or bug reports, please see the\n[contact page](https://www.pybamm.org/community).\n\n## \ud83d\udcc3 License\n\nThe `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).\n\n## \u2728 Credits\nThis project is highly inspired by these two projects -\n- [SciCookie](https://github.com/osl-incubator/scicookie), a cookiecutter template developed by [Open Science Labs](https://opensciencelabs.org/) to provide a boilerplate to generate Python based projects with a hassle free experience.\n- [scientific-python/cookie](https://github.com/scientific-python/cookie), a project that supports copier/cookiecutter/cruft template generation for new Python projects based on Scientific Python developer guide.\n<!-- SPHINX-END -->\n",
"bugtrack_url": null,
"license": null,
"summary": "A template for creating battery modeling projects based on PyBaMM",
"version": "0.1.2",
"project_urls": {
"Bug Tracker": "https://github.com/pybamm-team/pybamm-cookie/issues",
"Changelog": "https://github.com/pybamm-team/pybamm-cookie/releases",
"Discussions": "https://github.com/pybamm-team/pybamm-cookie/discussions",
"Homepage": "https://github.com/pybamm-team/pybamm-cookie"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f95355e1ee4ca7ccb09a57ab1c3d2062099a6aa72930f840aae450ce96edc7fa",
"md5": "49998a619788b623f83d30ff475452dd",
"sha256": "61fd34b457f1fe29b752e9506120df34412e1b766b026308cc810b005563583f"
},
"downloads": -1,
"filename": "pybamm_cookie-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "49998a619788b623f83d30ff475452dd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 45852,
"upload_time": "2024-09-09T14:06:18",
"upload_time_iso_8601": "2024-09-09T14:06:18.427158Z",
"url": "https://files.pythonhosted.org/packages/f9/53/55e1ee4ca7ccb09a57ab1c3d2062099a6aa72930f840aae450ce96edc7fa/pybamm_cookie-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d5ef3280f0fe5fa42bd47a16badf6a5a383fcdbaa9677b8893ae2f353e2cc7b1",
"md5": "3d20749602e7dde94bc733272c4b7049",
"sha256": "0cfc25e6d7edfb8909a7da1ae28c67fd9a36191c212e27e2bd6aeb82e44755aa"
},
"downloads": -1,
"filename": "pybamm_cookie-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "3d20749602e7dde94bc733272c4b7049",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 507053,
"upload_time": "2024-09-09T14:06:20",
"upload_time_iso_8601": "2024-09-09T14:06:20.016390Z",
"url": "https://files.pythonhosted.org/packages/d5/ef/3280f0fe5fa42bd47a16badf6a5a383fcdbaa9677b8893ae2f353e2cc7b1/pybamm_cookie-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-09 14:06:20",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pybamm-team",
"github_project": "pybamm-cookie",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pybamm-cookie"
}