Skip to content

Commit

Permalink
Merge pull request #798 from azmeuk/pyproject.toml
Browse files Browse the repository at this point in the history
move from setup.cfg to pyproject.toml+hatch
  • Loading branch information
azmeuk authored Sep 29, 2023
2 parents 6a7307a + 98dd1d5 commit e96e950
Show file tree
Hide file tree
Showing 10 changed files with 128 additions and 167 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ repos:
additional_dependencies:
- flake8-bugbear
- flake8-implicit-str-concat
- flake8-pyproject
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
Expand Down
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Unreleased
- Stop support for python 3.7 :pr:`794`
- Added shorter format to :class:`~fields.WeekField`
defaults :pr:`765`
- Move to pyproject.toml :pr:`796`

Version 3.0.1
-------------
Expand Down
13 changes: 13 additions & 0 deletions hatch_build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from hatchling.builders.hooks.plugin.interface import BuildHookInterface


class CustomBuildHook(BuildHookInterface):
def initialize(self, version, build_data):
from babel.messages.frontend import compile_catalog

cmd = compile_catalog()
cmd.directory = "src/wtforms/locale/"
cmd.domain = "wtforms"
cmd.statistics = True
cmd.finalize_options()
cmd.run()
105 changes: 105 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
[project]
name = "WTForms"
description = "Form validation and rendering for Python web development."
readme = "README.rst"
license = {file = "LICENSE.rst"}
maintainers = [{name = "WTForms"}]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
]
requires-python = ">=3.8"
dependencies = [
"MarkupSafe",
]
dynamic = ["version"]

[project.urls]
Documentation = "https://wtforms.readthedocs.io"
Changes = "https://wtforms.readthedocs.io/changes"
"Source Code" = "https://github.com/wtforms/wtforms/"
"Issue Tracker" = "https://github.com/wtforms/wtforms/issues"
Chat = "https://discord.gg/pallets"

[project.optional-dependencies]
email = ["email_validator"]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["src/wtforms"]

[tool.hatch.version]
path = "src/wtforms/__init__.py"

[tool.hatch.build]
include = [
"src/",
"docs/",
"tests/",
"CHANGES.rst",
"tox.ini",
]
exclude = [
"docs/_build/",
]
artifacts = ["src/wtforms/locale/**/*.mo"]

[tool.hatch.build.hooks.custom]
dependencies = [
"Babel>=2.6.0"
]

[tool.pytest.ini_options]
testpaths = ["tests"]
filterwarnings = [
"error",
]

[tool.coverage.run]
branch = true
source = ["wtforms", "tests"]

[tool.coverage.paths]
source = ["src", "*/site-packages"]

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"except ImportError:",
]

[tool.flake8]
# B = bugbear
# E = pycodestyle errors
# F = flake8 pyflakes
# W = pycodestyle warnings
# B9 = bugbear opinions
# ISC = implicit-str-concat
select = ["B", "E", "F", "W", "B9", "ISC"]
ignore = [
# slice notation whitespace, invalid
"E203",
# line length, handled by bugbear B950
"E501",
# bare except, handled by bugbear B001
"E722",
# bin op line break, invalid
"W503",
# requires 'strict' argument for 'zip'
# that needs python >= 3.10
"B905",
]
# up to 88 allowed by bugbear B950
max-line-length = 80
per-file-ignores = [
# __init__ modules export names
"**/__init__.py: F401, F403",
]
106 changes: 0 additions & 106 deletions setup.cfg

This file was deleted.

55 changes: 0 additions & 55 deletions setup.py

This file was deleted.

2 changes: 1 addition & 1 deletion src/wtforms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
from wtforms.form import Form
from wtforms.validators import ValidationError

__version__ = "3.0.0"
__version__ = "3.0.1"
4 changes: 2 additions & 2 deletions src/wtforms/locale/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Create
To create a translation, initialize a catalog in the new locale:

```
$ python setup.py init_catalog --locale <your locale>
$ pybabel init --input-file src/wtforms/locale/wtforms.pot --output-dir src/wtforms/locale --domain wtforms --locale <your locale>
```

This will create some folders under the locale name and copy the
Expand All @@ -40,7 +40,7 @@ After working on the catalog, verify that it compiles and produces the
correct translations.

```
$ python setup.py compile_catalog
$ pybabel compile --directory src/wtforms/locale --domain wtforms --statistics
```

Try loading your translations into some sample code to verify they look
Expand Down
4 changes: 2 additions & 2 deletions src/wtforms/locale/nl/LC_MESSAGES/wtforms.po
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ msgstr[1] "Veld mag niet langer zijn dan %(max)d karakters."
#, python-format
msgid "Field must be exactly %(max)d character long."
msgid_plural "Field must be exactly %(max)d characters long."
msgstr[0] "Veld moet exact %(min)d karakter lang zijn."
msgstr[1] "Veld moet exact %(min)d karakters lang zijn."
msgstr[0] "Veld moet exact %(max)d karakter lang zijn."
msgstr[1] "Veld moet exact %(max)d karakters lang zijn."

#: src/wtforms/validators.py:152
#, python-format
Expand Down
4 changes: 3 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ commands =
coverage report

[testenv:style]
deps = pre-commit
deps =
pre-commit
flake8-pyproject
skip_install = true
commands = pre-commit run --all-files --show-diff-on-failure

Expand Down

0 comments on commit e96e950

Please sign in to comment.