devit-cli 0.1.0__py3-none-any.whl

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 (52) hide show
  1. _devkit_entry.py +59 -0
  2. devit_cli-0.1.0.dist-info/METADATA +273 -0
  3. devit_cli-0.1.0.dist-info/RECORD +52 -0
  4. devit_cli-0.1.0.dist-info/WHEEL +5 -0
  5. devit_cli-0.1.0.dist-info/entry_points.txt +2 -0
  6. devit_cli-0.1.0.dist-info/licenses/LICENSE +21 -0
  7. devit_cli-0.1.0.dist-info/top_level.txt +2 -0
  8. devkit_cli/__init__.py +4 -0
  9. devkit_cli/commands/__init__.py +0 -0
  10. devkit_cli/commands/archive.py +166 -0
  11. devkit_cli/commands/clean.py +130 -0
  12. devkit_cli/commands/env.py +156 -0
  13. devkit_cli/commands/find.py +122 -0
  14. devkit_cli/commands/info.py +119 -0
  15. devkit_cli/commands/init.py +451 -0
  16. devkit_cli/commands/run.py +236 -0
  17. devkit_cli/main.py +89 -0
  18. devkit_cli/templates/aws/.gitignore +43 -0
  19. devkit_cli/templates/aws/README.md +23 -0
  20. devkit_cli/templates/aws/requirements.txt +2 -0
  21. devkit_cli/templates/aws/scripts/__init__.py +0 -0
  22. devkit_cli/templates/aws/scripts/ec2.py +9 -0
  23. devkit_cli/templates/aws/scripts/main.py +25 -0
  24. devkit_cli/templates/aws/scripts/s3.py +10 -0
  25. devkit_cli/templates/aws/tests/test_scripts.py +6 -0
  26. devkit_cli/templates/django/.gitignore +43 -0
  27. devkit_cli/templates/django/README.md +15 -0
  28. devkit_cli/templates/django/apps/__init__.py +0 -0
  29. devkit_cli/templates/django/apps/core/__init__.py +0 -0
  30. devkit_cli/templates/django/apps/core/apps.py +6 -0
  31. devkit_cli/templates/django/apps/core/urls.py +6 -0
  32. devkit_cli/templates/django/apps/core/views.py +7 -0
  33. devkit_cli/templates/django/manage.py +20 -0
  34. devkit_cli/templates/django/requirements.txt +1 -0
  35. devkit_cli/templates/django/{{module_name}}/__init__.py +0 -0
  36. devkit_cli/templates/django/{{module_name}}/settings.py +61 -0
  37. devkit_cli/templates/django/{{module_name}}/urls.py +9 -0
  38. devkit_cli/templates/django/{{module_name}}/wsgi.py +7 -0
  39. devkit_cli/templates/fastapi/.gitignore +43 -0
  40. devkit_cli/templates/fastapi/README.md +21 -0
  41. devkit_cli/templates/fastapi/app/__init__.py +0 -0
  42. devkit_cli/templates/fastapi/app/routers/__init__.py +0 -0
  43. devkit_cli/templates/fastapi/app/routers/health.py +10 -0
  44. devkit_cli/templates/fastapi/main.py +13 -0
  45. devkit_cli/templates/fastapi/requirements.txt +6 -0
  46. devkit_cli/templates/fastapi/tests/test_api.py +17 -0
  47. devkit_cli/templates/package/.gitignore +43 -0
  48. devkit_cli/templates/package/README.md +15 -0
  49. devkit_cli/templates/package/pyproject.toml +29 -0
  50. devkit_cli/templates/package/tests/test_core.py +8 -0
  51. devkit_cli/templates/package/{{module_name}}/__init__.py +3 -0
  52. devkit_cli/templates/package/{{module_name}}/core.py +5 -0
