From a3d20860b6a148364ea4ab11952784dc411510e1 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Sat, 31 Jan 2026 22:23:35 +0545 Subject: [PATCH] refactor(root): migrate project to src layout and update CLI entry points New Features - Add Typer dependency. Enhancements - Move packages to src/ layout and update build configuration. - Change console scripts to use djinit.cli:app. - Exclude django-new from ruff checks. - Raise minimum Python version to >=3.10. Bug Fixes - none --- pyproject.toml | 7 ++++--- ruff.toml | 1 + setup.py | 12 ++++++------ uv.lock | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 9 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2b27215..d93267d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["hatchling"] build-backend = "hatchling.build" [tool.hatch.build.targets.wheel] -packages = ["djinit"] +packages = ["src/djinit"] [project] name = "djinitx" @@ -49,14 +49,15 @@ classifiers=[ dependencies = [ "rich>=14.2.0", "questionary>=2.0.1", + "typer>=0.21.1", ] [project.urls] Homepage = "https://github.com/S4NKALP/djinit" [project.scripts] -djinit = "djinit.generator:main" -dj = "djinit.generator:main" +djinit = "djinit.cli:app" +dj = "djinit.cli:app" [dependency-groups] dev = [ diff --git a/ruff.toml b/ruff.toml index 9adb00f..c693f21 100644 --- a/ruff.toml +++ b/ruff.toml @@ -2,6 +2,7 @@ line-length = 120 target-version = "py38" +exclude = ["django-new"] [lint] select = [ diff --git a/setup.py b/setup.py index 3127149..49fb89f 100644 --- a/setup.py +++ b/setup.py @@ -9,18 +9,18 @@ setup( author="Sankalp Tharu", author_email="sankalptharu50028@gmail.com", url="https://github.com/S4NKALP/djinit", - packages=find_packages(include=["djinit", "djinit.*"]), + packages=find_packages(where="src"), + package_dir={"": "src"}, include_package_data=True, install_requires=[ - "ruff>=0.14.2", - "click>=8.3.0", "rich>=14.2.0", "questionary>=2.0.1", + "typer>=0.21.1", ], entry_points={ "console_scripts": [ - "djinit=djinit.generator:main", - "dj=djinit.generator:main", + "djinit=djinit.cli:app", + "dj=djinit.cli:app", ] }, classifiers=[ @@ -54,7 +54,7 @@ setup( "django project", "django starter", ], - python_requires=">=3.13", + python_requires=">=3.10", project_urls={ "Bug Reports": "https://github.com/S4NKALP/djinit/issues", "Source": "https://github.com/S4NKALP/djinit", diff --git a/uv.lock b/uv.lock index 8060923..4d6b15b 100644 --- a/uv.lock +++ b/uv.lock @@ -11,6 +11,27 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/db/3c/33bac158f8ab7f89b2e59426d5fe2e4f63f7ed25df84c036890172b412b5/cfgv-3.5.0-py2.py3-none-any.whl", hash = "sha256:a8dc6b26ad22ff227d2634a65cb388215ce6cc96bbcc5cfde7641ae87e8dacc0", size = 7445, upload-time = "2025-11-19T20:55:50.744Z" }, ] +[[package]] +name = "click" +version = "8.3.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "colorama", marker = "sys_platform == 'win32'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/3d/fa/656b739db8587d7b5dfa22e22ed02566950fbfbcdc20311993483657a5c0/click-8.3.1.tar.gz", hash = "sha256:12ff4785d337a1bb490bb7e9c2b1ee5da3112e94a8622f26a6c77f5d2fc6842a", size = 295065, upload-time = "2025-11-15T20:45:42.706Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/98/78/01c019cdb5d6498122777c1a43056ebb3ebfeef2076d9d026bfe15583b2b/click-8.3.1-py3-none-any.whl", hash = "sha256:981153a64e25f12d547d3426c367a4857371575ee7ad18df2a6183ab0545b2a6", size = 108274, upload-time = "2025-11-15T20:45:41.139Z" }, +] + +[[package]] +name = "colorama" +version = "0.4.6" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697, upload-time = "2022-10-25T02:36:22.414Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" }, +] + [[package]] name = "distlib" version = "0.4.0" @@ -27,6 +48,7 @@ source = { editable = "." } dependencies = [ { name = "questionary" }, { name = "rich" }, + { name = "typer" }, ] [package.dev-dependencies] @@ -39,6 +61,7 @@ dev = [ requires-dist = [ { name = "questionary", specifier = ">=2.0.1" }, { name = "rich", specifier = ">=14.2.0" }, + { name = "typer", specifier = ">=0.21.1" }, ] [package.metadata.requires-dev] @@ -256,6 +279,30 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/2e/5d/aa883766f8ef9ffbe6aa24f7192fb71632f31a30e77eb39aa2b0dc4290ac/ruff-0.14.2-py3-none-win_arm64.whl", hash = "sha256:ea9d635e83ba21569fbacda7e78afbfeb94911c9434aff06192d9bc23fd5495a", size = 12554956, upload-time = "2025-10-23T19:36:58.714Z" }, ] +[[package]] +name = "shellingham" +version = "1.5.4" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/58/15/8b3609fd3830ef7b27b655beb4b4e9c62313a4e8da8c676e142cc210d58e/shellingham-1.5.4.tar.gz", hash = "sha256:8dbca0739d487e5bd35ab3ca4b36e11c4078f3a234bfce294b0a0291363404de", size = 10310, upload-time = "2023-10-24T04:13:40.426Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/e0/f9/0595336914c5619e5f28a1fb793285925a8cd4b432c9da0a987836c7f822/shellingham-1.5.4-py2.py3-none-any.whl", hash = "sha256:7ecfff8f2fd72616f7481040475a65b2bf8af90a56c89140852d1120324e8686", size = 9755, upload-time = "2023-10-24T04:13:38.866Z" }, +] + +[[package]] +name = "typer" +version = "0.21.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "click" }, + { name = "rich" }, + { name = "shellingham" }, + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/36/bf/8825b5929afd84d0dabd606c67cd57b8388cb3ec385f7ef19c5cc2202069/typer-0.21.1.tar.gz", hash = "sha256:ea835607cd752343b6b2b7ce676893e5a0324082268b48f27aa058bdb7d2145d", size = 110371, upload-time = "2026-01-06T11:21:10.989Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/a0/1d/d9257dd49ff2ca23ea5f132edf1281a0c4f9de8a762b9ae399b670a59235/typer-0.21.1-py3-none-any.whl", hash = "sha256:7985e89081c636b88d172c2ee0cfe33c253160994d47bdfdc302defd7d1f1d01", size = 47381, upload-time = "2026-01-06T11:21:09.824Z" }, +] + [[package]] name = "typing-extensions" version = "4.15.0"