django-tailwind-cli 2.4.5__tar.gz → 2.6.0__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 (15) hide show
  1. {django_tailwind_cli-2.4.5 → django_tailwind_cli-2.6.0}/PKG-INFO +3 -2
  2. {django_tailwind_cli-2.4.5 → django_tailwind_cli-2.6.0}/pyproject.toml +17 -6
  3. {django_tailwind_cli-2.4.5 → django_tailwind_cli-2.6.0}/src/django_tailwind_cli/management/commands/tailwind.py +31 -13
  4. {django_tailwind_cli-2.4.5 → django_tailwind_cli-2.6.0}/src/django_tailwind_cli/utils.py +19 -7
  5. {django_tailwind_cli-2.4.5 → django_tailwind_cli-2.6.0}/LICENSE +0 -0
  6. {django_tailwind_cli-2.4.5 → django_tailwind_cli-2.6.0}/README.md +0 -0
  7. {django_tailwind_cli-2.4.5 → django_tailwind_cli-2.6.0}/src/django_tailwind_cli/__init__.py +0 -0
  8. {django_tailwind_cli-2.4.5 → django_tailwind_cli-2.6.0}/src/django_tailwind_cli/apps.py +0 -0
  9. {django_tailwind_cli-2.4.5 → django_tailwind_cli-2.6.0}/src/django_tailwind_cli/management/__init__.py +0 -0
  10. {django_tailwind_cli-2.4.5 → django_tailwind_cli-2.6.0}/src/django_tailwind_cli/management/commands/__init__.py +0 -0
  11. {django_tailwind_cli-2.4.5 → django_tailwind_cli-2.6.0}/src/django_tailwind_cli/py.typed +0 -0
  12. {django_tailwind_cli-2.4.5 → django_tailwind_cli-2.6.0}/src/django_tailwind_cli/templates/tailwind_cli/base.html +0 -0
  13. {django_tailwind_cli-2.4.5 → django_tailwind_cli-2.6.0}/src/django_tailwind_cli/templates/tailwind_cli/tailwind_css.html +0 -0
  14. {django_tailwind_cli-2.4.5 → django_tailwind_cli-2.6.0}/src/django_tailwind_cli/templatetags/__init__.py +0 -0
  15. {django_tailwind_cli-2.4.5 → django_tailwind_cli-2.6.0}/src/django_tailwind_cli/templatetags/tailwind_cli.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-tailwind-cli
3
- Version: 2.4.5
3
+ Version: 2.6.0
4
4
  Summary: Django and Tailwind integration based on the prebuilt Tailwind CSS CLI.
5
5
  Home-page: https://django-tailwind-cli.andrich.me/
6
6
  License: MIT
@@ -13,6 +13,7 @@ Classifier: Environment :: Web Environment
13
13
  Classifier: Framework :: Django :: 3.2
14
14
  Classifier: Framework :: Django :: 4.1
15
15
  Classifier: Framework :: Django :: 4.2
16
+ Classifier: Framework :: Django :: 5.0
16
17
  Classifier: Intended Audience :: Developers
17
18
  Classifier: License :: OSI Approved :: MIT License
18
19
  Classifier: Operating System :: OS Independent
@@ -26,7 +27,7 @@ Classifier: Topic :: Software Development :: Libraries
26
27
  Classifier: Topic :: Utilities
27
28
  Provides-Extra: django-extensions
28
29
  Requires-Dist: certifi (>=2023.7.22,<2024.0.0)
29
- Requires-Dist: django (>=3.2,<5.0)
30
+ Requires-Dist: django (>=3.2)
30
31
  Requires-Dist: django-extensions (>=3.2.1,<4.0.0) ; extra == "django-extensions"
31
32
  Requires-Dist: werkzeug (>=3.0.0,<4.0.0) ; extra == "django-extensions"
32
33
  Project-URL: Documentation, https://django-tailwind-cli.andrich.me/
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "django-tailwind-cli"
3
- version = "2.4.5"
3
+ version = "2.6.0"
4
4
  description = "Django and Tailwind integration based on the prebuilt Tailwind CSS CLI."
5
5
  authors = ["Oliver Andrich <oliver@andrich.me>"]
6
6
  readme = "README.md"
@@ -25,12 +25,13 @@ classifiers = [
25
25
  "Framework :: Django :: 3.2",
26
26
  "Framework :: Django :: 4.1",
27
27
  "Framework :: Django :: 4.2",
28
+ "Framework :: Django :: 5.0",
28
29
  ]
29
30
  packages = [{ include = "django_tailwind_cli", from = "src" }]
30
31
 
31
32
  [tool.poetry.dependencies]
32
33
  python = "^3.8.1"
33
- django = ">=3.2,<5.0"
34
+ django = ">=3.2"
34
35
  certifi = "^2023.7.22"
35
36
  django-extensions = { version = "^3.2.1", optional = true }
36
37
  werkzeug = { version = "^3.0.0", optional = true }
@@ -39,10 +40,13 @@ werkzeug = { version = "^3.0.0", optional = true }
39
40
  "django-extensions" = ["django-extensions", "werkzeug"]
40
41
 
41
42
  [tool.poetry.group.dev.dependencies]
42
- django-types = ">=0.17,<0.19"
43
+ django-types = ">=0.17,<0.20"
43
44
  mkdocs-material = "^9.3.1"
44
- django-rich = "^1.7.0"
45
45
  coverage = { extras = ["toml"], version = "^7.3.2" }
46
+ pytest = "^7.4.2"
47
+ pytest-django = "^4.5.2"
48
+ pytest-cov = "^4.1.0"
49
+ pytest-mock = "^3.12.0"
46
50
 
47
51
  [build-system]
48
52
  requires = ["poetry-core"]
@@ -51,7 +55,7 @@ build-backend = "poetry.core.masonry.api"
51
55
  # Black
52
56
  [tool.black]
53
57
  target-version = ["py38"]
54
- line-length = 120
58
+ line-length = 100
55
59
  skip-string-normalization = true
56
60
  exclude = '''
57
61
  /(
@@ -75,7 +79,7 @@ venv = "."
75
79
  # Ruff
76
80
  [tool.ruff]
77
81
  target-version = "py38"
78
- line-length = 120
82
+ line-length = 100
79
83
  select = [
80
84
  "A",
81
85
  "ARG",
@@ -137,6 +141,13 @@ ban-relative-imports = "all"
137
141
  "tests/**/*" = ["PLR2004", "S101", "TID252"]
138
142
  "tests/snapshots/*" = ["ALL"]
139
143
 
144
+ # Pytest
145
+ [tool.pytest.ini_options]
146
+ DJANGO_SETTINGS_MODULE = "tests.settings"
147
+ pythonpath = [".", "src"]
148
+ django_find_project = false
149
+ markers = ["mock_network_and_subprocess"]
150
+
140
151
  # Coverage
141
152
  [tool.coverage.run]
142
153
  source = ["django_tailwind_cli", "tests"]
@@ -46,30 +46,40 @@ class Command(BaseCommand):
46
46
  subparsers.add_parser("list_templates", help="List the templates of your django project.")
47
47
 
48
48
  runserver_parser = subparsers.add_parser(
49
- "runserver", help="Start the Django development server and the Tailwind CLI in watch mode."
49
+ "runserver",
50
+ help="Start the Django development server and the Tailwind CLI in watch mode.",
50
51
  )
51
52
 
52
- runserver_parser.add_argument("addrport", nargs="?", help="Optional port number, or ipaddr:port")
53
+ runserver_parser.add_argument(
54
+ "addrport", nargs="?", help="Optional port number, or ipaddr:port"
55
+ )
53
56
 
54
57
  runserver_plus_parser = subparsers.add_parser(
55
58
  "runserver_plus",
56
- help="Start the django-extensions runserver_plus development server and the Tailwind CLI in watch mode.",
59
+ help=(
60
+ "Start the django-extensions runserver_plus development server and the "
61
+ "Tailwind CLI in watch mode."
62
+ ),
57
63
  )
58
64
 
59
- runserver_plus_parser.add_argument("addrport", nargs="?", help="Optional port number, or ipaddr:port")
65
+ runserver_plus_parser.add_argument(
66
+ "addrport", nargs="?", help="Optional port number, or ipaddr:port"
67
+ )
60
68
 
61
69
  runserver_plus_parser.add_argument(
62
70
  "--cert-file", help="Optional SSL certificate file to use for the development server."
63
71
  )
64
72
  runserver_plus_parser.add_argument(
65
- "--cert", help="[DEPRECATED] Optional SSL certificate file to use for the development server."
73
+ "--cert",
74
+ help="[DEPRECATED] Optional SSL certificate file to use for the development server.",
66
75
  )
67
76
  runserver_plus_parser.add_argument(
68
77
  "--key-file", help="Optional SSL certificate file to use for the development server."
69
78
  )
70
79
 
71
80
  runserver_plus_parser.add_argument(
72
- "--reloader-interval", help="Optional SSL certificate file to use for the development server."
81
+ "--reloader-interval",
82
+ help="Optional SSL certificate file to use for the development server.",
73
83
  )
74
84
 
75
85
  def handle(self, *_args: Any, **kwargs: Any) -> None:
@@ -93,7 +103,9 @@ class Command(BaseCommand):
93
103
  kwargs["runserver_cmd"] = "runserver"
94
104
  self.runserver(**kwargs)
95
105
  elif label == "runserver_plus":
96
- if importlib.util.find_spec("django_extensions") and importlib.util.find_spec("werkzeug"):
106
+ if importlib.util.find_spec("django_extensions") and importlib.util.find_spec(
107
+ "werkzeug"
108
+ ):
97
109
  kwargs["runserver_cmd"] = "runserver_plus"
98
110
  self.runserver(**kwargs)
99
111
  else:
@@ -110,7 +122,9 @@ class Command(BaseCommand):
110
122
  self.stdout.write(self.style.ERROR("Canceled building production stylesheet."))
111
123
  else:
112
124
  self.stdout.write(
113
- self.style.SUCCESS(f"Built production stylesheet '{self.config.get_full_dist_css_path()}'.")
125
+ self.style.SUCCESS(
126
+ f"Built production stylesheet '{self.config.get_full_dist_css_path()}'."
127
+ )
114
128
  )
115
129
 
116
130
  def watch(self) -> None:
@@ -230,12 +244,14 @@ class Command(BaseCommand):
230
244
 
231
245
  if not dest_file.exists():
232
246
  self.stdout.write(self.style.ERROR("Tailwind CSS CLI not found."))
233
- self.stdout.write(self.style.WARNING(f"Downloading Tailwind CSS CLI from '{download_url}'"))
247
+ self.stdout.write(
248
+ self.style.WARNING(f"Downloading Tailwind CSS CLI from '{download_url}'")
249
+ )
234
250
  dest_file.parent.mkdir(parents=True, exist_ok=True)
235
251
  certifi_context = ssl.create_default_context(cafile=certifi.where())
236
- with urllib.request.urlopen(download_url, context=certifi_context) as source, dest_file.open( # noqa: S310
237
- mode="wb"
238
- ) as dest:
252
+ with urllib.request.urlopen( # noqa: S310
253
+ download_url, context=certifi_context
254
+ ) as source, dest_file.open(mode="wb") as dest:
239
255
  shutil.copyfileobj(source, dest)
240
256
  # make cli executable
241
257
  dest_file.chmod(0o755)
@@ -247,7 +263,9 @@ class Command(BaseCommand):
247
263
  if not tailwind_config_file.exists():
248
264
  self.stdout.write(self.style.ERROR("Tailwind CSS config not found."))
249
265
  tailwind_config_file.write_text(DEFAULT_TAILWIND_CONFIG)
250
- self.stdout.write(self.style.SUCCESS(f"Created Tailwind CSS config at '{tailwind_config_file}'"))
266
+ self.stdout.write(
267
+ self.style.SUCCESS(f"Created Tailwind CSS config at '{tailwind_config_file}'")
268
+ )
251
269
 
252
270
 
253
271
  DEFAULT_TAILWIND_CONFIG = """/** @type {import('tailwindcss').Config} */
@@ -15,13 +15,25 @@ from django.conf import settings
15
15
  class Config:
16
16
  """Configuration for the Tailwind CSS CLI."""
17
17
 
18
- def __init__(self) -> None:
19
- """Initialize the configuration."""
20
- self.tailwind_version: str = getattr(settings, "TAILWIND_CLI_VERSION", "3.3.3")
21
- self.cli_path: Union[str, None] = getattr(settings, "TAILWIND_CLI_PATH", "~/.local/bin/")
22
- self.src_css: Union[str, None] = getattr(settings, "TAILWIND_CLI_SRC_CSS", None)
23
- self.dist_css: str = getattr(settings, "TAILWIND_CLI_DIST_CSS", "css/tailwind.css")
24
- self.config_file: str = getattr(settings, "TAILWIND_CLI_CONFIG_FILE", "tailwind.config.js")
18
+ @property
19
+ def tailwind_version(self) -> str:
20
+ return getattr(settings, "TAILWIND_CLI_VERSION", "3.3.5")
21
+
22
+ @property
23
+ def cli_path(self) -> Union[str, None]:
24
+ return getattr(settings, "TAILWIND_CLI_PATH", "~/.local/bin/")
25
+
26
+ @property
27
+ def src_css(self) -> Union[str, None]:
28
+ return getattr(settings, "TAILWIND_CLI_SRC_CSS", None)
29
+
30
+ @property
31
+ def dist_css(self) -> str:
32
+ return getattr(settings, "TAILWIND_CLI_DIST_CSS", "css/tailwind.css")
33
+
34
+ @property
35
+ def config_file(self) -> str:
36
+ return getattr(settings, "TAILWIND_CLI_CONFIG_FILE", "tailwind.config.js")
25
37
 
26
38
  def validate_settings(self) -> None:
27
39
  """Validate the settings."""