devkit_cli/main.py ADDED
@@ -0,0 +1,89 @@
1
+ # -*- coding: utf-8 -*-
2
+ """Main CLI entry point for devkit-cli."""
3
+
4
+ import difflib
5
+ import sys
6
+
7
+ import click
8
+ from rich.console import Console
9
+ from rich import print as rprint
10
+ from devkit_cli import __version__
11
+
12
+ from devkit_cli.commands.init import init
13
+ from devkit_cli.commands.clean import clean
14
+ from devkit_cli.commands.info import info
15
+ from devkit_cli.commands.find import find
16
+ from devkit_cli.commands.archive import zip_cmd, unzip_cmd
17
+ from devkit_cli.commands.env import env
18
+ from devkit_cli.commands.run import run, build, dev, test
19
+
20
+ console = Console()
21
+
22
+
23
+ class _DevkitGroup(click.Group):
24
+ """Click Group subclass that suggests corrections for mistyped commands."""
25
+
26
+ def resolve_command(self, ctx: click.Context, args: list):
27
+ try:
28
+ return super().resolve_command(ctx, args)
29
+ except click.UsageError:
30
+ cmd_name = args[0] if args else ""
31
+ all_cmds = self.list_commands(ctx)
32
+ suggestions = difflib.get_close_matches(cmd_name, all_cmds, n=1, cutoff=0.6)
33
+ if suggestions:
34
+ console.print(
35
+ f"[red]Error:[/red] No such command [bold]'{cmd_name}'[/bold].\n"
36
+ f" Did you mean [bold green]{suggestions[0]}[/bold green]?\n\n"
37
+ f"Run [bold]devkit --help[/bold] to see all available commands."
38
+ )
39
+ else:
40
+ console.print(
41
+ f"[red]Error:[/red] No such command [bold]'{cmd_name}'[/bold].\n\n"
42
+ f"Run [bold]devkit --help[/bold] to see all available commands."
43
+ )
44
+ sys.exit(2)
45
+
46
+ LOGO = """
47
+ [bold cyan]
48
+ ██████╗ ███████╗██╗ ██╗██╗ ██╗██╗████████╗
49
+ ██╔══██╗██╔════╝██║ ██║██║ ██╔╝██║╚══██╔══╝
50
+ ██║ ██║█████╗ ██║ ██║█████╔╝ ██║ ██║
51
+ ██║ ██║██╔══╝ ╚██╗ ██╔╝██╔═██╗ ██║ ██║
52
+ ██████╔╝███████╗ ╚████╔╝ ██║ ██╗██║ ██║
53
+ ╚═════╝ ╚══════╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝
54
+ [/bold cyan]
55
+ [dim] Professional Developer CLI Toolkit v{version}[/dim]
56
+ """
57
+
58
+
59
+ @click.group(cls=_DevkitGroup, invoke_without_command=True, context_settings={"help_option_names": ["-h", "--help"]})
60
+ @click.version_option(__version__, "-v", "--version", message="devkit-cli %(version)s")
61
+ @click.pass_context
62
+ def cli(ctx: click.Context) -> None:
63
+ """
64
+ \b
65
+ devkit-cli — A full-featured CLI framework for professional developers.
66
+
67
+ Run `devkit COMMAND --help` for details on any command.
68
+ """
69
+ if ctx.invoked_subcommand is None:
70
+ console.print(LOGO.format(version=__version__))
71
+ click.echo(ctx.get_help())
72
+
73
+
74
+ # Register all commands
75
+ cli.add_command(init)
76
+ cli.add_command(clean)
77
+ cli.add_command(info)
78
+ cli.add_command(find)
79
+ cli.add_command(zip_cmd, name="zip")
80
+ cli.add_command(unzip_cmd, name="unzip")
81
+ cli.add_command(env)
82
+ cli.add_command(run)
83
+ cli.add_command(build)
84
+ cli.add_command(dev)
85
+ cli.add_command(test)
86
+
87
+
88
+ if __name__ == "__main__":
89
+ cli()
@@ -0,0 +1,43 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.pyo
5
+ *.pyd
6
+ .Python
7
+ *.egg-info/
8
+ dist/
9
+ build/
10
+ .eggs/
11
+ .venv/
12
+ venv/
13
+ env/
14
+
15
+ # Testing
16
+ .pytest_cache/
17
+ .coverage
18
+ coverage.xml
19
+ htmlcov/
20
+
21
+ # Linting
22
+ .ruff_cache/
23
+ .mypy_cache/
24
+
25
+ # OS
26
+ .DS_Store
27
+ Thumbs.db
28
+ *.swp
29
+ *.swo
30
+
31
+ # IDEs
32
+ .vscode/
33
+ .idea/
34
+ *.iml
35
+
36
+ # Env
37
+ .env
38
+ .env.*
39
+ !.env.example
40
+
41
+ # AWS
42
+ .aws-sam/
43
+ cdk.out/
@@ -0,0 +1,23 @@
1
+ # {{project_name}}
2
+
3
+ AWS automation scripts — scaffolded with **devkit-cli**
4
+
5
+ ## Setup
6
+
7
+ ```bash
8
+ devkit build # installs requirements
9
+ aws configure # configure your AWS credentials
10
+ ```
11
+
12
+ ## Run
13
+
14
+ ```bash
15
+ devkit run list-buckets
16
+ devkit run list-instances
17
+ ```
18
+
19
+ ## Test
20
+
21
+ ```bash
22
+ devkit test
23
+ ```
@@ -0,0 +1,2 @@
1
+ boto3>=1.34
2
+ botocore>=1.34
File without changes
@@ -0,0 +1,9 @@
1
+ """EC2 helper scripts."""
2
+
3
+ import boto3
4
+
5
+
6
+ def list_instances():
7
+ ec2 = boto3.resource("ec2")
8
+ for instance in ec2.instances.all():
9
+ print(f"{instance.id} {instance.instance_type} {instance.state['Name']}")
@@ -0,0 +1,25 @@
1
+ """{{project_name}} — AWS automation scripts entry point."""
2
+
3
+ import argparse
4
+ from scripts import s3, ec2
5
+
6
+
7
+ def main():
8
+ parser = argparse.ArgumentParser(description="{{project_name}} AWS scripts")
9
+ sub = parser.add_subparsers(dest="command")
10
+
11
+ sub.add_parser("list-buckets", help="List S3 buckets")
12
+ sub.add_parser("list-instances", help="List EC2 instances")
13
+
14
+ args = parser.parse_args()
15
+
16
+ if args.command == "list-buckets":
17
+ s3.list_buckets()
18
+ elif args.command == "list-instances":
19
+ ec2.list_instances()
20
+ else:
21
+ parser.print_help()
22
+
23
+
24
+ if __name__ == "__main__":
25
+ main()
@@ -0,0 +1,10 @@
1
+ """S3 helper scripts."""
2
+
3
+ import boto3
4
+
5
+
6
+ def list_buckets():
7
+ s3 = boto3.client("s3")
8
+ response = s3.list_buckets()
9
+ for bucket in response.get("Buckets", []):
10
+ print(bucket["Name"])
@@ -0,0 +1,6 @@
1
+ """Tests for {{project_name}} AWS scripts."""
2
+
3
+
4
+ def test_placeholder():
5
+ # Replace with real tests using moto for AWS mocking
6
+ assert True
@@ -0,0 +1,43 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.pyo
5
+ *.pyd
6
+ .Python
7
+ *.egg-info/
8
+ dist/
9
+ build/
10
+ .eggs/
11
+ .venv/
12
+ venv/
13
+ env/
14
+
15
+ # Testing
16
+ .pytest_cache/
17
+ .coverage
18
+ coverage.xml
19
+ htmlcov/
20
+
21
+ # Linting
22
+ .ruff_cache/
23
+ .mypy_cache/
24
+
25
+ # OS
26
+ .DS_Store
27
+ Thumbs.db
28
+ *.swp
29
+ *.swo
30
+
31
+ # IDEs
32
+ .vscode/
33
+ .idea/
34
+ *.iml
35
+
36
+ # Env
37
+ .env
38
+ .env.*
39
+ !.env.example
40
+
41
+ # AWS
42
+ .aws-sam/
43
+ cdk.out/
@@ -0,0 +1,15 @@
1
+ # {{project_name}}
2
+
3
+ Django project — scaffolded with **devkit-cli**
4
+
5
+ ## Dev server
6
+
7
+ ```bash
8
+ devkit dev
9
+ ```
10
+
11
+ ## Run migrations
12
+
13
+ ```bash
14
+ .venv/Scripts/python manage.py migrate
15
+ ```
File without changes
File without changes
@@ -0,0 +1,6 @@
1
+ from django.apps import AppConfig
2
+
3
+
4
+ class CoreConfig(AppConfig):
5
+ default_auto_field = "django.db.models.BigAutoField"
6
+ name = "apps.core"
@@ -0,0 +1,6 @@
1
+ from django.urls import path
2
+ from . import views
3
+
4
+ urlpatterns = [
5
+ path("", views.index, name="index"),
6
+ ]
@@ -0,0 +1,7 @@
1
+ """Core Django app — views."""
2
+
3
+ from django.http import JsonResponse
4
+
5
+
6
+ def index(request):
7
+ return JsonResponse({"message": "Welcome to {{project_name}}"})
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env python
2
+ """Django's command-line utility for administrative tasks."""
3
+ import os
4
+ import sys
5
+
6
+
7
+ def main():
8
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{module_name}}.settings")
9
+ try:
10
+ from django.core.management import execute_from_command_line
11
+ except ImportError as exc:
12
+ raise ImportError(
13
+ "Couldn't import Django. Are you sure it's installed and "
14
+ "available on your PYTHONPATH?"
15
+ ) from exc
16
+ execute_from_command_line(sys.argv)
17
+
18
+
19
+ if __name__ == "__main__":
20
+ main()
@@ -0,0 +1 @@
1
+ django>=4.2
@@ -0,0 +1,61 @@
1
+ """Django settings for {{project_name}}."""
2
+
3
+ from pathlib import Path
4
+
5
+ BASE_DIR = Path(__file__).resolve().parent.parent
6
+
7
+ SECRET_KEY = "django-insecure-change-me-in-production"
8
+
9
+ DEBUG = True
10
+
11
+ ALLOWED_HOSTS = ["*"]
12
+
13
+ INSTALLED_APPS = [
14
+ "django.contrib.admin",
15
+ "django.contrib.auth",
16
+ "django.contrib.contenttypes",
17
+ "django.contrib.sessions",
18
+ "django.contrib.messages",
19
+ "django.contrib.staticfiles",
20
+ "apps.core",
21
+ ]
22
+
23
+ MIDDLEWARE = [
24
+ "django.middleware.security.SecurityMiddleware",
25
+ "django.contrib.sessions.middleware.SessionMiddleware",
26
+ "django.middleware.common.CommonMiddleware",
27
+ "django.middleware.csrf.CsrfViewMiddleware",
28
+ "django.contrib.auth.middleware.AuthenticationMiddleware",
29
+ "django.contrib.messages.middleware.MessageMiddleware",
30
+ "django.middleware.clickjacking.XFrameOptionsMiddleware",
31
+ ]
32
+
33
+ ROOT_URLCONF = "{{module_name}}.urls"
34
+
35
+ TEMPLATES = [
36
+ {
37
+ "BACKEND": "django.template.backends.django.DjangoTemplates",
38
+ "DIRS": [BASE_DIR / "templates"],
39
+ "APP_DIRS": True,
40
+ "OPTIONS": {
41
+ "context_processors": [
42
+ "django.template.context_processors.debug",
43
+ "django.template.context_processors.request",
44
+ "django.contrib.auth.context_processors.auth",
45
+ "django.contrib.messages.context_processors.messages",
46
+ ],
47
+ },
48
+ },
49
+ ]
50
+
51
+ WSGI_APPLICATION = "{{module_name}}.wsgi.application"
52
+
53
+ DATABASES = {
54
+ "default": {
55
+ "ENGINE": "django.db.backends.sqlite3",
56
+ "NAME": BASE_DIR / "db.sqlite3",
57
+ }
58
+ }
59
+
60
+ STATIC_URL = "static/"
61
+ DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
@@ -0,0 +1,9 @@
1
+ """URL config for {{project_name}}."""
2
+
3
+ from django.contrib import admin
4
+ from django.urls import path, include
5
+
6
+ urlpatterns = [
7
+ path("admin/", admin.site.urls),
8
+ path("", include("apps.core.urls")),
9
+ ]
@@ -0,0 +1,7 @@
1
+ """WSGI config for {{project_name}}."""
2
+
3
+ import os
4
+ from django.core.wsgi import get_wsgi_application
5
+
6
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{module_name}}.settings")
7
+ application = get_wsgi_application()
@@ -0,0 +1,43 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.pyo
5
+ *.pyd
6
+ .Python
7
+ *.egg-info/
8
+ dist/
9
+ build/
10
+ .eggs/
11
+ .venv/
12
+ venv/
13
+ env/
14
+
15
+ # Testing
16
+ .pytest_cache/
17
+ .coverage
18
+ coverage.xml
19
+ htmlcov/
20
+
21
+ # Linting
22
+ .ruff_cache/
23
+ .mypy_cache/
24
+
25
+ # OS
26
+ .DS_Store
27
+ Thumbs.db
28
+ *.swp
29
+ *.swo
30
+
31
+ # IDEs
32
+ .vscode/
33
+ .idea/
34
+ *.iml
35
+
36
+ # Env
37
+ .env
38
+ .env.*
39
+ !.env.example
40
+
41
+ # AWS
42
+ .aws-sam/
43
+ cdk.out/
@@ -0,0 +1,21 @@
1
+ # {{project_name}}
2
+
3
+ FastAPI backend — scaffolded with **devkit-cli**
4
+
5
+ ## Run (dev)
6
+
7
+ ```bash
8
+ devkit dev
9
+ ```
10
+
11
+ ## Run (production)
12
+
13
+ ```bash
14
+ devkit run
15
+ ```
16
+
17
+ ## Test
18
+
19
+ ```bash
20
+ devkit test
21
+ ```
File without changes
File without changes
@@ -0,0 +1,10 @@
1
+ """Health-check router."""
2
+
3
+ from fastapi import APIRouter
4
+
5
+ router = APIRouter(prefix="/health", tags=["health"])
6
+
7
+
8
+ @router.get("")
9
+ async def health():
10
+ return {"status": "ok"}
@@ -0,0 +1,13 @@
1
+ """{{project_name}} — FastAPI application entry point."""
2
+
3
+ from fastapi import FastAPI
4
+ from app.routers import health
5
+
6
+ app = FastAPI(title="{{project_name}}", version="0.1.0")
7
+
8
+ app.include_router(health.router)
9
+
10
+
11
+ @app.get("/")
12
+ async def root():
13
+ return {"message": "Welcome to {{project_name}}"}
@@ -0,0 +1,6 @@
1
+ fastapi>=0.111
2
+ uvicorn[standard]>=0.29
3
+ pydantic>=2.0
4
+ httpx>=0.27
5
+ pytest>=7.0
6
+ pytest-anyio>=0.0.0
@@ -0,0 +1,17 @@
1
+ """Tests for {{project_name}} API."""
2
+
3
+ from fastapi.testclient import TestClient
4
+ from main import app
5
+
6
+ client = TestClient(app)
7
+
8
+
9
+ def test_root():
10
+ r = client.get("/")
11
+ assert r.status_code == 200
12
+
13
+
14
+ def test_health():
15
+ r = client.get("/health")
16
+ assert r.status_code == 200
17
+ assert r.json()["status"] == "ok"
@@ -0,0 +1,43 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.pyo
5
+ *.pyd
6
+ .Python
7
+ *.egg-info/
8
+ dist/
9
+ build/
10
+ .eggs/
11
+ .venv/
12
+ venv/
13
+ env/
14
+
15
+ # Testing
16
+ .pytest_cache/
17
+ .coverage
18
+ coverage.xml
19
+ htmlcov/
20
+
21
+ # Linting
22
+ .ruff_cache/
23
+ .mypy_cache/
24
+
25
+ # OS
26
+ .DS_Store
27
+ Thumbs.db
28
+ *.swp
29
+ *.swo
30
+
31
+ # IDEs
32
+ .vscode/
33
+ .idea/
34
+ *.iml
35
+
36
+ # Env
37
+ .env
38
+ .env.*
39
+ !.env.example
40
+
41
+ # AWS
42
+ .aws-sam/
43
+ cdk.out/
@@ -0,0 +1,15 @@
1
+ # {{project_name}}
2
+
3
+ > Created with **devkit-cli**
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pip install -e ".[dev]"
9
+ ```
10
+
11
+ ## Test
12
+
13
+ ```bash
14
+ devkit test
15
+ ```
@@ -0,0 +1,29 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.backends.legacy:build"
4
+
5
+ [project]
6
+ name = "{{project_name}}"
7
+ version = "0.1.0"
8
+ description = "A short description of {{project_name}}"
9
+ requires-python = ">=3.10"
10
+ license = { text = "MIT" }
11
+ dependencies = []
12
+
13
+ [project.optional-dependencies]
14
+ dev = [
15
+ "pytest>=7.0",
16
+ "black>=24.0",
17
+ "ruff>=0.4",
18
+ ]
19
+
20
+ [tool.setuptools.packages.find]
21
+ where = ["."]
22
+ include = ["{{module_name}}*"]
23
+
24
+ [tool.black]
25
+ line-length = 100
26
+
27
+ [tool.ruff]
28
+ line-length = 100
29
+ select = ["E", "F", "I"]
@@ -0,0 +1,8 @@
1
+ """Tests for {{project_name}}."""
2
+
3
+ from {{module_name}}.core import hello
4
+
5
+
6
+ def test_hello():
7
+ assert hello() == "Hello, world!"
8
+ assert hello("devkit") == "Hello, devkit!"
@@ -0,0 +1,3 @@
1
+ """{{project_name}} — Python package."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,5 @@
1
+ """Core logic for {{project_name}}."""
2
+
3
+
4
+ def hello(name: str = "world") -> str:
5
+ return f"Hello, {name}!"