fasthtml-tailwindcss 4.3.3__tar.gz → 4.3.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. {fasthtml_tailwindcss-4.3.3 → fasthtml_tailwindcss-4.3.4}/.gitignore +2 -2
  2. fasthtml_tailwindcss-4.3.4/PKG-INFO +172 -0
  3. fasthtml_tailwindcss-4.3.4/README.md +144 -0
  4. fasthtml_tailwindcss-4.3.4/packages/cli/LICENSE +21 -0
  5. fasthtml_tailwindcss-4.3.4/packages/cli/README.md +5 -0
  6. fasthtml_tailwindcss-4.3.4/packages/cli/binaries.json +12 -0
  7. {fasthtml_tailwindcss-4.3.3 → fasthtml_tailwindcss-4.3.4/packages/cli}/hatch_build.py +16 -6
  8. fasthtml_tailwindcss-4.3.4/packages/cli/pyproject.toml +34 -0
  9. fasthtml_tailwindcss-4.3.4/packages/cli/src/fasthtml_tailwindcss_cli/__init__.py +7 -0
  10. {fasthtml_tailwindcss-4.3.3 → fasthtml_tailwindcss-4.3.4}/pyproject.toml +15 -8
  11. fasthtml_tailwindcss-4.3.4/scripts/check_release.py +109 -0
  12. fasthtml_tailwindcss-4.3.4/scripts/filter_publish.py +25 -0
  13. fasthtml_tailwindcss-4.3.4/src/fasthtml_tailwindcss/__init__.py +42 -0
  14. fasthtml_tailwindcss-4.3.4/src/fasthtml_tailwindcss/build.py +64 -0
  15. fasthtml_tailwindcss-4.3.4/src/fasthtml_tailwindcss/client.py +133 -0
  16. fasthtml_tailwindcss-4.3.4/src/fasthtml_tailwindcss/compiler.py +40 -0
  17. fasthtml_tailwindcss-4.3.4/src/fasthtml_tailwindcss/config.py +64 -0
  18. fasthtml_tailwindcss-4.3.4/src/fasthtml_tailwindcss/worker.py +122 -0
  19. {fasthtml_tailwindcss-4.3.3 → fasthtml_tailwindcss-4.3.4}/tests/conftest.py +7 -9
  20. fasthtml_tailwindcss-4.3.4/tests/test_build.py +33 -0
  21. fasthtml_tailwindcss-4.3.4/tests/test_component.py +139 -0
  22. fasthtml_tailwindcss-4.3.4/tests/test_releases.py +96 -0
  23. fasthtml_tailwindcss-4.3.4/tests/test_sessions.py +99 -0
  24. {fasthtml_tailwindcss-4.3.3 → fasthtml_tailwindcss-4.3.4}/tests/test_uvicorn.py +30 -27
  25. fasthtml_tailwindcss-4.3.3/PKG-INFO +0 -133
  26. fasthtml_tailwindcss-4.3.3/README.md +0 -105
  27. fasthtml_tailwindcss-4.3.3/binaries.json +0 -12
  28. fasthtml_tailwindcss-4.3.3/src/fasthtml_tailwindcss/__init__.py +0 -33
  29. fasthtml_tailwindcss-4.3.3/src/fasthtml_tailwindcss/_client.py +0 -156
  30. fasthtml_tailwindcss-4.3.3/src/fasthtml_tailwindcss/_worker.py +0 -133
  31. fasthtml_tailwindcss-4.3.3/tests/test_component.py +0 -83
  32. fasthtml_tailwindcss-4.3.3/tests/test_sessions.py +0 -95
  33. {fasthtml_tailwindcss-4.3.3 → fasthtml_tailwindcss-4.3.4}/LICENSE +0 -0
  34. {fasthtml_tailwindcss-4.3.3 → fasthtml_tailwindcss-4.3.4/packages/cli}/TAILWIND-LICENSE +0 -0
  35. {fasthtml_tailwindcss-4.3.3 → fasthtml_tailwindcss-4.3.4}/src/fasthtml_tailwindcss/py.typed +0 -0
@@ -24,6 +24,6 @@ htmlcov/
24
24
  .vscode/
25
25
  .DS_Store
26
26
  Thumbs.db
27
- /src/fasthtml_tailwindcss/bin/
27
+ /packages/cli/src/fasthtml_tailwindcss_cli/bin/
28
+ /.fasthtml-tailwindcss/
28
29
  /source-dist/
