Skip to content

Commit 95ec1fa

Browse files
committed
feat: pyproject.toml is now standardized
- migrate from `poetry` to `PDM` - moves code into `src/` - updates dependencies - temporary removal of country code & ethereum addr. validation
1 parent e1c0419 commit 95ec1fa

32 files changed

+1357
-2080
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ ipython_config.py
111111
# in version control.
112112
# https://pdm.fming.dev/#use-with-ide
113113
.pdm.toml
114+
.pdm-python
115+
.pdm-build/
114116

115117
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
116118
__pypackages__/

pdm.lock

Lines changed: 1270 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

poetry.lock

Lines changed: 0 additions & 1642 deletions
This file was deleted.

pyproject.toml

Lines changed: 75 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,15 @@
1-
# Utils PEP 621 is enhanced or some fancy build
2-
# system comes up with a clever mechanism to
3-
# itegrate it all. For now poetry works best.
4-
5-
6-
####################
7-
# Build System #
8-
####################
9-
10-
[build-system]
11-
requires = ["poetry-core"]
12-
build-backend = "poetry.core.masonry.api"
13-
14-
151
####################
162
# Metadata #
173
####################
184

19-
[tool.poetry]
5+
[project]
206
name = "validators"
217
version = "0.21.1"
228
description = "Python Data Validation for Humans™"
23-
authors = ["Konsta Vesterinen <konsta@fastmonkeys.com>"]
24-
license = "MIT"
9+
authors = [{ name = "Konsta Vesterinen", email = "konsta@fastmonkeys.com" }]
10+
requires-python = ">=3.8"
2511
readme = "README.md"
26-
repository = "https://github.com/python-validators/validators"
12+
license = { text = "MIT" }
2713
keywords = ["validation", "validator", "python-validator"]
2814
classifiers = [
2915
"Development Status :: 4 - Beta",
@@ -40,136 +26,106 @@ classifiers = [
4026
"Programming Language :: Python :: Implementation :: CPython",
4127
"Topic :: Software Development :: Libraries :: Python Modules",
4228
]
43-
include = ["CHANGES.md", "docs/*", "docs/validators.1", "validators/py.typed"]
44-
4529

4630
####################
4731
# Dependencies #
4832
####################
4933

50-
[tool.poetry.dependencies]
51-
python = "^3.8"
52-
eth-hash = {extras = ["pycryptodome"], version = "^0.5.2"}
53-
54-
[tool.poetry.group.docs]
55-
optional = true
34+
dependencies = []
5635

57-
[tool.poetry.group.docs.dependencies]
58-
mkdocs = "^1.4.2"
59-
mkdocs-material = "^9.1.6"
60-
mkdocstrings = { extras = ["python"], version = "^0.21.2" }
61-
pyaml = "^21.10.1"
62-
63-
[tool.poetry.group.hooks]
64-
optional = true
65-
66-
[tool.poetry.group.hooks.dependencies]
67-
pre-commit = "^3.2.2"
68-
69-
[tool.poetry.group.sast]
70-
optional = true
71-
72-
[tool.poetry.group.sast.dependencies]
73-
bandit = "^1.7.5"
74-
75-
[tool.poetry.group.sphinx]
76-
optional = true
77-
78-
[tool.poetry.group.sphinx.dependencies]
79-
sphinx = "^6.1.3"
80-
myst-parser = "^1.0.0"
81-
pypandoc-binary = "^1.11"
82-
83-
[tool.poetry.group.testing]
84-
optional = true
85-
86-
[tool.poetry.group.testing.dependencies]
87-
pytest = "^7.3.0"
88-
89-
[tool.poetry.group.tooling]
90-
optional = true
36+
[project.optional-dependencies]
37+
docs-offline = ["myst-parser>=2.0.0", "pypandoc-binary>=1.11", "sphinx>=7.1.1"]
38+
docs-online = [
39+
"mkdocs>=1.5.1",
40+
"mkdocs-material>=9.1.21",
41+
"mkdocstrings[python]>=0.22.0",
42+
"pyaml>=23.7.0",
43+
]
44+
hooks = ["pre-commit>=3.3.3"]
45+
runner = ["tox>=4.6.4"]
46+
sast = ["bandit[toml]>=1.7.5"]
47+
testing = ["pytest>=7.4.0"]
48+
tooling = ["black>=23.7.0", "ruff>=0.0.280", "pyright>=1.1.318"]
9149

92-
[tool.poetry.group.tooling.dependencies]
93-
black = "^23.3.0"
94-
flake8 = "^5.0.4"
95-
flake8-docstrings = "^1.7.0"
96-
isort = "^5.12.0"
97-
pyright = "^1.1.302"
98-
tox = "^4.4.11"
50+
####################
51+
# Build System #
52+
####################
9953

54+
[build-system]
55+
requires = ["setuptools>=61", "wheel"]
56+
build-backend = "setuptools.build_meta"
10057

10158
####################
10259
# Configurations #
10360
####################
10461

62+
[tool.bandit]
63+
exclude_dirs = [
64+
".github",
65+
".pytest_cache",
66+
".tox",
67+
".venv",
68+
".vscode",
69+
"site",
70+
"tests",
71+
]
72+
10573
[tool.black]
10674
line-length = 100
10775
target-version = ["py38", "py39", "py310", "py311"]
10876

109-
[tool.bandit]
110-
exclude_dirs = [".github", ".pytest_cache", ".tox", ".vscode", "site", "tests"]
111-
112-
[tool.isort]
113-
ensure_newline_before_comments = true
114-
force_grid_wrap = 0
115-
force_sort_within_sections = true
116-
import_heading_firstparty = "local"
117-
import_heading_localfolder = "local"
118-
import_heading_stdlib = "standard"
119-
import_heading_thirdparty = "external"
120-
include_trailing_comma = true
121-
known_local_folder = ["validators"]
122-
length_sort = true
123-
line_length = 100
124-
multi_line_output = 3
125-
profile = "black"
126-
reverse_relative = true
127-
reverse_sort = true
128-
skip_gitignore = true
129-
use_parentheses = true
130-
13177
[tool.pyright]
132-
include = ["validators", "tests"]
133-
exclude = ["**/__pycache__", ".pytest_cache/", ".tox/", "site/"]
78+
include = ["src", "tests"]
79+
exclude = ["**/__pycache__", ".pytest_cache/", ".tox/", ".venv/", "site/"]
13480
pythonVersion = "3.8"
13581
pythonPlatform = "All"
13682
typeCheckingMode = "strict"
13783

84+
[tool.ruff]
85+
select = ["E", "F", "I", "N", "D"]
86+
line-length = 100
87+
target-version = "py38"
88+
extend-exclude = ["**/__pycache__", ".pytest_cache", "site"]
89+
90+
[tool.ruff.isort]
91+
# case-sensitive = true
92+
combine-as-imports = true
93+
force-sort-within-sections = true
94+
force-wrap-aliases = true
95+
known-local-folder = ["src"]
96+
relative-imports-order = "closest-to-furthest"
97+
98+
[tool.ruff.pydocstyle]
99+
convention = "google"
100+
138101
[tool.tox]
139102
legacy_tox_ini = """
140103
[tox]
141-
min_version = 4.0
142-
env_list =
143-
py{38,39,310,311}
144-
format_black
145-
format_isort
146-
lint
147-
type_check
104+
requires =
105+
tox>=4
106+
env_list = lint, type, format, sast, py{38,39,310,311}
148107
149-
[testenv]
150-
description = run unit tests
151-
deps = pytest
152-
commands = pytest
108+
[testenv:lint]
109+
description = ruff linter
110+
deps = ruff
111+
commands = ruff check .
112+
113+
[testenv:type]
114+
description = pyright type checker
115+
deps = pyright
116+
commands = pyright .
153117
154-
[testenv:format_black]
155-
description = run formatter
118+
[testenv:format]
119+
description = code formatter
156120
deps = black
157121
commands = black .
158122
159-
[testenv:format_isort]
160-
description = run formatter
161-
deps = isort
162-
commands = isort .
123+
[testenv:sast]
124+
deps = bandit[toml]
125+
commands = bandit -c pyproject.toml -r .
163126
164-
[testenv:lint]
165-
description = run linters
166-
deps = flake8
167-
commands = flake8
168-
169-
[testenv:type_check]
170-
description = run type checker
171-
deps =
172-
pyright
173-
pytest
174-
commands = pyright
127+
[testenv]
128+
description = unit tests
129+
deps = pytest
130+
commands = pytest .
175131
"""

validators/__init__.py renamed to src/validators/__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
from .between import between
1212
from .btc_address import btc_address
1313
from .card import amex, card_number, diners, discover, jcb, mastercard, unionpay, visa
14-
from .country_code import country_code
14+
15+
# from .country_code import country_code
1516
from .domain import domain
1617
from .email import email
1718
from .hashes import md5, sha1, sha224, sha256, sha512
@@ -25,16 +26,16 @@
2526
from .utils import validator, ValidationFailure
2627
from .uuid import uuid
2728

28-
from .crypto_addresses import eth_address
29+
# from .crypto_addresses import eth_address
2930
from .i18n import es_cif, es_doi, es_nie, es_nif, fi_business_id, fi_ssn
3031

3132
__all__ = (
3233
"amex",
3334
"between",
3435
"btc_address",
35-
"eth_address",
36+
# "eth_address",
3637
"card_number",
37-
"country_code",
38+
# "country_code",
3839
"diners",
3940
"discover",
4041
"domain",
File renamed without changes.

validators/between.py renamed to src/validators/between.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
# -*- coding: utf-8 -*-
33

44
# standard
5-
from typing import TypeVar, Union
65
from datetime import datetime
6+
from typing import TypeVar, Union
77

88
# local
9-
from ._extremes import AbsMin, AbsMax
9+
from ._extremes import AbsMax, AbsMin
1010
from .utils import validator
1111

1212
PossibleValueTypes = TypeVar("PossibleValueTypes", int, float, str, datetime)
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)