Browse Source

Switch from setup.py to pyproject.toml

Vince Salvino 8 months ago
parent
commit
8e04513572
6 changed files with 76 additions and 119 deletions
  1. 0 0
      LICENSE.txt
  2. 2 1
      MANIFEST.in
  3. 6 29
      docs/contributing/index.rst
  4. 66 22
      pyproject.toml
  5. 2 1
      requirements-dev.txt
  6. 0 66
      setup.py

+ 0 - 0
LICENSE → LICENSE.txt


+ 2 - 1
MANIFEST.in

@@ -1,4 +1,5 @@
-include LICENSE README.md
+include LICENSE.txt README.md
 graft coderedcms
 global-exclude __pycache__
 global-exclude *.py[co]
+prune **/.*_cache

+ 6 - 29
docs/contributing/index.rst

@@ -53,10 +53,10 @@ Changes are then made as a pull request against the ``main`` branch.
 The ``main`` branch is the primary working branch, representing the development
 version of coderedcms.
 
-Releases are maintained in ``release/X.Y`` branches, where X is the Major
-version and Y is the Minor version. Maintenance patches are applied in ``main``
-(if applicable) and then merged or cherry-picked into the respective release
-branch.
+Releases are maintained in ``release/X`` branches, where X is the
+Major version. Maintenance patches are applied in ``main`` (if
+applicable) and then merged or cherry-picked into the respective
+release branch.
 
 
 A Note on Cross-Platform Support
@@ -277,7 +277,7 @@ To build a publicly consumable pip package, run:
 
 .. code-block:: console
 
-    $ python setup.py sdist bdist_wheel
+    $ python -m build
 
 
 Building Documentation
@@ -299,25 +299,6 @@ Or manually using sphinx:
 
 Output will be in ``docs/_build/html/`` directory.
 
-Updating Tutorial Documentation
--------------------------------
-
-.. From time to time, the documentation for the tutorial will need to be updated. You can work directly in
-.. the tutorial site by loading the fixture file for its database (read more at :ref:`load-data`).
-
-Once you have worked in the tutorial site and gotten new screenshots for the **Getting Started** documentation,
-you will also need to update the fixture file, which is located in ``tutorial > mysite > website > fixtures``.
-
-**These are the steps for updating the fixture:**
-
-1. From the command line, type ``python manage.py dumpdata --natural-foreign --natural-primary -e contenttypes -e auth.Permission --indent 4 > dumpdata.json``
-
-2. The dumped data file will show up in the ``website`` folder. Open it and copy/paste its contents into a new file called ``database.json``. This will fix the encoding issue you would run into otherwise. Save the new fixture file and delete the one that was dumped. Also delete the one that is currently in the ``fixtures`` folder.
-
-3. Move the ``database.json`` file into the ``fixtures`` folder.
-
-.. 4. For testing ``loaddata``, please review the steps at  :ref:`load-data`.
-
 
 Publishing a New Release
 ------------------------
@@ -335,7 +316,7 @@ Next build a pip package:
 
 .. code-block:: console
 
-    $ python setup.py sdist bdist_wheel
+    $ python -m build
 
 Then upload the pip package to the Python Package Index:
 
@@ -354,7 +335,3 @@ Copy the contents of ``docs/_build/html/`` to the CodeRed docs server under the
 .. code-block:: console
 
    $ cr upload --path ./docs/_build/html/ --remote /www/wagtail-crx/ docs
-
-Note that we do not release separate documentation versions for minor or
-maintenance releases. Update the existing major version docs with release notes
-and other changes.

+ 66 - 22
pyproject.toml

