Skip to content

Commit

Permalink
Switch to hatchling backend (#4747)
Browse files Browse the repository at this point in the history
* build: switch to hatchling backend with hatch-vcs

- Replace setuptools with hatchling as build backend
- Add hatch-vcs for Git tag-based versioning
- Unify package versioning under a single source

* switch to hatchling without VCS integration

- Replace setuptools with hatchling as build backend
- Remove setuptools configurations
- Revert to version 24.11.2

* switch to hatch with automatic file handling

- Replace setuptools with hatch as build backend
- Remove setuptools configurations
- Add automatic file handling in hatch config

* build: switch to hatchling backend with hatch-vcs

- Replace setuptools with hatchling as build backend
- Add hatch-vcs for Git tag-based versioning
- Unify package versioning under a single source

* switch to hatchling without VCS integration

- Replace setuptools with hatchling as build backend
- Remove setuptools configurations
- Revert to version 24.11.2

* switch to hatch with automatic file handling

- Replace setuptools with hatch as build backend
- Remove setuptools configurations
- Add automatic file handling in hatch config

* revert changes to the original state

* revert to original state before conflicts

* Update pyproject.toml

* remove setuptools references and MANIFEST.in

---------

Co-authored-by: Eric G. Kratz <[email protected]>
  • Loading branch information
vidipsingh and kratman authored Jan 23, 2025
1 parent d4e884d commit 1e5b0e7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 31 deletions.
7 changes: 0 additions & 7 deletions MANIFEST.in

This file was deleted.

5 changes: 0 additions & 5 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def set_environment_variables(env_dict, session):
def run_coverage(session):
"""Run the coverage tests and generate an XML report."""
set_environment_variables(PYBAMM_ENV, session=session)
session.install("setuptools", silent=False)
session.install("coverage", silent=False)
# Using plugin here since coverage runs unit tests on linux with latest python version.
if "CI" in os.environ:
Expand All @@ -50,7 +49,6 @@ def run_coverage(session):
def run_integration(session):
"""Run the integration tests."""
set_environment_variables(PYBAMM_ENV, session=session)
session.install("setuptools", silent=False)
if (
"CI" in os.environ
and sys.version_info[:2] == (3, 12)
Expand Down Expand Up @@ -80,7 +78,6 @@ def run_doctests(session):
def run_unit(session):
"""Run the unit tests."""
set_environment_variables(PYBAMM_ENV, session=session)
session.install("setuptools", silent=False)
session.install("-e", ".[all,dev,jax]", silent=False)
session.run("python", "-m", "pytest", "-m", "unit")

Expand All @@ -89,7 +86,6 @@ def run_unit(session):
def run_examples(session):
"""Run the examples tests for Jupyter notebooks."""
set_environment_variables(PYBAMM_ENV, session=session)
session.install("setuptools", silent=False)
session.install("-e", ".[all,dev,jax]", silent=False)
notebooks_to_test = session.posargs if session.posargs else []
session.run(
Expand Down Expand Up @@ -134,7 +130,6 @@ def set_dev(session):
def run_tests(session):
"""Run the unit tests and integration tests sequentially."""
set_environment_variables(PYBAMM_ENV, session=session)
session.install("setuptools", silent=False)
session.install("-e", ".[all,dev,jax]", silent=False)
session.run(
"python",
Expand Down
25 changes: 6 additions & 19 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[build-system]
requires = [
"setuptools",
"hatchling>=1.13.0",
]
build-backend = "setuptools.build_meta"
build-backend = "hatchling.build"

[project]
name = "pybamm"
Expand Down Expand Up @@ -146,25 +146,12 @@ ECM_Example = "pybamm.input.parameters.ecm.example_set:get_parameter_values"
MSMR_Example = "pybamm.input.parameters.lithium_ion.MSMR_example_set:get_parameter_values"
Chayambuka2022 = "pybamm.input.parameters.sodium_ion.Chayambuka2022:get_parameter_values"

[tool.setuptools]
include-package-data = true

# List of files to include as package data. These are mainly the parameter CSV files in
# the input/parameters/ subdirectories. Other files such as the CITATIONS file, relevant
# README.md files, and specific .txt files inside the pybamm/ directory are also included.
# These are specified to be included in the SDist through MANIFEST.in.
[tool.setuptools.package-data]
pybamm = [
"*.txt",
"*.md",
"*.csv",
"*.py",
"src/pybamm/CITATIONS.bib",
"src/pybamm/plotting/mplstyle",
[tool.hatch]
build.targets.sdist.include = [
"src/pybamm",
"CITATION.cff",
]

[tool.setuptools.packages.find]
where = ["src"]
[tool.ruff]
extend-include = ["*.ipynb"]
extend-exclude = ["__init__.py"]
Expand Down

0 comments on commit 1e5b0e7

Please sign in to comment.