1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428
|
[project]
authors = [{ name = "Na'aman Hirschfeld", email = "nhirschfeld@gmail.com" }]
maintainers = [
{ name = "Visakh Unnikrishnan", email = "guacs@litestar.dev" },
{ name = "Cody Fincher", email = "cody@litestar.dev" },
{ name = "Janek Nouvertné", email = "janek@litestar.dev" },
{ name = "Jacob Coffee", email = "jacob@litestar.dev" },
{ name = "Peter Schutt", email = "peter@litestar.dev" },
{ name = "Alc", email = "alc@litestar.dev" },
{ name = 'Andy', email = 'adh.truong@gmail.com' },
]
keywords = ["dataclasses", "msgspec", "pydantic", "attrs", "sqlalchemy"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Framework :: Pytest",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: OS Independent",
"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.13",
"Programming Language :: Python",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Testing :: Unit",
"Topic :: Software Development :: Testing",
"Topic :: Software Development",
"Topic :: Utilities",
"Typing :: Typed",
]
name = "polyfactory"
version = "2.22.2"
description = "Mock data generation factories"
readme = "docs/PYPI_README.md"
license = { text = "MIT" }
requires-python = ">=3.8,<4.0"
dependencies = ["faker>=5.0.0", "typing-extensions>=4.6.0"]
[project.optional-dependencies]
sqlalchemy = ["sqlalchemy>=1.4.29"]
pydantic = ["pydantic[email]>=1.10"]
msgspec = ["msgspec"]
odmantic = ["odmantic<1.0.0", "pydantic[email]"]
beanie = ["beanie", "pydantic[email]", "pymongo<4.9"]
attrs = ["attrs>=22.2.0"]
full = ["pydantic", "odmantic", "msgspec", "beanie", "attrs", "sqlalchemy"]
[project.urls]
"Issue Tracker" = "https://github.com/litestar-org/polyfactory/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc"
Changelog = "https://github.com/litestar-org/polyfactory/releases/"
Twitter = "https://twitter.com/LitestarAPI"
Reddit = "https://www.reddit.com/r/LitestarAPI"
Discord = "https://discord.gg/MmcwxztmQb"
Blog = "https://blog.litestar.dev"
homepage = "https://github.com/litestar-org/polyfactory"
repository = "https://github.com/litestar-org/polyfactory"
documentation = "https://github.com/litestar-org/polyfactory"
[build-system]
build-backend = "hatchling.build"
requires = ["hatchling"]
[tool.uv]
default-groups = ["dev", "lint", "test", "docs"]
[tool.uv.sources]
polyfactory = { workspace = true }
[dependency-groups]
docs = [
"sphinx>=7.1.2",
"sphinx-autobuild>=2021.3.14",
"auto-pytabs>=0.4.0",
"sphinx-copybutton>=0.5.2",
"sphinx-toolbox>=3.5.0",
"sphinx-design>=0.5.0",
"sphinxcontrib-mermaid>=0.9.2",
"sphinx-paramlinks>=0.6.0",
"sphinx-togglebutton>=0.3.2",
# "litestar-sphinx-theme @ {root:uri}/../litestar-sphinx-theme", # only needed when working on the theme
"litestar-sphinx-theme @ git+https://github.com/litestar-org/litestar-sphinx-theme.git@v3",
"git-cliff>=2.2.1",
]
lint = [
"ruff>=0.0.290",
"codespell>=2.2.5",
"mypy>=1.5.1",
"pre-commit>=3.4.0",
"shellcheck-py>=0.9.0.5",
"pyright>=1.1.327",
"sourcery>=1.9.0",
]
test = [
"pytest>=7.4.2",
"pytest-asyncio>=0.21.1",
"pytest-cov>=4.1.0",
"hypothesis>=6.86.2",
"annotated-types>=0.5.0",
]
dev = [
"polyfactory[full]",
"mongomock-motor>=0.0.21",
"aiosqlite>=0.19.0",
"sqlalchemy[asyncio]>=1.4.29",
]
pydantic = ["pydantic[email]>=2.10.4"]
[tool.bumpversion]
allow_dirty = true
commit = true
commit_args = "--no-verify"
current_version = "2.22.2"
ignore_missing_files = false
ignore_missing_version = false
message = "chore(release): bump to v{new_version}"
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
regex = false
replace = "{new_version}"
search = "{current_version}"
serialize = ["{major}.{minor}.{patch}"]
sign_tags = false
tag = false
tag_message = "chore(release): v{new_version}"
tag_name = "v{new_version}"
pre_commit_hooks = ["uv sync", "git add uv.lock docs/changelog.rst"]
[tool.mypy]
exclude = "^tools/.*"
plugins = ["pydantic.mypy"]
warn_unused_ignores = true
warn_redundant_casts = true
warn_unused_configs = true
warn_unreachable = true
warn_return_any = true
strict = true
disallow_untyped_decorators = true
disallow_any_generics = false
implicit_reexport = false
show_error_codes = true
[tool.pydantic-mypy]
init_forbid_extra = true
init_typed = true
warn_required_dynamic_aliases = true
warn_untyped_fields = true
[tool.mypy-tests.typing_test_strict]
disallow_any_generics = true
[tool.pyright]
include = ["polyfactory", "tests", "examples"]
exclude = ["tools/**/*.*"]
[tool.coverage.run]
omit = ["*/tests/*"]
[tool.pytest.ini_options]
addopts = "--strict-config --strict-markers"
asyncio_mode = "auto"
filterwarnings = [
"ignore:.*pkg_resources.declare_namespace\\('sphinxcontrib'\\).*:DeprecationWarning",
"ignore:pkg_resources is deprecated as an API:DeprecationWarning",
# Get rid those above once sphinxcontrib-mermaid doesn't use pkg_resources anymore
# https://github.com/mgaitan/sphinxcontrib-mermaid/issues/119
]
markers = [
# Marks tests that use `attrs` library
"attrs",
]
asyncio_default_fixture_loop_scope = "function"
[tool.coverage.report]
exclude_lines = [
'pragma: no cover',
'if TYPE_CHECKING:',
'except ImportError:',
'except ImportError as e:',
'\.\.\.',
]
[tool.ruff]
line-length = 120
src = ["polyfactory", "tests", "docs/examples"]
target-version = "py38"
[tool.ruff.format]
docstring-code-format = true
docstring-code-line-length = 88
[tool.ruff.lint]
select = ["ALL"]
ignore = [
"A003", # flake8-builtins - class attribute {name} is shadowing a python builtin
"B010", # flake8-bugbear - do not call setattr with a constant attribute value
"D100", # pydocstyle - missing docstring in public module
"D101", # pydocstyle - missing docstring in public class
"D102", # pydocstyle - missing docstring in public method
"D103", # pydocstyle - missing docstring in public function
"D104", # pydocstyle - missing docstring in public package
"D105", # pydocstyle - missing docstring in magic method
"D106", # pydocstyle - missing docstring in public nested class
"D107", # pydocstyle - missing docstring in __init__
"D202", # pydocstyle - no blank lines allowed after function docstring
"D205", # pydocstyle - 1 blank line required between summary line and description
"D415", # pydocstyle - first line should end with a period, question mark, or exclamation point
"E501", # pycodestyle line too long, handled by black
"N818", # pep8-naming - exception name should be named with an Error suffix
"S311", # flake8-bandit - Standard pseudo-random generators are not suitable for security/cryptographic purposes
"UP037", # pyupgrade - removes quotes from type annotation
"COM812", # conflict with formatter
"ISC001", # conflict with formatter
]
[tool.ruff.lint.flake8-builtins]
builtins-allowed-modules = ["types"]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.pep8-naming]
classmethod-decorators = [
"classmethod",
"pydantic.validator",
"pydantic.root_validator",
"sqlalchemy.ext.declarative.declared_attr",
]
[tool.ruff.lint.isort]
known-first-party = ["polyfactory", "tests"]
section-order = [
"future",
"standard-library",
"third-party",
"pydantic",
"pydantic_v1",
"first-party",
"local-folder",
]
[tool.ruff.lint.isort.sections]
pydantic = ["pydantic", "pydantic_core"]
pydantic_v1 = ["pydantic.v1"]
[tool.ruff.lint.per-file-ignores]
"**/*.*" = ["ANN401", "TD"]
"polyfactory/**/*.*" = [
"PLR0913",
"ARG005", # Investigate @guacs
"FBT001", # Investigate @guacs
"FBT002", # Investigate @guacs
"SLF001", # Ignore use of private member access
]
"polyfactory/field_meta.py" = ["N806"]
"tests/**/*.*" = [
"S101",
"D",
"ARG",
"PGH",
"B",
"FBT",
"PTH",
"A",
"TC",
"DTZ",
"TRY",
"EM",
"S",
"N",
"SIM",
"PLR",
"BLE",
"RSE",
"C901",
"PLW",
"G",
"PIE",
"RUF012",
"FA",
"ANN",
"SLF",
"PT",
"INP",
"TD",
"FIX",
"FBT",
"PLR0913", # too many arguments
"PT",
"ARG002", # Investigate @guacs
"PERF203", # Investigate @guacs
]
"docs/examples/**/*.*" = [
"PLR2004", # Investigate @guacs
"INP001", # Add __init__.py
]
"docs/examples/tests/**/*.*" = [
"S101",
"D",
"ARG",
"PGH",
"B",
"FBT",
"PTH",
"A",
"TC",
"DTZ",
"TRY",
"EM",
"S",
"N",
"SIM",
"PLR",
"BLE",
"RSE",
"C901",
"PLW",
"G",
"PIE",
]
"docs/**/*.*" = [
"S",
"B",
"DTZ",
"A",
"TC",
"ERA",
"D",
"RET",
"E731",
"RUF012",
"FA100",
"ARG001",
]
"docs/conf.py" = ["FIX002", "ARG001"]
"tools/**/*.*" = ["D", "ARG", "EM", "TRY", "G", "FBT", "INP"]
[tool.git-cliff.changelog]
trim = true
header = """
=========
Changelog
=========\n
All commits to this project will be documented in this file.\n
"""
# TODO: Fix footers for co-authors
body = """
{% if version %}\
`Release [v{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} <https://github.com/litestar-org/polyfactory/releases/tag/v{{ version | trim_start_matches(pat="v") }}>`_
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
* `See All commits in v{{ version | trim_start_matches(pat="v") }} <https://github.com/litestar-org/polyfactory/commits/v{{ version | trim_start_matches(pat="v") }}>`_
{% else %}\
[unreleased]
------------
{% if previous %}\
{% if previous.commit_id %}
`{{ previous.commit_id | default(value='') | truncate(length=7, end='') }} <https://github.com/litestar-org/polyfactory/commit/{{ previous.commit_id }}>`_ is the last commit in the changelog before unreleased changes.
{% endif %}\
{% else %}
`Initial commit`
{% endif %}
{% endif %}\
{% if previous %}\
{% if previous.commit_id and version %}
`{{ previous.commit_id | default(value='') | truncate(length=7, end='') }} <https://github.com/litestar-org/polyfactory/commit/{{ previous.commit_id }}>`_ ... \
`{{ commit_id | default(value='') | truncate(length=7, end='') }} <https://github.com/litestar-org/polyfactory/commit/{{ commit_id }}>`_ \
| `See diff for {{ version | trim_start_matches(pat="v") }} <https://github.com/litestar-org/polyfactory/compare/{{ previous.commit_id }}...{{ commit_id }}>`_
{% endif %}\
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
{{ group | upper_first }}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
{% for commit in commits %}
* (`{{ commit.id | default(value='') | truncate(length=7, end='') }} <https://github.com/litestar-org/polyfactory/commit/{{ commit.id }}>`_) {% if commit.breaking %}[**breaking**] {% endif %} - {{ commit.message | upper_first }} {% if commit.github.username %} by `@{{ commit.github.username }} <https://github.com/{{ commit.github.username }}>`_ {%- endif %}\
{% if commit.github.pr_number %} in `#{{ commit.github.pr_number }} <https://github.com/litestar-org/polyfactory/pull/{{ commit.github.pr_number }}>`_ {%- endif %}\
{% endfor %}
{% endfor %}\n
"""
footer = """
Polyfactory Changelog
"""
[tool.git-cliff.git]
commit_parsers = [
{ message = "^feat", group = "Features" },
{ message = "^fix", group = "Bug Fixes" },
{ message = "^doc", group = "Documentation" },
{ message = "^perf", group = "Performance" },
{ message = "^refactor", group = "Refactor" },
{ message = "^style", group = "Styling" },
{ message = "^test", group = "Testing" },
{ message = "^chore\\(release\\): prepare for", skip = true },
{ message = "^chore", group = "Miscellaneous Tasks" },
{ body = ".*security", group = "Security" },
]
conventional_commits = true
filter_commits = false
filter_unconventional = true
ignore_tags = ""
protect_breaking_commits = false
skip_tags = "v0.1.0-beta.1"
sort_commits = "oldest"
split_commits = false
tag_pattern = "v[0-9]*"
topo_order = false
commit_preprocessors = [
# Matches a single backtick that is not preceded by another backtick (negative lookbehind)
# and not followed by another backtick (negative lookahead).. but these aren't supported
# in git cliff regexes. So we have to do it in 3 steps:
# Step 1: Replace pairs of backticks with a placeholder (e.g., "DOUBLEBACKTICK")
{ pattern = "``", replace = "DOUBLEBACKTICK" },
# Step 2: Replace single backticks with double backticks
{ pattern = "`", replace = "``" },
# Step 3: Replace the placeholder back to double backticks
{ pattern = "DOUBLEBACKTICK", replace = "``" },
# TODO: Fix Co-authored commits
]
link_parsers = [
# TODO: Supposedly matches on #1234 but doesn't work?
{ pattern = "\\(#(\\d+)\\)", href = "https://github.com/litestar-org/polyfactory/issues/$1" },
]
[tool.git-cliff.remote.github]
owner = "litestar-org"
repo = "polyfactory"
|