pyscaffold pre-commit ini2toml
- Journal 2024-10-05 Install Astral uv Python CLI tools
- 
Uv does not support setup.cfg: "error: Noprojecttable found".
- 
Stack Overflow answers
  Is there a simple way to convert setup.py to pyproject.toml:
- 
ini2tomlconverts topyproject.toml, but does not incorporate an existingtomlfile.
- 
setuptools-py2cfgconvertssetup.pytosetup.cfg. However,pyscaffolddoes not include configuration insetup.py.
 
- 
- 
Merge pyproject1.tomlintopyproject.toml.
- 
flake8does not include pyproject.toml (PEP 518) support #234. Replace withruffand update settings per ruff rules.
- 
ruffandruff-formatreplaceblack, eliminatingflake8compatibility settings.
- 
Activate ruffequivalent forpycodestyle,Pyflakes,pyupgrade,flake8-bugbear, andflake8-simplify.uv tool install 'ini2toml[full]' ini2toml --output-file pyproject1.toml setup.cfg [WARNING] Sections 'flake8', 'devpi:upload' ('setup.cfg') may be problematic. It might be the case TOML files are not supported by the relevant tools, or that 'ini2toml' just lacks a plugin for this kind of configuration. Please review the generated output and remove these sections if necessary.
pyproject.toml:
[build-system]
# AVOID CHANGING REQUIRES: IT WILL BE UPDATED BY PYSCAFFOLD!
requires = ["setuptools>=46.1.0", "setuptools_scm[toml]>=5"]
build-backend = "setuptools.build_meta"
[project]
name = "dude"
description = "Add a short description here!"
authors = [{name = "John D. Fisher", email = "jdfenw@gmail.com"}]
license = {text = "MIT"}
classifiers = [
    "Development Status :: 4 - Beta",
    "Programming Language :: Python",
]
dependencies = ['importlib-metadata; python_version<"3.8"']
dynamic = ["version"]
[project.readme]
file = "README.md"
content-type = "text/markdown; charset=UTF-8; variant=GFM"
# Add here related links, for example:
[project.urls]
Homepage = "https://github.com/pyscaffold/pyscaffold/"
Documentation = "https://pyscaffold.org/"
# Source = https://github.com/pyscaffold/pyscaffold/
# Changelog = https://pyscaffold.org/en/latest/changelog.html
# Tracker = https://github.com/pyscaffold/pyscaffold/issues
# Conda-Forge = https://anaconda.org/conda-forge/pyscaffold
# Download = https://pypi.org/project/PyScaffold/#files
# Twitter = https://twitter.com/PyScaffold
# Change if running only on Windows, Mac or Linux (comma-separated)
# Add here all kinds of additional classifiers as defined under
# https://pypi.org/classifiers/
[project.optional-dependencies]
# Add here additional requirements for extra features, to install with:
# `pip install dude[PDF]` like:
# PDF = ReportLab; RXP
# Add here test requirements (semicolon/line-separated)
testing = [
    "setuptools",
    "pytest",
    "pytest-cov",
]
[project.entry-points]
# Add here console scripts like:
# console_scripts =
# script_name = dude.module:function
# For example:
# console_scripts =
# fibonacci = dude.skeleton:run
# And any other entry points, for example:
# pyscaffold.cli =
# awesome = pyscaffoldext.awesome.extension:AwesomeExtension
[tool.setuptools]
zip-safe = false
include-package-data = true
package-dir = {"" = "src"}
# Require a min/specific Python version (comma-separated conditions)
# python_requires = >=3.8
# Add here dependencies of your project (line-separated), e.g. requests>=2.2,<3.0.
# Version specifiers like >=2.2,<3.0 avoid problems due to API changes in
# new major versions. This works if the required packages follow Semantic Versioning.
# For more information, check out https://semver.org/.
platforms = ["any"]
license-files = ["LICENSE.txt"]
[tool.setuptools.packages.find]
where = ["src"]
exclude = ["tests"]
namespaces = true
[tool.setuptools_scm]
# For smarter version schemes and other configuration options,
# check out https://github.com/pypa/setuptools_scm
version_scheme = "no-guess-dev"
[tool.pytest.ini_options]
# Specify command line options as you would do when invoking pytest directly.
# e.g. --cov-report html (or xml) for html/xml output or --junitxml junit.xml
# in order to write a coverage file that can be read by Jenkins.
# CAUTION: --cov flags may prohibit setting breakpoints while debugging.
# Comment those flags to avoid this pytest issue.
addopts = """
--cov dude --cov-report term-missing
--verbose"""
norecursedirs = [
    "dist",
    "build",
    ".tox",
]
testpaths = ["tests"]
# Use pytest markers to select/deselect specific tests
# markers =
# slow: mark tests as slow (deselect with '-m "not slow"')
# system: mark end-to-end system tests
[tool.devpi.upload]
# Options for the devpi: PyPI server and packaging tool
# VCS export must be deactivated since we are using setuptools-scm
no_vcs = "1"
formats = "bdist_wheel"
[tool.ruff]
line-length = 88
exclude = [
    ".tox",
    "build",
    "dist",
    ".eggs",
    "docs/conf.py"
]
[tool.ruff.lint]
select = [
    # pydocstyle
    "D",
    # Augment the convention by requiring an imperative mood for all
    # docstrings.
    "D401",
    # pycodestyle
    "E",
    # trailing-whitespace (W291)
    # missing-newline-at-end-of-file (W292)
    "W",
    # Pyflakes
    "F",
    # pyupgrade
    "UP",
    # flake8-bugbear
    "B",
    # flake8-simplify
    "SIM",
    # isort
    "I",
]
[tool.ruff.lint.pydocstyle]
convention = "numpy"
[tool.ruff.format]
docstring-code-format = true
docstring-code-line-length = 20
[tool.pyscaffold]
# PyScaffold's parameters when the project was created.
# This will be used when updating. Do not change!
version = "4.6"
package = "dude"
extensions = """
dsproject
markdown
no_skeleton
pre_commit"""
# This file is used to configure your project.
# Read more about the various options under:
# https://setuptools.pypa.io/en/latest/userguide/declarative_config.html
# https://setuptools.pypa.io/en/latest/references/keywords.html