Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added parameter entry points #15

Merged
merged 10 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2023, PyBaMM Team
Copyright (c) 2024, PyBaMM Team

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
7 changes: 7 additions & 0 deletions LICENSES-bundled.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This project and source distributions bundle several libraries that are
compatibly licensed.


Name: PyBaMM
agriyakhetarpal marked this conversation as resolved.
Show resolved Hide resolved
Files: src/pybamm_cookiecutter/parameters/*
License: BSD-3-Clause
12 changes: 12 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import nox
from pathlib import Path
import os

# Options to modify nox behaviour
nox.options.default_venv_backend = "uv|virtualenv"
nox.options.reuse_existing_virtualenvs = True

VENV_DIR = Path("./venv").resolve()

@nox.session(name="docs")
arjxn-py marked this conversation as resolved.
Show resolved Hide resolved
def build_docs(session: nox.Session) -> None:
"""Build the documentation and load it in a browser tab, rebuilding on changes."""
Expand All @@ -26,3 +30,11 @@ def run_template_generation(session):
session.install("setuptools", silent=False)
session.install("-e", ".[dev]", silent=False)
session.run("pytest", "tests")

@nox.session(name="dev")
arjxn-py marked this conversation as resolved.
Show resolved Hide resolved
def set_dev(session):
"""Install pybamm-cookiecutter in editable mode"""
session.install("virtualenv")
session.run("virtualenv", os.fsdecode(VENV_DIR), silent=True)
python = os.fsdecode(VENV_DIR.joinpath("bin/python"))
session.run(python, "-m", "pip", "install", "-e", ".[dev]")
santacodes marked this conversation as resolved.
Show resolved Hide resolved
68 changes: 41 additions & 27 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ Homepage = "https://github.com/pybamm-team/pybamm-cookiecutter"
Discussions = "https://github.com/pybamm-team/pybamm-cookiecutter/discussions"
Changelog = "https://github.com/pybamm-team/pybamm-cookiecutter/releases"

[project.entry-points."cookie_parameter_sets"]
Chen2020 = "pybamm_cookiecutter.parameters.input.Chen2020:get_parameter_values"

[tool.hatch]
version.source = "vcs"
build.hooks.vcs.version-file = "src/pybamm_cookiecutter/_version.py"
Expand All @@ -73,8 +76,8 @@ packages = [
"src/pybamm_cookiecutter",
"tests"
]
python_version = "3.8"
strict = true
python_version = "3.11"
strict = false
warn_return_any = false
show_error_codes = true
enable_error_code = [
Expand All @@ -84,6 +87,9 @@ enable_error_code = [
]
disallow_untyped_defs = false
disallow_untyped_calls = false
ignore_missing_imports = true
allow_redefinition = true
disable_error_code = ["call-overload", "operator"]

[tool.coverage]
run.source = ["pybamm_cookiecutter"]
Expand All @@ -92,32 +98,40 @@ port.exclude_lines = [
]

[tool.ruff]
select = [
"E", "F", "W", # flake8
"B", # flake8-bugbear
"I", # isort
"ARG", # flake8-unused-arguments
"C4", # flake8-comprehensions
"EM", # flake8-errmsg
"ICN", # flake8-import-conventions
"ISC", # flake8-implicit-str-concat
"G", # flake8-logging-format
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PL", # pylint
"PT", # flake8-pytest-style
"PTH", # flake8-use-pathlib
"RET", # flake8-return
"RUF", # Ruff-specific
"SIM", # flake8-simplify
"T20", # flake8-print
"UP", # pyupgrade
"YTT", # flake8-2020
"EXE", # flake8-executable
"NPY", # NumPy specific rules
"PD", # pandas-vet
]
extend-include = ["*.ipynb"]
extend-exclude = ["__init__.py"]
src = ["src"]
exclude = []
isort.required-imports = ["from __future__ import annotations"]
flake8-unused-arguments.ignore-variadic-names = true


[tool.ruff.lint]
extend-select = [
"B", # flake8-bugbear
"RUF", # Ruff-specific
"UP", # pyupgrade
"YTT", # flake8-2020
"TID252", # relative-imports
]
ignore = [
"E741", # Ambiguous variable name
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
"SIM108", # Use ternary operator
"ARG001", # Unused function argument:
"ARG002", # Unused method arguments
"PLR2004", # Magic value used in comparison
"PLR0915", # Too many statements
"PLR0913", # Too many arguments
"PLR0912", # Too many branches
"RET504", # Unnecessary assignment
"RET505", # Unnecessary `else`
"RET506", # Unnecessary `elif`
"B018", # Found useless expression
"RUF002", # Docstring contains ambiguous
"UP007", # For pyupgrade
]

[tool.ruff.lint.per-file-ignores]
"tests/*" = ["T20"]
"docs/*" = ["T20"]
2 changes: 2 additions & 0 deletions src/pybamm_cookiecutter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
import pybamm

from ._version import version as __version__
from .parameters.parameter_sets import parameter_sets

__all__ : list[str] = [
"__version__",
"pybamm",
"parameter_sets",
]
3 changes: 3 additions & 0 deletions src/pybamm_cookiecutter/parameters/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from __future__ import annotations

__all__ = ["parameter_sets",]
Loading
Loading