Skip to content

Commit aef1945

Browse files
Merge pull request #2 from pybamm-team/licenses
Initial draft for a `cookiecutter` template (licenses and folder structure)
2 parents 942a284 + b518474 commit aef1945

21 files changed

+956
-0
lines changed

.readthedocs.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Read the Docs configuration file
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
4+
5+
version: 2
6+
7+
build:
8+
os: ubuntu-22.04
9+
tools:
10+
python: "3.11"
11+
jobs:
12+
post_checkout:
13+
- git fetch --unshallow
14+
15+
sphinx:
16+
configuration: docs/conf.py
17+
18+
python:
19+
install:
20+
- method: pip
21+
path: .
22+
extra_requirements:
23+
- docs
24+
25+
formats:
26+
- pdf
27+
- epub
28+
- htmlzip

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
11
# pybamm-cookiecutter
22

3+
<!-- TODO: configure badges -->
4+
5+
<!-- [![Actions Status][actions-badge]][actions-link]
6+
[![Documentation Status][rtd-badge]][rtd-link]
7+
8+
[![PyPI version][pypi-version]][pypi-link]
9+
[![Conda-Forge][conda-badge]][conda-link]
10+
[![PyPI platforms][pypi-platforms]][pypi-link]
11+
12+
[![GitHub Discussions][github-discussions-badge]][github-discussions-link]
13+
14+
[actions-badge]: https://github.com/pybamm-team/pybamm-cookiecutter/workflows/CI/badge.svg
15+
[actions-link]: https://github.com/pybamm-team/pybamm-cookiecutter/actions
16+
[conda-badge]: https://img.shields.io/conda/vn/conda-forge/pybamm-cookiecutter
17+
[conda-link]: https://github.com/conda-forge/pybamm-cookiecutter-feedstock
18+
[github-discussions-badge]: https://img.shields.io/static/v1?label=Discussions&message=Ask&color=blue&logo=github
19+
[github-discussions-link]: https://github.com/pybamm-team/pybamm-cookiecutter/discussions
20+
[pypi-link]: https://pypi.org/project/pybamm-cookiecutter/
21+
[pypi-platforms]: https://img.shields.io/pypi/pyversions/pybamm-cookiecutter
22+
[pypi-version]: https://img.shields.io/pypi/v/pybamm-cookiecutter
23+
[rtd-badge]: https://readthedocs.org/projects/pybamm-cookiecutter/badge/?version=latest
24+
[rtd-link]: https://pybamm-cookiecutter.readthedocs.io/en/latest/?badge=latest -->
25+
326
This repository contains a `cookiecutter` template for battery modeling projects using PyBaMM, released under the [BSD-3-Clause license](LICENSE). Currently under active development.

cookiecutter.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"project_name": "pybamm-example-project",
3+
"platform": [
4+
"github",
5+
"gitlab"
6+
],
7+
"org": "pybamm-team",
8+
"url": "https://{{ cookiecutter.platform }}.com/{{ cookiecutter.org }}/{{ cookiecutter.project_name }}",
9+
"full_name": "John Doe",
10+
"email": "[email protected]",
11+
"project_short_description": "A template for creating battery modeling projects based on PyBaMM",
12+
"license": [
13+
"BSD",
14+
"Apache",
15+
"MIT"
16+
],
17+
"backend": [
18+
"hatch"
19+
],
20+
"__year": "{% now 'utc', '%Y' %}",
21+
"__project_slug": "{{ cookiecutter.project_name | lower | replace('-', '_') | replace('.', '_') }}",
22+
"__type": "{{ 'pure' }}",
23+
"__answers": "",
24+
"__ci": "{{ cookiecutter.platform }}",
25+
"__prompts__": {
26+
"project_name": "The name of your project",
27+
"platform": {
28+
"__prompt__": "The platform you are using to host your project",
29+
"github": "GitHub",
30+
"gitlab": "GitLab"
31+
},
32+
"org": "The name of your organisation (or username, if you are not part of an organisation)",
33+
"url": "The URL to your repository",
34+
"full_name": "Your name",
35+
"email": "Your email",
36+
"project_short_description": "A short description of your project",
37+
"license": "Select a license",
38+
"backend": {
39+
"__prompt__": "Choose a build backend",
40+
"hatch": "Hatchling (recommended for pure Python projects)"
41+
}
42+
}
43+
}

docs/conf.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import importlib.metadata
2+
3+
project = "pybamm-cookiecutter"
4+
copyright = "2023, Agriya Khetarpal"
5+
author = "Agriya Khetarpal"
6+
version = release = importlib.metadata.version("pybamm_cookiecutter")
7+
8+
extensions = [
9+
"myst_parser",
10+
"sphinx.ext.autodoc",
11+
"sphinx.ext.intersphinx",
12+
"sphinx.ext.mathjax",
13+
"sphinx.ext.napoleon",
14+
"sphinx_copybutton",
15+
"sphinx_inline_tabs",
16+
"pydata_sphinx_theme",
17+
"hoverxref.extension",
18+
"nbsphinx",
19+
]
20+
21+
source_suffix = [".rst", ".md"]
22+
exclude_patterns = [
23+
"_build",
24+
"**.ipynb_checkpoints",
25+
"Thumbs.db",
26+
".DS_Store",
27+
".env",
28+
".venv",
29+
]
30+
31+
html_theme = "pydata_sphinx_theme"
32+
33+
myst_enable_extensions = [
34+
"colon_fence",
35+
]
36+
37+
intersphinx_mapping = {
38+
"python": ("https://docs.python.org/3", None),
39+
"numpy": ("https://numpy.org/doc/stable/", None),
40+
"scipy": ("https://docs.scipy.org/doc/scipy/reference", None),
41+
"matplotlib": ("https://matplotlib.org/stable", None),
42+
"pybamm": ("https://docs.pybamm.org/en/latest/", None),
43+
}
44+
45+
always_document_param_types = True