@@ -1,25 +1,69 @@
-[tool.black]
-line-length = 80
-exclude = '''
-(
-  /(
-      \.eggs
-    | \.git
-    | \.github
-    | \.hg
-    | \.mypy_cache
-    | \.tox
-    | \.venv
-    | _build
-    | build
-    | ci
-    | dist
-    | migrations
-    | testproject
-    | venv
-  )/
-)
-'''
+# -- PACKAGE --------------------------
+
+[build-system]
+requires = ["setuptools>=65.5"]
+build-backend = "setuptools.build_meta"
+
+[project]
+authors = [
+    {name = "CodeRed LLC", email = "info@coderedcorp.com"}
+]
+classifiers = [
+    "Environment :: Web Environment",
+    "Framework :: Django",
+    "Intended Audience :: Developers",
+    "Operating System :: OS Independent",
+    "Programming Language :: Python",
+    "Programming Language :: Python :: 3",
+    "Programming Language :: Python :: 3.8",
+    "Programming Language :: Python :: 3.9",
+    "Programming Language :: Python :: 3.10",
+    "Programming Language :: Python :: 3.11",
+    "Programming Language :: Python :: 3.12",
+    "Programming Language :: Python :: 3 :: Only",
+    "Framework :: Django",
+    "Framework :: Django :: 4.2",
+    "Framework :: Django :: 5.0",
+    "Framework :: Wagtail",
+    "Framework :: Wagtail :: 6",
+    "Topic :: Internet :: WWW/HTTP",
+    "Topic :: Internet :: WWW/HTTP :: Dynamic Content",
+    "Topic :: Internet :: WWW/HTTP :: Site Management",
+]
+dependencies = [
+    "beautifulsoup4>=4.8,<4.13",  # should be the same as wagtail
+    "django-eventtools==1.0.*",
+    "django-bootstrap5==24.2",
+    "Django>=4.2,<6.0",  # should be the same as wagtail
+    "geocoder==1.38.*",
+    "icalendar==5.0.*",
+    "wagtail>=6.0,<7.0",
+    "wagtail-cache>=2.4,<3",
+    "wagtail-seo>=2.5,<3",
+]
+description = "Wagtail + CodeRed Extensions enabling rapid development of marketing-focused websites."
+dynamic = ["version"]
+license = {file = "LICENSE.txt"}
+name = "coderedcms"
+readme = "README.md"
+requires-python = ">=3.8"
+
+[project.scripts]
+coderedcms = "coderedcms.bin.coderedcms:main"
+
+[project.urls]
+Source = "https://github.com/coderedcorp/coderedcms"
+Documentation = "https://docs.coderedcorp.com/wagtail-crx/"
+Changelog = "https://docs.coderedcorp.com/wagtail-crx/releases/"
+
+[tool.setuptools]
+packages = ["coderedcms"]
+
+[tool.setuptools.dynamic]
+version = {attr = "coderedcms.__version__"}
+
+
+# -- TOOLS ----------------------------
 
 [tool.codespell]
 skip = 'migrations,vendor,_build,*.css.map,*.jpg,*.png,*.pyc'

+ 2 - 1
requirements-dev.txt

@@ -2,6 +2,7 @@
 -r requirements-ci.txt
 
 # Requirements, in addition to coderedcms, needed for development.
+build
 libsass
+setuptools>=65.5
 twine
-wheel

+ 0 - 66
setup.py

@@ -1,66 +0,0 @@
-import os
-
-from setuptools import setup
-
-from coderedcms import __version__
-
-
-with open(
-    os.path.join(os.path.dirname(__file__), "README.md"), encoding="utf8"
-) as readme:
-    README = readme.read()
-
-# allow setup.py to be run from any path
-os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
-
-setup(
-    name="coderedcms",
-    version=__version__,
-    packages=["coderedcms"],
-    include_package_data=True,
-    license="BSD License",
-    description="Wagtail-based CMS by CodeRed for building marketing websites.",
-    long_description=README,
-    long_description_content_type="text/markdown",
-    url="https://github.com/coderedcorp/coderedcms",
-    author="CodeRed LLC",
-    author_email="info@coderedcorp.com",
-    classifiers=[
-        "Environment :: Web Environment",
-        "Framework :: Django",
-        "Intended Audience :: Developers",
-        "Operating System :: OS Independent",
-        "Programming Language :: Python",
-        "Programming Language :: Python :: 3",
-        "Programming Language :: Python :: 3.8",
-        "Programming Language :: Python :: 3.9",
-        "Programming Language :: Python :: 3.10",
-        "Programming Language :: Python :: 3.11",
-        "Programming Language :: Python :: 3.12",
-        "Programming Language :: Python :: 3 :: Only",
-        "Framework :: Django",
-        "Framework :: Django :: 4.2",
-        "Framework :: Django :: 5.0",
-        "Framework :: Wagtail",
-        "Framework :: Wagtail :: 6",
-        "Topic :: Internet :: WWW/HTTP",
-        "Topic :: Internet :: WWW/HTTP :: Dynamic Content",
-        "Topic :: Internet :: WWW/HTTP :: Site Management",
-    ],
-    python_requires=">=3.8",
-    install_requires=[
-        "beautifulsoup4>=4.8,<4.13",  # should be the same as wagtail
-        "django-eventtools==1.0.*",
-        "django-bootstrap5==24.2",
-        "Django>=4.2,<6.0",  # should be the same as wagtail
-        "geocoder==1.38.*",
-        "icalendar==5.0.*",
-        "wagtail>=6.0,<7.0",
-        "wagtail-cache>=2.4,<3",
-        "wagtail-seo>=2.5,<3",
-    ],
-    entry_points={
-        "console_scripts": ["coderedcms=coderedcms.bin.coderedcms:main"]
-    },
-    zip_safe=False,
-)