From ea4cd48e6cfdcc21f33b92092eebb36dbedd1e4b Mon Sep 17 00:00:00 2001 From: Jelmer Date: Fri, 6 Sep 2024 14:05:26 +0200 Subject: [PATCH] Merge setup.py in pyproject.toml (#5351) * Merge setup.py into pyproject.toml and add pyproject-fmt pre-commit hook for formatting it --- .pre-commit-config.yaml | 5 +++ pyproject.toml | 71 +++++++++++++++++++++++++++---------- scripts/update_changelog.py | 2 +- setup.py | 41 --------------------- 4 files changed, 58 insertions(+), 61 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d8d601e9..06c07356 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -47,6 +47,11 @@ repos: hooks: - id: flake8 + - repo: https://github.com/tox-dev/pyproject-fmt + rev: "2.0.4" + hooks: + - id: pyproject-fmt + ci: autoupdate_schedule: weekly skip: [] diff --git a/pyproject.toml b/pyproject.toml index 6e68762f..04d40a21 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,35 +1,68 @@ -# ==== pytest ==== -[tool.pytest.ini_options] -addopts = "-v --tb=short" -norecursedirs = [ - ".tox", - ".git", - "*/migrations/*", - "*/static/*", - "docs", - "venv", - "*/{{cookiecutter.project_slug}}/*", +[project] +name = "cookiecutter-django" +version = "2024.09.05" +description = "A Cookiecutter template for creating production-ready Django projects quickly." +readme = "README.md" +keywords = [ + "cookiecutter", + "django", + "project template", + "scaffolding", + "skeleton", ] +license = { text = "BSD" } +authors = [ + { name = "Daniel Roy Greenfeld", email = "pydanny@gmail.com" }, +] +requires-python = "==3.12" +classifiers = [ + "Development Status :: 4 - Beta", + "Environment :: Console", + "Framework :: Django :: 5.0", + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "Natural Language :: English", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: Implementation :: CPython", + "Topic :: Software Development", +] +urls = { Repository = "https://github.com/cookiecutter/cookiecutter-django" } - -# ==== black ==== [tool.black] line-length = 119 -target-version = ['py312'] - +target-version = [ + 'py312', +] # ==== isort ==== + [tool.isort] profile = "black" line_length = 119 known_first_party = [ - "tests", - "scripts", - "hooks", + "tests", + "scripts", + "hooks", ] - # ==== djLint ==== + +[tool.pytest.ini_options] +addopts = "-v --tb=short" +norecursedirs = [ + ".tox", + ".git", + "*/migrations/*", + "*/static/*", + "docs", + "venv", + "*/{{cookiecutter.project_slug}}/*", +] + +# ==== black ==== + [tool.djlint] blank_line_after_tag = "load,extends" close_void_tags = true diff --git a/scripts/update_changelog.py b/scripts/update_changelog.py index 5f3ad5ec..9909b1ee 100644 --- a/scripts/update_changelog.py +++ b/scripts/update_changelog.py @@ -47,7 +47,7 @@ def main() -> None: print(f"Wrote {changelog_path}") # Update version - setup_py_path = ROOT / "setup.py" + setup_py_path = ROOT / "pyproject.toml" update_version(setup_py_path, release) print(f"Updated version in {setup_py_path}") diff --git a/setup.py b/setup.py index d4762ae3..e69de29b 100644 --- a/setup.py +++ b/setup.py @@ -1,41 +0,0 @@ -#!/usr/bin/env python -try: - from setuptools import setup -except ImportError: - from distutils.core import setup - -# We use calendar versioning -version = "2024.09.05" - -with open("README.md") as readme_file: - long_description = readme_file.read() - -setup( - name="cookiecutter-django", - version=version, - description=("A Cookiecutter template for creating production-ready " "Django projects quickly."), - long_description=long_description, - author="Daniel Roy Greenfeld", - author_email="pydanny@gmail.com", - url="https://github.com/cookiecutter/cookiecutter-django", - packages=[], - license="BSD", - zip_safe=False, - classifiers=[ - "Development Status :: 4 - Beta", - "Environment :: Console", - "Framework :: Django :: 5.0", - "Intended Audience :: Developers", - "Natural Language :: English", - "License :: OSI Approved :: BSD License", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: Implementation :: CPython", - "Topic :: Software Development", - ], - keywords=( - "cookiecutter, Python, projects, project templates, django, " - "skeleton, scaffolding, project directory, setup.py" - ), -)