Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions RELEASING.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ Prepare new release branch

- Create a new release branch, incrementing the version number.

- Align the release number with deformdemo (setup.py, README.rst, CHANGES.txt).
- Align the release number with deformdemo (pyproject.toml, README.rst, CHANGES.txt).

- Do any necessary branch merges (e.g., main to branch, branch to main).

- On release branch:

git pull

- Make sure your Python has ``setuptools-git``, ``twine``, and ``wheel``
- Make sure your Python has ``twine`` and ``wheel``
installed:

$VENV/bin/pip install setuptools-git twine wheel
$VENV/bin/pip install twine wheel

- Do a platform test, run a check with black, ensure the PyPI long description
renders, and run check-manifest with the following command.
Expand All @@ -52,7 +52,7 @@ Prepare new release branch
branch, and previously released branch. Also in the previously released
branch only, uncomment the sections to enable pylons_sphinx_latesturl.

- Change setup.py version to the release version number.
- Change pyproject.toml version to the release version number.

- Build an sdist and a wheel:

Expand Down
2 changes: 1 addition & 1 deletion deform/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ValidationFailure(Exception):
"""

def __init__(self, field, cstruct, error):
Exception.__init__(self)
super().__init__(field, cstruct, error)
self.field = field
self.cstruct = cstruct
self.error = error
Expand Down
14 changes: 11 additions & 3 deletions deform/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

# Standard Library
import os.path
import importlib.resources as resources

from chameleon.zpt.loader import TemplateLoader
from pkg_resources import resource_filename
from translationstring import ChameleonTranslate

from .exception import TemplateError
Expand Down Expand Up @@ -40,7 +40,15 @@ def __init__(self, *args, **kwargs):
def load(self, filename, *args, **kwargs):
if ":" in filename:
pkg_name, fn = filename.split(":", 1)
filename = resource_filename(pkg_name, fn)
resource = resources.files(pkg_name).joinpath(fn)
try:
with resources.as_file(resource) as resolved:
filename = os.fspath(resolved)
return super(ZPTTemplateLoader, self).load(
filename, *args, **kwargs
)
except ValueError:
raise TemplateError(filename)
else:
path, ext = os.path.splitext(filename)
if not ext:
Expand Down Expand Up @@ -123,5 +131,5 @@ def load(self, template_name):
return self.loader.load(template_name)


default_dir = resource_filename("deform", "templates/")
default_dir = os.fspath(resources.files("deform").joinpath("templates"))
default_renderer = ZPTRendererFactory((default_dir,))
129 changes: 128 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,132 @@
[build-system]
requires = ["setuptools", "wheel"]
requires = ["setuptools>=61", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "deform"
version = "3.0.0.dev0"
description = "Form library with advanced features like nested forms"
readme = "README.rst"
Comment thread
sbrunner marked this conversation as resolved.
requires-python = ">=3.10"
Comment thread
sbrunner marked this conversation as resolved.
Comment thread
sbrunner marked this conversation as resolved.
license = {text = "BSD-derived"}
authors = [
{name = "Chris McDonough, Agendaless Consulting", email = "pylons-discuss@googlegroups.com"},
]
maintainers = [
{name = "Josip Delić", email = "delijati@gmx.net"},
{name = "Stéphane Brunner", email = "stephane.brunner@gmail.com"},
]
keywords = ["web", "forms", "form", "generation", "schema", "validation", "pyramid"]
classifiers = [
"Intended Audience :: Developers",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
dependencies = [
"Chameleon>=2.5.1",
"colander>=1.0",
"iso8601",
"peppercorn>=0.3",
"translationstring>=1.0",
"zope.deprecation",
]

[project.optional-dependencies]
lint = [
"black",
"check-manifest",
"flake8",
"flake8-bugbear",
"flake8-builtins",
"isort",
"rstcheck",
"readme_renderer",
]
testing = [
"beautifulsoup4",
"coverage",
"flaky",
"pyramid",
"pytest",
"pytest-cov",
]
functional = [
"pygments",
"waitress",
"lingua",
"selenium>=4.0.0.b4,<4.10.0",
]
docs = [
"Sphinx>=1.7.4",
"repoze.sphinx.autointerface",
"pylons_sphinx_latesturl",
"pylons-sphinx-themes",
]
Comment thread
sbrunner marked this conversation as resolved.
dev = [
"black",
"check-manifest",
"flake8",
"flake8-bugbear",
"flake8-builtins",
"isort",
"rstcheck",
"readme_renderer",
"beautifulsoup4",
"coverage",
"flaky",
"pyramid",
"pytest",
"pytest-cov",
"pygments",
"waitress",
"lingua",
"selenium>=4.0.0.b4,<4.10.0",
"Sphinx>=1.7.4",
"repoze.sphinx.autointerface",
"pylons_sphinx_latesturl",
"pylons-sphinx-themes",
]

[project.urls]
Homepage = "https://docs.pylonsproject.org/projects/deform/en/latest/"
Documentation = "https://docs.pylonsproject.org/projects/deform/en/3.0-branch/"
Changelog = "https://docs.pylonsproject.org/projects/deform/en/3.0-branch/changes.html"
"Issue Tracker" = "https://github.com/Pylons/deform/issues"

[tool.pytest.ini_options]
python_files = ["test_*.py"]
testpaths = ["deform/tests"]
addopts = "-W always"

[tool.check-manifest]
ignore-bad-ideas = ["*.mo"]

[tool.babel.compile_catalog]
directory = "deform/locale"
domain = "deform"
statistics = true

[tool.babel.extract_messages]
add_comments = "TRANSLATORS:"
output_file = "deform/locale/deform.pot"
width = 80

[tool.babel.init_catalog]
domain = "deform"
input_file = "deform/locale/deform.pot"
output_dir = "deform/locale"

[tool.babel.update_catalog]
domain = "deform"
input_file = "deform/locale/deform.pot"
output_dir = "deform/locale"
previous = true

[tool.black]
line-length = 79
Expand Down
37 changes: 0 additions & 37 deletions setup.cfg

This file was deleted.

125 changes: 0 additions & 125 deletions setup.py

This file was deleted.

Loading
Loading