29
- /unpacked/
@@ -0,0 +1,172 @@
1
+ Metadata-Version: 2.5
2
+ Name: fasthtml-tailwindcss
3
+ Version: 4.3.4
4
+ Summary: Tailwind CSS for FastHTML with a persistent development watcher and a build command for production CSS.
5
+ Project-URL: Documentation, https://github.com/SpaceShaman/fasthtml-tailwindcss#readme
6
+ Project-URL: Homepage, https://github.com/SpaceShaman/fasthtml-tailwindcss
7
+ Project-URL: Issues, https://github.com/SpaceShaman/fasthtml-tailwindcss/issues
8
+ Project-URL: Repository, https://github.com/SpaceShaman/fasthtml-tailwindcss
9
+ Author-email: SpaceShaman <spaceshaman@tuta.io>
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: components,css,fasthtml,tailwindcss,web
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Programming Language :: Python :: 3.15
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.11
23
+ Requires-Dist: filelock>=3.16
24
+ Requires-Dist: python-fasthtml>=0.14.13
25
+ Provides-Extra: dev
26
+ Requires-Dist: fasthtml-tailwindcss-cli>=4.3.3; extra == 'dev'
27
+ Description-Content-Type: text/markdown
28
+
29
+ # fasthtml-tailwindcss
30
+
31
+ [![License](https://img.shields.io/github/license/SpaceShaman/fasthtml-tailwindcss)](LICENSE)
32
+ [![Release](https://img.shields.io/github/actions/workflow/status/SpaceShaman/fasthtml-tailwindcss/release.yml?label=release)](https://github.com/SpaceShaman/fasthtml-tailwindcss/actions/workflows/release.yml)
33
+ [![Python versions](https://img.shields.io/pypi/pyversions/fasthtml-tailwindcss)](https://pypi.org/project/fasthtml-tailwindcss/)
34
+ [![PyPI version](https://img.shields.io/pypi/v/fasthtml-tailwindcss)](https://pypi.org/project/fasthtml-tailwindcss/)
35
+ [![FastHTML](https://img.shields.io/badge/framework-FastHTML-7854F7)](https://github.com/AnswerDotAI/fasthtml)
36
+ [![Tailwind CSS](https://img.shields.io/badge/CSS-Tailwind_CSS-06B6D4?logo=tailwindcss&logoColor=white)](https://tailwindcss.com/)
37
+ [![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)
38
+ [![Pytest](https://img.shields.io/badge/testing-pytest-0A9EDC?logo=pytest)](https://docs.pytest.org/)
39
+ [![Ruff](https://img.shields.io/badge/linting-Ruff-D7FF64?logo=ruff)](https://github.com/astral-sh/ruff)
40
+
41
+ Tailwind CSS for [FastHTML](https://github.com/AnswerDotAI/fasthtml) with a persistent development watcher and a build command for production CSS.
42
+
43
+ ## Installation
44
+
45
+ - Development and builds:
46
+
47
+ ```sh
48
+ uv add "fasthtml-tailwindcss[dev]"
49
+ ```
50
+
51
+ Or with pip:
52
+
53
+ ```sh
54
+ pip install "fasthtml-tailwindcss[dev]"
55
+ ```
56
+
57
+ - Production:
58
+
59
+ ```sh
60
+ uv add fasthtml-tailwindcss
61
+ ```
62
+
63
+ Or with pip:
64
+
65
+ ```sh
66
+ pip install fasthtml-tailwindcss
67
+ ```
68
+
69
+ The `dev` extra installs the standalone compiler through [fasthtml-tailwindcss-cli](https://pypi.org/project/fasthtml-tailwindcss-cli/). No Node.js or npm is needed. Production only needs the wrapper and generated CSS.
70
+
71
+ On Alpine Linux, the compiler also needs:
72
+
73
+ ```sh
74
+ apk add --no-cache libstdc++ libgcc
75
+ ```
76
+
77
+ ## Usage
78
+
79
+ ```python
80
+ from fasthtml.common import Div, FastHTML, StaticImmutable
81
+ from fasthtml_tailwindcss import TailwindHead
82
+
83
+ app = FastHTML(hdrs=[TailwindHead(watch=True)])
84
+ app.mount("/static", StaticImmutable(directory="static"), name="static")
85
+
86
+
87
+ @app.route("/")
88
+ def get():
89
+ return Div("Hello", cls="rounded-lg bg-blue-500 p-4 text-white")
90
+ ```
91
+
92
+ `TailwindHead` creates the output directory and adds a stylesheet link. `vurl` versions the URL by content, and `StaticImmutable` lets browsers cache the CSS until it changes.
93
+
94
+ ### Watch mode
95
+
96
+ ```sh
97
+ uv run uvicorn main:app --reload
98
+ ```
99
+
100
+ For `app/main.py`, run `uv run --directory app uvicorn main:app --reload` from the project directory.
101
+
102
+ With `watch=True`, compilation starts on the first page render and CSS rebuilds when sources change. The watcher survives server reloads, restarts if settings change, and stops 15 seconds after the last application stops using it. Refresh the browser to see changes; automatic browser refresh and stylesheet updates during HTMX fragment swaps are not included.
103
+
104
+ ### Production
105
+
106
+ Use `TailwindHead()` with the default `watch=False` in the application, then build CSS in your deployment pipeline with the `dev` extra installed:
107
+
108
+ ```sh
109
+ uv run fasthtml-tailwindcss build main:app
110
+ ```
111
+
112
+ The command imports the app and builds minified CSS using its `TailwindHead` settings. The app must have exactly one `TailwindHead` in `hdrs`. For `app/main.py`, run `build app.main:app` from the project directory or `build main:app` from `app/`; both write to `app/static/tailwind.css` by default.
113
+
114
+ Deploy the generated CSS alongside the application. With `watch=False`, `TailwindHead` only links the stylesheet; it does not run the compiler.
115
+
116
+ ## Options
117
+
118
+ All configuration is passed to `TailwindHead`:
119
+
120
+ ```python
121
+ TailwindHead(
122
+ watch=True,
123
+ css="@theme { --color-brand: #7854f7; }",
124
+ output="static/app.css",
125
+ )
126
+ ```
127
+
128
+ - `watch`: enable the persistent development compiler. Defaults to `False`.
129
+ - `sources`: files or directories to scan. Defaults to the working directory; with a custom input, its own source detection applies unless extra sources are supplied.
130
+ - `input`: custom stylesheet, such as `input="assets/app.css"`, replacing the built-in `@import "tailwindcss"`. Relative CSS imports resolve from that file.
131
+ - `css`: CSS appended after the input, useful for `@theme`, variants, and `@source inline(...)`.
132
+ - `output`: CSS file path, defaulting to `./static/tailwind.css`. The stylesheet URL follows this path, so mount its directory at the corresponding URL.
133
+
134
+ Paths are relative to the working directory. The build command uses the application module's directory; run the server from that directory too. Temporary files and compiler logs live in `.fasthtml-tailwindcss/`.
135
+
136
+ Use complete class names such as `"bg-red-500"`; Tailwind cannot detect names constructed with `f"bg-{color}-500"`. Classes in installed component libraries need explicit sources or safelisting.
137
+
138
+ For inline Lucide SVG icons with typed names and editor autocomplete, see [fasthtml-lucide](https://github.com/SpaceShaman/fasthtml-lucide).
139
+
140
+ ## Development
141
+
142
+ ### Setup and tests
143
+
144
+ ```sh
145
+ uv sync --group build --group test --extra dev
146
+ uv run --group test --extra dev pytest
147
+ ```
148
+
149
+ ### Build
150
+
151
+ ```sh
152
+ uv build --no-sources
153
+ uv build packages/cli --no-sources
154
+ ```
155
+
156
+ CLI wheel builds download and verify the official executable using SHA-256. Supported platforms are Linux x64/ARM64 (glibc 2.28+ or musl 1.2+), macOS 13+ (Intel/Apple Silicon), and Windows x64. Building a CLI wheel needs network access unless the verified binary is already available locally.
157
+
158
+ ### Automated releases
159
+
160
+ GitHub Actions checks daily for a new stable [Tailwind CSS release](https://github.com/tailwindlabs/tailwindcss/releases), then builds and tests both packages before publishing them to PyPI. Both package versions track the Tailwind version; wrapper-only fixes may add a `.postN` suffix.
161
+
162
+ The [Release workflow](.github/workflows/release.yml) builds and tests both packages before publishing through PyPI Trusted Publishing. Configure the same publisher (`SpaceShaman/fasthtml-tailwindcss`, workflow `release.yml`, environment `pypi`) for both PyPI projects, and allow workflow version commits on the default branch.
163
+
164
+ ## Links
165
+
166
+ - [GitHub repository](https://github.com/SpaceShaman/fasthtml-tailwindcss)
167
+ - [PyPI package](https://pypi.org/project/fasthtml-tailwindcss/)
168
+ - [Tailwind CLI package](https://pypi.org/project/fasthtml-tailwindcss-cli/)
169
+
170
+ ## License
171
+
172
+ The wrapper and Tailwind CSS are MIT licensed. The CLI package includes both license notices.
@@ -0,0 +1,144 @@
1
+ # fasthtml-tailwindcss
2
+
3
+ [![License](https://img.shields.io/github/license/SpaceShaman/fasthtml-tailwindcss)](LICENSE)
4
+ [![Release](https://img.shields.io/github/actions/workflow/status/SpaceShaman/fasthtml-tailwindcss/release.yml?label=release)](https://github.com/SpaceShaman/fasthtml-tailwindcss/actions/workflows/release.yml)
5
+ [![Python versions](https://img.shields.io/pypi/pyversions/fasthtml-tailwindcss)](https://pypi.org/project/fasthtml-tailwindcss/)
6
+ [![PyPI version](https://img.shields.io/pypi/v/fasthtml-tailwindcss)](https://pypi.org/project/fasthtml-tailwindcss/)
7
+ [![FastHTML](https://img.shields.io/badge/framework-FastHTML-7854F7)](https://github.com/AnswerDotAI/fasthtml)
8
+ [![Tailwind CSS](https://img.shields.io/badge/CSS-Tailwind_CSS-06B6D4?logo=tailwindcss&logoColor=white)](https://tailwindcss.com/)
9
+ [![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)
10
+ [![Pytest](https://img.shields.io/badge/testing-pytest-0A9EDC?logo=pytest)](https://docs.pytest.org/)
11
+ [![Ruff](https://img.shields.io/badge/linting-Ruff-D7FF64?logo=ruff)](https://github.com/astral-sh/ruff)
12
+
13
+ Tailwind CSS for [FastHTML](https://github.com/AnswerDotAI/fasthtml) with a persistent development watcher and a build command for production CSS.
14
+
15
+ ## Installation
16
+
17
+ - Development and builds:
18
+
19
+ ```sh
20
+ uv add "fasthtml-tailwindcss[dev]"
21
+ ```
22
+
23
+ Or with pip:
24
+
25
+ ```sh
26
+ pip install "fasthtml-tailwindcss[dev]"
27
+ ```
28
+
29
+ - Production:
30
+
31
+ ```sh
32
+ uv add fasthtml-tailwindcss
33
+ ```
34
+
35
+ Or with pip:
36
+
37
+ ```sh
38
+ pip install fasthtml-tailwindcss
39
+ ```
40
+
41
+ The `dev` extra installs the standalone compiler through [fasthtml-tailwindcss-cli](https://pypi.org/project/fasthtml-tailwindcss-cli/). No Node.js or npm is needed. Production only needs the wrapper and generated CSS.
42
+
43
+ On Alpine Linux, the compiler also needs:
44
+
45
+ ```sh
46
+ apk add --no-cache libstdc++ libgcc
47
+ ```
48
+
49
+ ## Usage
50
+
51
+ ```python
52
+ from fasthtml.common import Div, FastHTML, StaticImmutable
53
+ from fasthtml_tailwindcss import TailwindHead
54
+
55
+ app = FastHTML(hdrs=[TailwindHead(watch=True)])
56
+ app.mount("/static", StaticImmutable(directory="static"), name="static")
57
+
58
+
59
+ @app.route("/")
60
+ def get():
61
+ return Div("Hello", cls="rounded-lg bg-blue-500 p-4 text-white")
62
+ ```
63
+
64
+ `TailwindHead` creates the output directory and adds a stylesheet link. `vurl` versions the URL by content, and `StaticImmutable` lets browsers cache the CSS until it changes.
65
+
66
+ ### Watch mode
67
+
68
+ ```sh
69
+ uv run uvicorn main:app --reload
70
+ ```
71
+
72
+ For `app/main.py`, run `uv run --directory app uvicorn main:app --reload` from the project directory.
73
+
74
+ With `watch=True`, compilation starts on the first page render and CSS rebuilds when sources change. The watcher survives server reloads, restarts if settings change, and stops 15 seconds after the last application stops using it. Refresh the browser to see changes; automatic browser refresh and stylesheet updates during HTMX fragment swaps are not included.
75
+
76
+ ### Production
77
+
78
+ Use `TailwindHead()` with the default `watch=False` in the application, then build CSS in your deployment pipeline with the `dev` extra installed:
79
+
80
+ ```sh
81
+ uv run fasthtml-tailwindcss build main:app
82
+ ```
83
+
84
+ The command imports the app and builds minified CSS using its `TailwindHead` settings. The app must have exactly one `TailwindHead` in `hdrs`. For `app/main.py`, run `build app.main:app` from the project directory or `build main:app` from `app/`; both write to `app/static/tailwind.css` by default.
85
+
86
+ Deploy the generated CSS alongside the application. With `watch=False`, `TailwindHead` only links the stylesheet; it does not run the compiler.
87
+
88
+ ## Options
89
+
90
+ All configuration is passed to `TailwindHead`:
91
+
92
+ ```python
93
+ TailwindHead(
94
+ watch=True,
95
+ css="@theme { --color-brand: #7854f7; }",
96
+ output="static/app.css",
97
+ )
98
+ ```
99
+
100
+ - `watch`: enable the persistent development compiler. Defaults to `False`.
101
+ - `sources`: files or directories to scan. Defaults to the working directory; with a custom input, its own source detection applies unless extra sources are supplied.
102
+ - `input`: custom stylesheet, such as `input="assets/app.css"`, replacing the built-in `@import "tailwindcss"`. Relative CSS imports resolve from that file.
103
+ - `css`: CSS appended after the input, useful for `@theme`, variants, and `@source inline(...)`.
104
+ - `output`: CSS file path, defaulting to `./static/tailwind.css`. The stylesheet URL follows this path, so mount its directory at the corresponding URL.
105
+
106
+ Paths are relative to the working directory. The build command uses the application module's directory; run the server from that directory too. Temporary files and compiler logs live in `.fasthtml-tailwindcss/`.
107
+
108
+ Use complete class names such as `"bg-red-500"`; Tailwind cannot detect names constructed with `f"bg-{color}-500"`. Classes in installed component libraries need explicit sources or safelisting.
109
+
110
+ For inline Lucide SVG icons with typed names and editor autocomplete, see [fasthtml-lucide](https://github.com/SpaceShaman/fasthtml-lucide).
111
+
112
+ ## Development
113
+
114
+ ### Setup and tests
115
+
116
+ ```sh
117
+ uv sync --group build --group test --extra dev
118
+ uv run --group test --extra dev pytest
119
+ ```
120
+
121
+ ### Build
122
+
123
+ ```sh
124
+ uv build --no-sources
125
+ uv build packages/cli --no-sources
126
+ ```
127
+
128
+ CLI wheel builds download and verify the official executable using SHA-256. Supported platforms are Linux x64/ARM64 (glibc 2.28+ or musl 1.2+), macOS 13+ (Intel/Apple Silicon), and Windows x64. Building a CLI wheel needs network access unless the verified binary is already available locally.
129
+
130
+ ### Automated releases
131
+
132
+ GitHub Actions checks daily for a new stable [Tailwind CSS release](https://github.com/tailwindlabs/tailwindcss/releases), then builds and tests both packages before publishing them to PyPI. Both package versions track the Tailwind version; wrapper-only fixes may add a `.postN` suffix.
133
+
134
+ The [Release workflow](.github/workflows/release.yml) builds and tests both packages before publishing through PyPI Trusted Publishing. Configure the same publisher (`SpaceShaman/fasthtml-tailwindcss`, workflow `release.yml`, environment `pypi`) for both PyPI projects, and allow workflow version commits on the default branch.
135
+
136
+ ## Links
137
+
138
+ - [GitHub repository](https://github.com/SpaceShaman/fasthtml-tailwindcss)
139
+ - [PyPI package](https://pypi.org/project/fasthtml-tailwindcss/)
140
+ - [Tailwind CLI package](https://pypi.org/project/fasthtml-tailwindcss-cli/)
141
+
142
+ ## License
143
+
144
+ The wrapper and Tailwind CSS are MIT licensed. The CLI package includes both license notices.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SpaceShaman
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,5 @@
1
+ # fasthtml-tailwindcss-cli
2
+
3
+ Platform-specific wheels containing the official standalone Tailwind CSS CLI binary. It is installed as the `dev` extra of [fasthtml-tailwindcss](https://pypi.org/project/fasthtml-tailwindcss/) and is not needed to serve a prebuilt stylesheet.
4
+
5
+ The package version matches the bundled Tailwind CSS release. See the [project repository](https://github.com/SpaceShaman/fasthtml-tailwindcss) for usage and release details.
@@ -0,0 +1,12 @@
1
+ {
2
+ "version": "4.3.4",
3
+ "sha256": {
4
+ "tailwindcss-linux-arm64": "f6d7baae1d350ed3a2defe98d0b5cc58e37400c0173b2e38d42f690ccc4bbfe1",
5
+ "tailwindcss-linux-arm64-musl": "64853a5d1321b9622eeceb16e28d26889fca409e3b1a2f95453088f776461e44",
6
+ "tailwindcss-linux-x64": "149a8ece5b855587a9c10de6da9dcbcfad0e47c4ed5dca219f721b3eae39d817",
7
+ "tailwindcss-linux-x64-musl": "2a5456987c41ce3311e423b603842af425ea5ac44505162dd348d43ed3b909fd",
8
+ "tailwindcss-macos-arm64": "a516a11b439bfbb5ecd4a2d13b75e6cdcc284dc710aed8731e31d2e5c03895a4",
9
+ "tailwindcss-macos-x64": "7ec771593a1fb8bbd204f70429361b0158f7989e4136bc68d04513bf543a15ba",
10
+ "tailwindcss-windows-x64.exe": "ad84612696f3be102fa005d4827f0df84c7b4570d31c06865ce5fde0311478af"
11
+ }
12
+ }
@@ -49,7 +49,7 @@ def download_binary(url, binary, expected):
49
49
 
50
50
  class CustomBuildHook(BuildHookInterface):
51
51
  def initialize(self, version, build_data):
52
- if self.target_name != "wheel":
52
+ if self.target_name not in {"wheel", "editable"}:
53
53
  return
54
54
  root = Path(self.root)
55
55
  manifest = json.loads((root / "binaries.json").read_text())
@@ -60,14 +60,24 @@ class CustomBuildHook(BuildHookInterface):
60
60
  raise RuntimeError(f"No official standalone Tailwind binary for {target}")
61
61
  suffix = ".exe" if target.startswith("windows-") else ""
62
62
  asset = f"tailwindcss-{target}{suffix}"
63
- expected = manifest["sha256"][asset]
64
- binary = root / "src" / "fasthtml_tailwindcss" / "bin" / f"tailwindcss{suffix}"
63
+ binary = (
64
+ root
65
+ / "src"
66
+ / "fasthtml_tailwindcss_cli"
67
+ / "bin"
68
+ / f"tailwindcss{suffix}"
69
+ )
65
70
  binary.parent.mkdir(parents=True, exist_ok=True)
66
- url = f"https://github.com/tailwindlabs/tailwindcss/releases/download/v{manifest['version']}/{asset}"
67
- download_binary(url, binary, expected)
71
+ url = (
72
+ "https://github.com/tailwindlabs/tailwindcss/releases/download/"
73
+ f"v{manifest['version']}/{asset}"
74
+ )
75
+ download_binary(url, binary, manifest["sha256"][asset])
68
76
  binary.chmod(0o755)
77
+ if self.target_name == "editable":
78
+ return
69
79
  build_data["pure_python"] = False
70
80
  build_data["tag"] = f"py3-none-{TARGETS[target]}"
71
81
  build_data["artifacts"].append(
72
- f"src/fasthtml_tailwindcss/bin/tailwindcss{suffix}"
82
+ f"src/fasthtml_tailwindcss_cli/bin/tailwindcss{suffix}"
73
83
  )
@@ -0,0 +1,34 @@
1
+ [project]
2
+ name = "fasthtml-tailwindcss-cli"
3
+ version = "4.3.4"
4
+ description = "Platform-specific Tailwind CSS standalone CLI binary for fasthtml-tailwindcss."
5
+ readme = "README.md"
6
+ requires-python = ">=3.11"
7
+ license = "MIT"
8
+ license-files = ["LICENSE", "TAILWIND-LICENSE"]
9
+ authors = [{ name = "SpaceShaman", email = "spaceshaman@tuta.io" }]
10
+ keywords = ["tailwindcss", "cli", "binary"]
11
+ classifiers = [
12
+ "Intended Audience :: Developers",
13
+ "Programming Language :: Python :: 3 :: Only",
14
+ "Programming Language :: Python :: 3.11",
15
+ "Programming Language :: Python :: 3.12",
16
+ "Programming Language :: Python :: 3.13",
17
+ "Programming Language :: Python :: 3.14",
18
+ "Programming Language :: Python :: 3.15",
19
+ "Topic :: Software Development :: Build Tools",
20
+ ]
21
+
22
+ [build-system]
23
+ requires = ["hatchling>=1.27"]
24
+ build-backend = "hatchling.build"
25
+
26
+ [tool.hatch.build.targets.wheel]
27
+ packages = ["src/fasthtml_tailwindcss_cli"]
28
+
29
+ [tool.hatch.build.targets.sdist]
30
+ include = ["/src", "/hatch_build.py", "/binaries.json", "/pyproject.toml", "/README.md", "/LICENSE", "/TAILWIND-LICENSE"]
31
+ exclude = ["/src/fasthtml_tailwindcss_cli/bin"]
32
+
33
+ [tool.hatch.build.hooks.custom]
34
+ path = "hatch_build.py"
@@ -0,0 +1,7 @@
1
+ import os
2
+ from pathlib import Path
3
+
4
+
5
+ def binary_path():
6
+ name = "tailwindcss.exe" if os.name == "nt" else "tailwindcss"
7
+ return Path(__file__).parent / "bin" / name
@@ -1,11 +1,11 @@
1
1
  [project]
2
2
  name = "fasthtml-tailwindcss"
3
- version = "4.3.3"
4
- description = "Tailwind CSS for FastHTML with a persistent compiler across server reloads and watch mode for automatic CSS rebuilds."
3
+ version = "4.3.4"
4
+ description = "Tailwind CSS for FastHTML with a persistent development watcher and a build command for production CSS."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
7
7
  license = "MIT"
8
- license-files = ["LICENSE", "TAILWIND-LICENSE"]
8
+ license-files = ["LICENSE"]
9
9
  authors = [{ name = "SpaceShaman", email = "spaceshaman@tuta.io" }]
10
10
  keywords = ["components", "css", "fasthtml", "tailwindcss", "web"]
11
11
  classifiers = [
@@ -19,7 +19,7 @@ classifiers = [
19
19
  "Topic :: Software Development :: Libraries :: Python Modules",
20
20
  "Typing :: Typed",
21
21
  ]
22
- dependencies = ["filelock>=3.16", "platformdirs>=4", "python-fasthtml>=0.14.13"]
22
+ dependencies = ["filelock>=3.16", "python-fasthtml>=0.14.13"]
23
23
 
24
24
  [project.urls]
25
25
  Documentation = "https://github.com/SpaceShaman/fasthtml-tailwindcss#readme"
@@ -27,7 +27,14 @@ Homepage = "https://github.com/SpaceShaman/fasthtml-tailwindcss"
27
27
  Issues = "https://github.com/SpaceShaman/fasthtml-tailwindcss/issues"
28
28
  Repository = "https://github.com/SpaceShaman/fasthtml-tailwindcss"
29
29
 
30
+ [project.scripts]
31
+ fasthtml-tailwindcss = "fasthtml_tailwindcss.build:main"
32
+
33
+ [project.optional-dependencies]
34
+ dev = ["fasthtml-tailwindcss-cli>=4.3.3"]
35
+
30
36
  [dependency-groups]
37
+ build = ["hatchling>=1.27"]
31
38
  test = ["httpx", "pytest", "uvicorn"]
32
39
 
33
40
  [build-system]
@@ -38,8 +45,8 @@ build-backend = "hatchling.build"
38
45
  packages = ["src/fasthtml_tailwindcss"]
39
46
 
40
47
  [tool.hatch.build.targets.sdist]
41
- include = ["/src", "/hatch_build.py", "/binaries.json", "/pyproject.toml", "/README.md", "/LICENSE", "/TAILWIND-LICENSE", "/tests"]
42
- exclude = ["/src/fasthtml_tailwindcss/bin"]
48
+ include = ["/src", "/packages/cli", "/pyproject.toml", "/README.md", "/LICENSE", "/tests", "/scripts"]
49
+ exclude = ["/packages/cli/src/fasthtml_tailwindcss_cli/bin"]
43
50
 
44
- [tool.hatch.build.hooks.custom]
45
- path = "hatch_build.py"
51
+ [tool.uv.sources]
52
+ fasthtml-tailwindcss-cli = { path = "packages/cli" }
@@ -0,0 +1,109 @@
1
+ import json
2
+ import os
3
+ import re
4
+ import tomllib
5
+ from pathlib import Path
6
+ from urllib.error import HTTPError
7
+ from urllib.request import Request, urlopen
8
+
9
+
10
+ def github_json(url):
11
+ headers = {
12
+ "Accept": "application/vnd.github+json",
13
+ "User-Agent": "fasthtml-tailwindcss",
14
+ }
15
+ if token := os.environ.get("GH_TOKEN"):
16
+ headers["Authorization"] = f"Bearer {token}"
17
+ with urlopen(Request(url, headers=headers), timeout=30) as response:
18
+ return json.load(response)
19
+
20
+
21
+ def project_version(path):
22
+ return tomllib.loads(Path(path).read_text())["project"]["version"]
23
+
24
+
25
+ def set_project_version(path, version):
26
+ path = Path(path)
27
+ text = path.read_text()
28
+ path.write_text(
29
+ re.sub(r'(?m)^version = "[^"]+"$', f'version = "{version}"', text, count=1)
30
+ )
31
+
32
+
33
+ def pypi_files(name, version):
34
+ try:
35
+ with urlopen(
36
+ f"https://pypi.org/pypi/{name}/{version}/json", timeout=30
37
+ ) as response:
38
+ return {item["filename"] for item in json.load(response)["urls"]}
39
+ except HTTPError as error:
40
+ if error.code != 404:
41
+ raise
42
+ return set()
43
+
44
+
45
+ manifest_path = Path("packages/cli/binaries.json")
46
+ cli_project = Path("packages/cli/pyproject.toml")
47
+ cli_license = Path("packages/cli/TAILWIND-LICENSE")
48
+ wrapper_project = Path("pyproject.toml")
49
+ wrapper_version = project_version(wrapper_project)
50
+ cli_version = project_version(cli_project)
51
+ manifest = json.loads(manifest_path.read_text())
52
+ if cli_version.split(".post")[0] != manifest["version"]:
53
+ raise ValueError("CLI package version must match binaries.json")
54
+ release = github_json(
55
+ "https://api.github.com/repos/tailwindlabs/tailwindcss/releases/latest"
56
+ )
57
+ latest = release["tag_name"].removeprefix("v")
58
+ if not re.fullmatch(r"\d+\.\d+\.\d+", latest):
59
+ raise ValueError(f"Expected a stable Tailwind release, got {latest!r}")
60
+
61
+ if tuple(map(int, latest.split("."))) > tuple(
62
+ map(int, cli_version.split(".post")[0].split("."))
63
+ ):
64
+ hashes = {}
65
+ for asset in release["assets"]:
66
+ if asset["name"] in manifest["sha256"]:
67
+ digest = asset.get("digest", "")
68
+ if not re.fullmatch(r"sha256:[0-9a-f]{64}", digest):
69
+ raise RuntimeError(f"Missing SHA256 digest for {asset['name']}")
70
+ hashes[asset["name"]] = digest.removeprefix("sha256:")
71
+ if hashes.keys() != manifest["sha256"].keys():
72
+ raise RuntimeError("Upstream release is missing a supported platform")
73
+ manifest_path.write_text(
74
+ json.dumps({"version": latest, "sha256": hashes}, indent=2) + "\n"
75
+ )
76
+ with urlopen(
77
+ f"https://raw.githubusercontent.com/tailwindlabs/tailwindcss/v{latest}/LICENSE",
78
+ timeout=30,
79
+ ) as response:
80
+ cli_license.write_bytes(response.read())
81
+ set_project_version(cli_project, latest)
82
+ set_project_version(wrapper_project, latest)
83
+ wrapper_version = cli_version = latest
84
+
85
+ wrapper_expected = {
86
+ f"fasthtml_tailwindcss-{wrapper_version}-py3-none-any.whl",
87
+ f"fasthtml_tailwindcss-{wrapper_version}.tar.gz",
88
+ }
89
+ tags = [
90
+ "manylinux_2_28_x86_64",
91
+ "manylinux_2_28_aarch64",
92
+ "musllinux_1_2_x86_64",
93
+ "musllinux_1_2_aarch64",
94
+ "macosx_13_0_x86_64",
95
+ "macosx_13_0_arm64",
96
+ "win_amd64",
97
+ ]
98
+ cli_expected = {
99
+ f"fasthtml_tailwindcss_cli-{cli_version}-py3-none-{tag}.whl" for tag in tags
100
+ }
101
+ cli_expected.add(f"fasthtml_tailwindcss_cli-{cli_version}.tar.gz")
102
+ wrapper_missing = wrapper_expected - pypi_files(
103
+ "fasthtml-tailwindcss", wrapper_version
104
+ )
105
+ cli_missing = cli_expected - pypi_files("fasthtml-tailwindcss-cli", cli_version)
106
+
107
+ with open(os.environ["GITHUB_OUTPUT"], "a") as output:
108
+ output.write(f"version={wrapper_version}\n")
109
+ output.write(f"release={str(bool(wrapper_missing or cli_missing)).lower()}\n")
@@ -0,0 +1,25 @@
1
+ import json
2
+ import tomllib
3
+ from pathlib import Path
4
+ from urllib.error import HTTPError
5
+ from urllib.request import urlopen
6
+
7
+
8
+ def published_files(project, release):
9
+ try:
10
+ with urlopen(
11
+ f"https://pypi.org/pypi/{project}/{release}/json", timeout=30
12
+ ) as response:
13
+ return {item["filename"] for item in json.load(response)["urls"]}
14
+ except HTTPError as error:
15
+ if error.code == 404:
16
+ return set()
17
+ raise
18
+
19
+
20
+ for path in (Path("pyproject.toml"), Path("packages/cli/pyproject.toml")):
21
+ project = tomllib.loads(path.read_text())["project"]
22
+ published = published_files(project["name"], project["version"])
23
+ for artifact in Path("dist").iterdir():
24
+ if artifact.name in published:
25
+ artifact.unlink()