docs/index.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# pybamm-cookiecutter
2+
3+
```{toctree}
4+
:maxdepth: 2
5+
:hidden:
6+
7+
```
8+
9+
```{include} ../README.md
10+
:start-after: <!-- SPHINX-START -->
11+
```
12+
13+
## Indices and tables
14+
15+
- {ref}`genindex`
16+
- {ref}`modindex`
17+
- {ref}`search`

pyproject.toml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "pybamm-cookiecutter"
7+
authors = [
8+
{ name = "Agriya Khetarpal", email = "[email protected]" },
9+
]
10+
maintainers = [
11+
{ name = "PyBaMM Team", email = "[email protected]" },
12+
]
13+
description = "A template for creating battery modeling projects based on PyBaMM"
14+
readme = "README.md"
15+
requires-python = ">=3.8" # PyBaMM supports 3.8 and above
16+
classifiers = [
17+
"Development Status :: 1 - Planning",
18+
"Intended Audience :: Science/Research",
19+
"Intended Audience :: Developers",
20+
"License :: OSI Approved :: BSD License",
21+
"Operating System :: OS Independent",
22+
"Programming Language :: Python",
23+
"Programming Language :: Python :: 3",
24+
"Programming Language :: Python :: 3 :: Only",
25+
"Programming Language :: Python :: 3.8",
26+
"Programming Language :: Python :: 3.9",
27+
"Programming Language :: Python :: 3.10",
28+
"Programming Language :: Python :: 3.11", # PyBaMM supports >=3.8,<3.12
29+
"Topic :: Scientific/Engineering",
30+
]
31+
dynamic = ["version"]
32+
dependencies = ["pybamm"]
33+
34+
[project.optional-dependencies]
35+
dev = [
36+
"pytest >=6",
37+
"pytest-cov >=3",
38+
]
39+
docs = [
40+
"sphinx",
41+
"myst_parser",
42+
"sphinx_copybutton",
43+
"pydata_sphinx_theme",
44+
]
45+
46+
[project.urls]
47+
Homepage = "https://github.com/pybamm-team/pybamm-cookiecutter"
48+
"Bug Tracker" = "https://github.com/pybamm-team/pybamm-cookiecutter/issues"
49+
Discussions = "https://github.com/pybamm-team/pybamm-cookiecutter/discussions"
50+
Changelog = "https://github.com/pybamm-team/pybamm-cookiecutter/releases"
51+
52+
[tool.hatch]
53+
version.path = "src/pybamm_cookiecutter/__init__.py"
54+
envs.default.dependencies = [
55+
"pybamm",
56+
]
57+
58+
[tool.coverage]
59+
run.source = ["pybamm_cookiecutter"]
60+
port.exclude_lines = [
61+
'pragma: no cover',
62+
]
63+
64+
[tool.ruff]
65+
select = [
66+
"E", "F", "W", # flake8
67+
"B", # flake8-bugbear
68+
"I", # isort
69+
"ARG", # flake8-unused-arguments
70+
"C4", # flake8-comprehensions
71+
"EM", # flake8-errmsg
72+
"ICN", # flake8-import-conventions
73+
"ISC", # flake8-implicit-str-concat
74+
"G", # flake8-logging-format
75+
"PGH", # pygrep-hooks
76+
"PIE", # flake8-pie
77+
"PL", # pylint
78+
"PT", # flake8-pytest-style
79+
"PTH", # flake8-use-pathlib
80+
"RET", # flake8-return
81+
"RUF", # Ruff-specific
82+
"SIM", # flake8-simplify
83+
"T20", # flake8-print
84+
"UP", # pyupgrade
85+
"YTT", # flake8-2020
86+
"EXE", # flake8-executable
87+
"NPY", # NumPy specific rules
88+
"PD", # pandas-vet
89+
]
90+
extend-ignore = [
91+
"PLR", # Design related pylint codes
92+
"E501", # Line too long
93+
]
94+
src = ["src"]
95+
unfixable = [
96+
"T20", # Removes print statements
97+
"F841", # Removes unused variables
98+
]
99+
exclude = []
100+
flake8-unused-arguments.ignore-variadic-names = true
101+
102+
[tool.ruff.per-file-ignores]
103+
"tests/**" = ["T20"]
104+
"noxfile.py" = ["T20"]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"""
2+
Copyright (c) 2023 Agriya Khetarpal. All rights reserved.
3+
4+
pybamm-cookiecutter: A template for creating battery modeling projects based on PyBaMM
5+
"""
6+
7+
8+
__version__ = "0.0.1"
9+
10+
__all__ = ("__version__",)

tests/test_package.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import pybamm_cookiecutter as m
2+
3+
4+
def test_version():
5+
assert m.__version__

0 commit comments

Comments
 (0)