|
1 | 1 | [build-system] |
2 | | -requires = ["setuptools>=42", "wheel"] |
3 | | -build-backend = "setuptools.build_meta" |
| 2 | +build-backend = "hatchling.build" |
| 3 | +requires = ["hatchling", "hatch-build-scripts"] |
4 | 4 |
|
5 | | -[tool.mypy] |
6 | | -exclude = ['migrations/.*'] |
7 | | -ignore_missing_imports = true |
8 | | -warn_unused_configs = true |
9 | | -warn_redundant_casts = true |
10 | | -warn_unused_ignores = true |
11 | | -check_untyped_defs = true |
| 5 | +[project] |
| 6 | +name = "reactpy_django" |
| 7 | +description = "It's React, but in Python. Now with Django integration." |
| 8 | +readme = "README.md" |
| 9 | +keywords = [ |
| 10 | + "React", |
| 11 | + "ReactJS", |
| 12 | + "ReactPy", |
| 13 | + "components", |
| 14 | + "asgi", |
| 15 | + "django", |
| 16 | + "http", |
| 17 | + "server", |
| 18 | + "reactive", |
| 19 | + "interactive", |
| 20 | +] |
| 21 | +license = "MIT" |
| 22 | +authors = [{ name = "Mark Bakhit", email = "archiethemonger@gmail.com" }] |
| 23 | +requires-python = ">=3.9" |
| 24 | +classifiers = [ |
| 25 | + "Framework :: Django", |
| 26 | + "Framework :: Django :: 4.0", |
| 27 | + "Programming Language :: Python :: 3.9", |
| 28 | + "Programming Language :: Python :: 3.10", |
| 29 | + "Programming Language :: Python :: 3.11", |
| 30 | + "Programming Language :: Python :: 3.12", |
| 31 | + "Operating System :: OS Independent", |
| 32 | + "Intended Audience :: Developers", |
| 33 | + "Intended Audience :: Science/Research", |
| 34 | + "Topic :: Multimedia :: Graphics", |
| 35 | + "Topic :: Software Development :: Widget Sets", |
| 36 | + "Topic :: Software Development :: User Interfaces", |
| 37 | + "Environment :: Web Environment", |
| 38 | + "Typing :: Typed", |
| 39 | +] |
| 40 | +dependencies = [ |
| 41 | + "channels>=4.0.0", |
| 42 | + "django>=4.2.0", |
| 43 | + "reactpy>=1.0.0, <2.0.0", |
| 44 | + "reactpy-router>=1.0.0, <2.0.0", |
| 45 | + "dill>=0.3.5", |
| 46 | + "orjson >=3.6.0", |
| 47 | + "nest_asyncio>=1.5.0", |
| 48 | + "typing_extensions", |
| 49 | +] |
| 50 | +dynamic = ["version"] |
| 51 | +urls.Changelog = "https://reactive-python.github.io/reactpy-django/latest/about/changelog/" |
| 52 | +urls.Documentation = "https://reactive-python.github.io/reactpy-django/" |
| 53 | +urls.Source = "https://github.com/reactive-python/reactpy-django" |
12 | 54 |
|
13 | | -[tool.ruff.lint.isort] |
14 | | -known-first-party = ["src", "tests"] |
| 55 | +[tool.hatch.version] |
| 56 | +path = "src/reactpy_django/__init__.py" |
15 | 57 |
|
16 | | -[tool.ruff.lint] |
17 | | -ignore = ["E501"] |
| 58 | +[tool.hatch.build.targets.sdist] |
| 59 | +include = ["/src"] |
| 60 | +artifacts = ["/src/reactpy_django/static/client.js"] |
| 61 | + |
| 62 | +[tool.hatch.build.targets.wheel] |
| 63 | +artifacts = ["/src/reactpy_django/static/client.js"] |
| 64 | + |
| 65 | +[tool.hatch.metadata] |
| 66 | +license-files = { paths = ["LICENSE.md"] } |
| 67 | + |
| 68 | +[tool.hatch.envs.default] |
| 69 | +installer = "uv" |
| 70 | + |
| 71 | +[[tool.hatch.build.hooks.build-scripts.scripts]] |
| 72 | +commands = [ |
| 73 | + "bun install --cwd src/js", |
| 74 | + "bun build src/js/src/index.tsx --outfile src/reactpy_django/static/client.js --minify", |
| 75 | + 'cd scripts && python copy_dir.py "src/js/node_modules/@pyscript/core/dist" "src/reactpy_django/static/pyscript"', |
| 76 | + 'cd scripts && python copy_dir.py "src/js/node_modules/morphdom/dist" "src/reactpy_django/static/morphdom"', |
| 77 | +] |
| 78 | +artifacts = [] |
| 79 | + |
| 80 | +# >>> Hatch Test Suite <<< |
| 81 | + |
| 82 | +[tool.hatch.envs.hatch-test] |
| 83 | +extra-dependencies = [ |
| 84 | + "playwright", |
| 85 | + "twisted", |
| 86 | + "channels[daphne]>=4.0.0", |
| 87 | + "tblib", |
| 88 | + "whitenoise", # TODO: Switch to ServeStatic |
| 89 | +] |
| 90 | +matrix-name-format = "{variable}-{value}" |
| 91 | + |
| 92 | +[[tool.hatch.envs.hatch-test.matrix]] |
| 93 | +python = ["3.9", "3.10", "3.11", "3.12"] |
| 94 | + |
| 95 | +# >>> Hatch Documentation Scripts <<< |
| 96 | + |
| 97 | +[tool.hatch.envs.docs] |
| 98 | +template = "docs" |
| 99 | +detached = true |
| 100 | +dependencies = [ |
| 101 | + "mkdocs", |
| 102 | + "mkdocs-git-revision-date-localized-plugin", |
| 103 | + "mkdocs-material==9.4.0", |
| 104 | + "mkdocs-include-markdown-plugin", |
| 105 | + "mkdocs-spellcheck[all]", |
| 106 | + "mkdocs-git-authors-plugin", |
| 107 | + "mkdocs-minify-plugin", |
| 108 | + "mike", |
| 109 | + "mypy", # TODO: Replace with ruff perhaps? |
| 110 | + "django-stubs[compatible-mypy]", |
| 111 | + "linkcheckmd", |
| 112 | + "reactpy_django @ {root:uri}", |
| 113 | +] |
| 114 | + |
| 115 | +[tool.hatch.envs.docs.scripts] |
| 116 | +serve = ["cd docs && mkdocs serve"] |
| 117 | +build = ["cd docs && mkdocs build --strict"] |
| 118 | +linkcheck = [ |
| 119 | + "linkcheckMarkdown docs/ -v -r", |
| 120 | + "linkcheckMarkdown README.md -v -r", |
| 121 | + "linkcheckMarkdown CHANGELOG.md -v -r", |
| 122 | +] |
| 123 | +deploy_latest = ["cd docs && mike deploy --push --update-aliases {args} latest"] |
| 124 | +deploy_develop = ["cd docs && mike deploy --push develop"] |
| 125 | + |
| 126 | +# >>> Generic Tools <<< |
18 | 127 |
|
19 | 128 | [tool.ruff] |
20 | 129 | extend-exclude = ["*/migrations/*", ".venv/*", ".eggs/*", ".nox/*", "build/*"] |
21 | 130 | line-length = 120 |
| 131 | +format.preview = true |
| 132 | +lint.extend-ignore = [ |
| 133 | + "ARG001", # Unused function argument |
| 134 | + "ARG002", # Unused method argument |
| 135 | + "ARG004", # Unused static method argument |
| 136 | + "FBT001", # Boolean-typed positional argument in function definition |
| 137 | + "FBT002", # Boolean default positional argument in function definition |
| 138 | + "PLR2004", # Magic value used in comparison |
| 139 | + "SIM115", # Use context handler for opening files |
| 140 | + "SLF001", # Private member accessed |
| 141 | + "E501", # Line too long |
| 142 | +] |
| 143 | +lint.preview = true |
| 144 | +lint.isort.known-first-party = ["src", "tests"] |
| 145 | + |
| 146 | +[tool.pytest.ini_options] |
| 147 | +addopts = """\ |
| 148 | + --strict-config |
| 149 | + --strict-markers |
| 150 | + """ |
0 commit comments