Last active
August 14, 2025 11:25
-
-
Save devsjc/86b896611d780e3e3c937b9c48682f31 to your computer and use it in GitHub Desktop.
A complete template pyproject.toml for new python projects.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Example pyproject.toml file for new python projects. | |
| # Fields followed by a double comment (##) need to be changed for your use case. | |
| # Versions of example packages may be old! | |
| # --- PROJECT CONFIGURATION --- # | |
| [build-system] | |
| requires = ["setuptools>=67", "wheel", "setuptools-git-versioning>=2.0,<3"] | |
| build-backend = "setuptools.build_meta" | |
| # Metadata (see https://peps.python.org/pep-0621/) | |
| [project] | |
| name = "your-project" ## | |
| dynamic = ["version"] # Set automtically using git: https://setuptools-git-versioning.readthedocs.io/en/stable/ | |
| description = "Consise summary of project" ## | |
| readme = {file = "README.md", content-type = "text/markdown"} | |
| requires-python = ">=3.12.0" | |
| license = {text = "MIT License"} | |
| authors = [ | |
| { name = "Your name", email = "optional@email.com"} ## | |
| ] | |
| classifiers = [ | |
| "Programming Language :: Python :: 3", | |
| "License :: OSI Approved :: MIT License", | |
| ] | |
| dependencies = [ | |
| "loguru >= 0.7.3", | |
| "numpy >= 1.23.2", | |
| ] | |
| [dependency-groups] ## | |
| dev = [ | |
| # Testing | |
| "unittest-xml-reporting", | |
| # Linting and type checking | |
| "mypy", | |
| "ruff >= 0.9.2", | |
| # LSP Support | |
| "python-lsp-server", | |
| "pylsp-mypy", | |
| "python-lsp-ruff", | |
| ] | |
| [project.scripts] | |
| # Put entrypoints in here | |
| your-cli = "your_package.main:main" ## | |
| [project.urls] | |
| repository = "https://github.com/openclimatefix/ocf-template" | |
| [tool.setuptools] | |
| include-package-data = false | |
| [tool.setuptools-git-versioning] | |
| enabled = true | |
| # --- LINTING AND TYPING CONFIGURATION --- # | |
| # MyPy configuration | |
| # * See https://mypy.readthedocs.io/en/stable/index.html | |
| [tool.mypy] | |
| python_version = "3.12" | |
| dmypy = true | |
| strict = true | |
| warn_unreachable = true | |
| warn_return_any = true | |
| disallow_untyped_defs = true | |
| plugins = [ | |
| "numpy.typing.mypy_plugin", | |
| ] | |
| # Ruff configuration | |
| # * See https://beta.ruff.rs/docs/ | |
| [tool.ruff] | |
| line-length = 100 | |
| indent-width = 4 | |
| exclude = ["__init__.py"] | |
| [tool.ruff.lint] | |
| select = [ | |
| "F", # pyflakes | |
| "E", # pycodestyle | |
| "W", # whitespace and newlines | |
| "I", # isort | |
| "UP", # modernize | |
| "ANN", # flake8 type annotations | |
| "S", # flake8 bandit | |
| "B", # flake8 bugbear | |
| "C4", # flake8 comprehensions | |
| "COM", # flake8 commas | |
| "T20", # flake8 print | |
| "SIM", # flake8 simplify | |
| "ARG", # flake8 unused arguments | |
| "DTZ", # flake8 datetimes | |
| "Q", # flake8 quotes | |
| "TCH", # flake8 typecheck | |
| "D", # pydocstyle | |
| "RUF", # ruff-specific rules | |
| ] | |
| fixable = ["ALL"] | |
| ignore = [ | |
| "D203", "D213", "D215", "D400", "D401", "D404", "D406", | |
| "D407", "D408", "D409", "D413", | |
| ] | |
| [tool.ruff.lint.per-file-ignores] | |
| "test*" = ["D", "ANN"] | |
| [tool.ruff.lint.pydocstyle] | |
| convention = "google" | |
| [tool.ruff.format] | |
| quote-style = "double" | |
| indent-style = "space" | |
| line-ending = "auto" | |
| docstring-code-format = true | |
| docstring-code-line-length = 100 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment