proper_new 0.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.
@@ -0,0 +1,32 @@
1
+ Metadata-Version: 2.4
2
+ Name: proper_new
3
+ Version: 0.4
4
+ Summary: A script to generate a new Proper project
5
+ Author-email: Juan Pablo Scaletti <juanpablo@jpscaletti.com>
6
+ License-Expression: MIT
7
+ Project-URL: repository, https://github.com/jpsca/proper-new
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Environment :: Web Environment
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3 :: Only
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Programming Language :: Python :: 3.14
15
+ Classifier: Typing :: Typed
16
+ Requires-Python: <4,>=3.12
17
+ Description-Content-Type: text/markdown
18
+ Requires-Dist: hecto>=2.2.1
19
+ Requires-Dist: inflection>=0.5.1
20
+
21
+ # proper-new
22
+
23
+ A script to generate a new Proper project
24
+
25
+ Usage: `uvx proper_new <path> [options]`
26
+
27
+ | Option | Description |
28
+ |-----------------|-------------|
29
+ | **name** | Optional name of the app instead of the one in `path`
30
+ | **src** | Optional source url/path of the blueprint instead of the default one
31
+ | **force** | Overwrite files that already exist, without asking. `False` by default
32
+ | **no-tailwind** | Do not use Tailwind CSS.
@@ -0,0 +1,12 @@
1
+ # proper-new
2
+
3
+ A script to generate a new Proper project
4
+
5
+ Usage: `uvx proper_new <path> [options]`
6
+
7
+ | Option | Description |
8
+ |-----------------|-------------|
9
+ | **name** | Optional name of the app instead of the one in `path`
10
+ | **src** | Optional source url/path of the blueprint instead of the default one
11
+ | **force** | Overwrite files that already exist, without asking. `False` by default
12
+ | **no-tailwind** | Do not use Tailwind CSS.
@@ -0,0 +1,114 @@
1
+ [build-system]
2
+ requires = ["setuptools"]
3
+
4
+
5
+ [project]
6
+ name = "proper_new"
7
+ version = "0.4"
8
+ description = "A script to generate a new Proper project"
9
+ authors = [
10
+ {name = "Juan Pablo Scaletti", email = "juanpablo@jpscaletti.com"},
11
+ ]
12
+ license = "MIT"
13
+ readme = "README.md"
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Environment :: Web Environment",
17
+ "Intended Audience :: Developers",
18
+ "Programming Language :: Python :: 3 :: Only",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
21
+ "Programming Language :: Python :: 3.14",
22
+ "Typing :: Typed",
23
+ ]
24
+ requires-python = ">=3.12,<4"
25
+ dependencies = [
26
+ "hecto>=2.2.1",
27
+ "inflection>=0.5.1",
28
+ ]
29
+
30
+ [project.urls]
31
+ repository = "https://github.com/jpsca/proper-new"
32
+
33
+ [project.scripts]
34
+ proper_new= "proper_new:run"
35
+
36
+
37
+ [dependency-groups]
38
+ dev = [
39
+ "ipdb",
40
+ "ruff",
41
+ "ty",
42
+ ]
43
+ test = [
44
+ "pytest",
45
+ ]
46
+
47
+
48
+ [tool.ty.src]
49
+ exclude = [
50
+ "**/__pycache__",
51
+ "tests.py",
52
+ ]
53
+
54
+
55
+ [tool.ruff]
56
+ line-length = 90
57
+ indent-width = 4
58
+ target-version = "py314"
59
+ exclude = [
60
+ ".*",
61
+ "_build",
62
+ "build",
63
+ "dist",
64
+ ]
65
+ include = ["*.py"]
66
+
67
+ [tool.ruff.format]
68
+ # Like Black, use double quotes for strings.
69
+ quote-style = "double"
70
+ # Like Black, indent with spaces, rather than tabs.
71
+ indent-style = "space"
72
+ # Like Black, respect magic trailing commas.
73
+ skip-magic-trailing-comma = false
74
+ # Like Black, automatically detect the appropriate line ending.
75
+ line-ending = "auto"
76
+
77
+ [tool.ruff.lint]
78
+ fixable = ["ALL"]
79
+ ignore = [
80
+ # x is too complex
81
+ "C901",
82
+ # whitespace before ':'
83
+ "E203",
84
+ "E501",
85
+ # x defined from star imports
86
+ "F405",
87
+ # line break before binary operator
88
+ "W505",
89
+ "W605",
90
+ ]
91
+ select = [
92
+ # bugbear
93
+ "B",
94
+ # mccabe"", comprehensions, commas
95
+ "C",
96
+ # pycodestyle errors
97
+ "E",
98
+ # pyflakes
99
+ "F",
100
+ # logging format
101
+ "G",
102
+ # imports
103
+ "I",
104
+ # quotes
105
+ "Q",
106
+ # pycodestyle warnings
107
+ "W",
108
+ ]
109
+
110
+ [tool.ruff.lint.isort]
111
+ no-lines-before = ["local-folder"]
112
+ relative-imports-order = "furthest-to-closest"
113
+ # Use two line after imports.
114
+ lines-after-imports = 2
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,145 @@
1
+ import argparse
2
+ import os
3
+ import sys
4
+ from pathlib import Path
5
+
6
+ import inflection
7
+ from hecto import (
8
+ COLORS,
9
+ confirm,
10
+ printf,
11
+ render_blueprint,
12
+ )
13
+
14
+
15
+ APP_BLUEPRINT = "git@github.com:jpsca/proper.git#blueprint"
16
+
17
+
18
+ def call(cmd: str) -> None:
19
+ printf("run", cmd, color=COLORS.OK)
20
+ os.system(cmd)
21
+
22
+
23
+ def gen_app(
24
+ path: str | Path,
25
+ *,
26
+ name: str = "",
27
+ src: str = APP_BLUEPRINT,
28
+ force: bool = False,
29
+ use_tailwindcss: bool = True,
30
+ install_deps: bool = True,
31
+ ) -> None:
32
+ """Creates a new Proper application at `path`.
33
+
34
+ Args:
35
+ path:
36
+ Where to create the new application.
37
+ name:
38
+ Optional name of the app instead of the one in `path`
39
+ force:
40
+ Overwrite files that already exist, without asking.
41
+ install_deps:
42
+ Whether to install dependencies after generating the app.
43
+
44
+ """
45
+ path = Path(path).resolve().absolute()
46
+ if path.exists():
47
+ if not force and not confirm("Path already exists. Continue?", default=False):
48
+ return
49
+ else:
50
+ path.mkdir(parents=True, exist_ok=False)
51
+ app_name = inflection.underscore(name or str(path.stem))
52
+
53
+ render_blueprint(
54
+ src,
55
+ path,
56
+ context={
57
+ "app_name": app_name,
58
+ "use_tailwindcss": use_tailwindcss,
59
+ },
60
+ force=force,
61
+ )
62
+ print()
63
+
64
+ if use_tailwindcss:
65
+ (path / "static" / "css" / "app.css").unlink(missing_ok=True)
66
+ else:
67
+ (path / "static" / "css" / "_input.css").unlink(missing_ok=True)
68
+
69
+ if install_deps:
70
+ _install_dependencies(path)
71
+ wrap_up(path)
72
+
73
+
74
+ def _install_dependencies(path: Path) -> None:
75
+ os.chdir(path)
76
+ venv_path = str(path / ".venv")
77
+ os.environ["VIRTUAL_ENV"] = venv_path
78
+ call(f"""cd {str(path)} \\
79
+ && uv venv \\
80
+ && uv sync --group dev
81
+ """)
82
+ # call("tailwindcss_install")
83
+
84
+
85
+ def wrap_up(path: Path) -> None:
86
+ print("✨ Done! ✨")
87
+ print()
88
+ print(" The following steps are missing:")
89
+ print()
90
+ print(" $ cd " + path.stem + "")
91
+ print(" $ source .venv/bin/activate")
92
+ print()
93
+ print(" Start your Proper app with:")
94
+ print()
95
+ print(" $ proper run")
96
+ print()
97
+
98
+
99
+ def run():
100
+ usage = "uvx proper_new <path> [--name <app_name>] [--force] [--no-tailwind]"
101
+ description="""
102
+ The `proper_new` command creates a new Proper application at the path you specify.
103
+ """.strip()
104
+
105
+ if len(sys.argv) == 1:
106
+ print("Usage:")
107
+ print(f" {usage}")
108
+ sys.exit(1)
109
+
110
+ parser = argparse.ArgumentParser(
111
+ usage=usage,
112
+ description=description
113
+ )
114
+ parser.add_argument("path", help="The required path argument")
115
+ parser.add_argument("--name", help="Optional name of the app instead of the one in `path`", default="")
116
+ parser.add_argument("--src", help="Optional source url/path of the blueprint instead of the default one", default="")
117
+ parser.add_argument("--force", help="Overwrite files that already exist, without asking", action="store_true")
118
+ parser.add_argument("--no-tailwind", help="Do not use Tailwind CSS", action="store_false")
119
+ args = parser.parse_args()
120
+ gen_app(
121
+ args.path,
122
+ name=args.name,
123
+ src=args.src,
124
+ force=args.force,
125
+ use_tailwindcss=not args.no_tailwind)
126
+
127
+
128
+ def print_banner():
129
+ print("""
130
+ ░███████████
131
+ ░███ ░███
132
+ ░███ ░███░████████ ░██████ ░████████ ░██████ ░████████
133
+ ░██████████ ░███ ░██░███ ░███ ░███ ░███ ░███ ░███ ░███ ░██
134
+ ░███ ░███ ░███ ░███ ░███ ░███ ░███████ ░███
135
+ ░███ ░███ ░███ ░███ ░███ ░███ ░███ ░███
136
+ ░█████ ░█████ ░██████ ░███████ ░██████ ░█████
137
+ ░███
138
+ ░███
139
+ ░█████
140
+ """)
141
+
142
+
143
+ if __name__ == "__main__":
144
+ print_banner()
145
+ run()
@@ -0,0 +1,32 @@
1
+ Metadata-Version: 2.4
2
+ Name: proper_new
3
+ Version: 0.4
4
+ Summary: A script to generate a new Proper project
5
+ Author-email: Juan Pablo Scaletti <juanpablo@jpscaletti.com>
6
+ License-Expression: MIT
7
+ Project-URL: repository, https://github.com/jpsca/proper-new
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Environment :: Web Environment
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3 :: Only
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Programming Language :: Python :: 3.14
15
+ Classifier: Typing :: Typed
16
+ Requires-Python: <4,>=3.12
17
+ Description-Content-Type: text/markdown
18
+ Requires-Dist: hecto>=2.2.1
19
+ Requires-Dist: inflection>=0.5.1
20
+
21
+ # proper-new
22
+
23
+ A script to generate a new Proper project
24
+
25
+ Usage: `uvx proper_new <path> [options]`
26
+
27
+ | Option | Description |
28
+ |-----------------|-------------|
29
+ | **name** | Optional name of the app instead of the one in `path`
30
+ | **src** | Optional source url/path of the blueprint instead of the default one
31
+ | **force** | Overwrite files that already exist, without asking. `False` by default
32
+ | **no-tailwind** | Do not use Tailwind CSS.
@@ -0,0 +1,9 @@
1
+ README.md
2
+ pyproject.toml
3
+ src/proper_new/__init__.py
4
+ src/proper_new.egg-info/PKG-INFO
5
+ src/proper_new.egg-info/SOURCES.txt
6
+ src/proper_new.egg-info/dependency_links.txt
7
+ src/proper_new.egg-info/entry_points.txt
8
+ src/proper_new.egg-info/requires.txt
9
+ src/proper_new.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ proper_new = proper_new:run
@@ -0,0 +1,2 @@
1
+ hecto>=2.2.1
2
+ inflection>=0.5.1
@@ -0,0 +1 @@
1
+ proper_new