dockseed 0.1.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.
dockseed-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dockseed Contributors
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,139 @@
1
+ Metadata-Version: 2.4
2
+ Name: dockseed
3
+ Version: 0.1.0
4
+ Summary: Inspect Python projects and generate deterministic, best-practice Dockerfiles automatically.
5
+ License-Expression: MIT
6
+ License-File: LICENSE
7
+ Keywords: docker,dockerfile,containers,python,devtools,cli
8
+ Author: Dockseed Contributors
9
+ Requires-Python: >=3.10,<3.15
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Topic :: Software Development :: Build Tools
21
+ Classifier: Typing :: Typed
22
+ Requires-Dist: tomli (>=2.0.0) ; python_version < "3.11"
23
+ Description-Content-Type: text/markdown
24
+
25
+ # Dockseed
26
+
27
+ **Dockseed** is a deterministic Python developer tool that inspects an existing Python project and generates a project-specific, best-practice `Dockerfile` and `.dockerignore` automatically.
28
+
29
+ ## Key Features
30
+
31
+ - **Evidence-Based Detection:** Inspects `pyproject.toml`, `requirements.txt`, `Pipfile`, `.python-version`, `.tool-versions`, and `runtime.txt` to resolve compatible Python versions (`3.10`–`3.14`).
32
+ - **Modern Package Manager Support:** Automatically configures layer-cached dependency installation for `pip`, `uv`, `Poetry`, `PDM`, `Hatch`, and `Pipenv`.
33
+ - **Safe AST Static Analysis:** Discovers application entry points (`FastAPI`, `Flask`, `Django`, `Streamlit`, `Gradio`, `Celery`, CLI scripts, and standalone scripts) using Python's built-in `ast` module—never importing or executing project code.
34
+ - **Native System Dependency Heuristics:** Detects packages requiring C extensions or shared libraries (`psycopg2`, `mysqlclient`, `opencv-python`, `pyaudio`, `git+https`, etc.) and injects clean `apt-get` layers.
35
+ - **Secure & Production-Minded Defaults:** Generates single-stage `python:3.x-slim` images running as an unprivileged `appuser`, using JSON exec-form `CMD` arrays for proper `SIGTERM` signal handling, and excluding `.env` secrets and virtual environments.
36
+ - **CI/CD & Headless Ready:** Deterministic output, explicit CLI override flags, and strict exit codes.
37
+
38
+ ---
39
+
40
+ ## Installation
41
+
42
+ ~~~bash
43
+ pip install dockseed
44
+ ~~~
45
+
46
+ Or run directly with `uvx` or `pipx`:
47
+
48
+ ~~~bash
49
+ uvx dockseed scan
50
+ ~~~
51
+
52
+ ---
53
+
54
+ ## CLI Usage
55
+
56
+ ### 1. Analyze a Project (`dockseed scan`)
57
+
58
+ Inspect a project without modifying any files:
59
+
60
+ ~~~bash
61
+ dockseed scan
62
+ dockseed scan ./my-project
63
+ dockseed scan --format json
64
+ ~~~
65
+
66
+ ### 2. Generate Configuration (`dockseed init`)
67
+
68
+ Generate a `Dockerfile` and `.dockerignore`:
69
+
70
+ ~~~bash
71
+ dockseed init
72
+ dockseed init --dry-run
73
+ dockseed init --yes
74
+ dockseed init --overwrite
75
+ dockseed init --no-comments
76
+ ~~~
77
+
78
+ Bypass ambiguity prompts in CI/CD pipelines using explicit override flags:
79
+
80
+ ~~~bash
81
+ dockseed init --yes \
82
+ --python 3.12 \
83
+ --package-manager uv \
84
+ --entrypoint "app.main:app" \
85
+ --port 8000
86
+ ~~~
87
+
88
+ ### 3. Validate Configuration (`dockseed check`)
89
+
90
+ Validate an existing `Dockerfile` and `.dockerignore` statically, or perform an opt-in container build check:
91
+
92
+ ~~~bash
93
+ dockseed check
94
+ dockseed check --build
95
+ dockseed check --build --runtime podman
96
+ ~~~
97
+
98
+ ---
99
+
100
+ ## Python API
101
+
102
+ Dockseed's scanning, generation, and validation engine can be used directly from Python:
103
+
104
+ ~~~python
105
+ from pathlib import Path
106
+ from dockseed import (
107
+ scan_project,
108
+ generate_dockerfile,
109
+ generate_dockerignore,
110
+ validate_dockerfile,
111
+ )
112
+
113
+ model = scan_project(Path("."))
114
+ dockerfile = generate_dockerfile(model, include_comments=True)
115
+ dockerignore = generate_dockerignore(model)
116
+
117
+ report = validate_dockerfile(dockerfile.content, model, dockerignore.content)
118
+ if report.is_valid:
119
+ print(dockerfile.content)
120
+ ~~~
121
+
122
+ ---
123
+
124
+ ## Exit Codes
125
+
126
+ | Exit Code | Constant | Meaning |
127
+ | :--- | :--- | :--- |
128
+ | `0` | `SUCCESS` | Operation succeeded. |
129
+ | `1` | `GENERAL_ERROR` | Unexpected runtime or I/O error. |
130
+ | `2` | `VALIDATION_FAILED` | Static/build validation failed, or containerization blocker detected. |
131
+ | `3` | `AMBIGUITY_UNRESOLVED` | Unresolved critical ambiguity in non-interactive (`--yes` or non-TTY) mode. |
132
+ | `4` | `OVERWRITE_BLOCKED` | Target `Dockerfile` already exists and `--overwrite` was not passed. |
133
+
134
+ ---
135
+
136
+ ## License
137
+
138
+ MIT
139
+
@@ -0,0 +1,114 @@
1
+ # Dockseed
2
+
3
+ **Dockseed** is a deterministic Python developer tool that inspects an existing Python project and generates a project-specific, best-practice `Dockerfile` and `.dockerignore` automatically.
4
+
5
+ ## Key Features
6
+
7
+ - **Evidence-Based Detection:** Inspects `pyproject.toml`, `requirements.txt`, `Pipfile`, `.python-version`, `.tool-versions`, and `runtime.txt` to resolve compatible Python versions (`3.10`–`3.14`).
8
+ - **Modern Package Manager Support:** Automatically configures layer-cached dependency installation for `pip`, `uv`, `Poetry`, `PDM`, `Hatch`, and `Pipenv`.
9
+ - **Safe AST Static Analysis:** Discovers application entry points (`FastAPI`, `Flask`, `Django`, `Streamlit`, `Gradio`, `Celery`, CLI scripts, and standalone scripts) using Python's built-in `ast` module—never importing or executing project code.
10
+ - **Native System Dependency Heuristics:** Detects packages requiring C extensions or shared libraries (`psycopg2`, `mysqlclient`, `opencv-python`, `pyaudio`, `git+https`, etc.) and injects clean `apt-get` layers.
11
+ - **Secure & Production-Minded Defaults:** Generates single-stage `python:3.x-slim` images running as an unprivileged `appuser`, using JSON exec-form `CMD` arrays for proper `SIGTERM` signal handling, and excluding `.env` secrets and virtual environments.
12
+ - **CI/CD & Headless Ready:** Deterministic output, explicit CLI override flags, and strict exit codes.
13
+
14
+ ---
15
+
16
+ ## Installation
17
+
18
+ ~~~bash
19
+ pip install dockseed
20
+ ~~~
21
+
22
+ Or run directly with `uvx` or `pipx`:
23
+
24
+ ~~~bash
25
+ uvx dockseed scan
26
+ ~~~
27
+
28
+ ---
29
+
30
+ ## CLI Usage
31
+
32
+ ### 1. Analyze a Project (`dockseed scan`)
33
+
34
+ Inspect a project without modifying any files:
35
+
36
+ ~~~bash
37
+ dockseed scan
38
+ dockseed scan ./my-project
39
+ dockseed scan --format json
40
+ ~~~
41
+
42
+ ### 2. Generate Configuration (`dockseed init`)
43
+
44
+ Generate a `Dockerfile` and `.dockerignore`:
45
+
46
+ ~~~bash
47
+ dockseed init
48
+ dockseed init --dry-run
49
+ dockseed init --yes
50
+ dockseed init --overwrite
51
+ dockseed init --no-comments
52
+ ~~~
53
+
54
+ Bypass ambiguity prompts in CI/CD pipelines using explicit override flags:
55
+
56
+ ~~~bash
57
+ dockseed init --yes \
58
+ --python 3.12 \
59
+ --package-manager uv \
60
+ --entrypoint "app.main:app" \
61
+ --port 8000
62
+ ~~~
63
+
64
+ ### 3. Validate Configuration (`dockseed check`)
65
+
66
+ Validate an existing `Dockerfile` and `.dockerignore` statically, or perform an opt-in container build check:
67
+
68
+ ~~~bash
69
+ dockseed check
70
+ dockseed check --build
71
+ dockseed check --build --runtime podman
72
+ ~~~
73
+
74
+ ---
75
+
76
+ ## Python API
77
+
78
+ Dockseed's scanning, generation, and validation engine can be used directly from Python:
79
+
80
+ ~~~python
81
+ from pathlib import Path
82
+ from dockseed import (
83
+ scan_project,
84
+ generate_dockerfile,
85
+ generate_dockerignore,
86
+ validate_dockerfile,
87
+ )
88
+
89
+ model = scan_project(Path("."))
90
+ dockerfile = generate_dockerfile(model, include_comments=True)
91
+ dockerignore = generate_dockerignore(model)
92
+
93
+ report = validate_dockerfile(dockerfile.content, model, dockerignore.content)
94
+ if report.is_valid:
95
+ print(dockerfile.content)
96
+ ~~~
97
+
98
+ ---
99
+
100
+ ## Exit Codes
101
+
102
+ | Exit Code | Constant | Meaning |
103
+ | :--- | :--- | :--- |
104
+ | `0` | `SUCCESS` | Operation succeeded. |
105
+ | `1` | `GENERAL_ERROR` | Unexpected runtime or I/O error. |
106
+ | `2` | `VALIDATION_FAILED` | Static/build validation failed, or containerization blocker detected. |
107
+ | `3` | `AMBIGUITY_UNRESOLVED` | Unresolved critical ambiguity in non-interactive (`--yes` or non-TTY) mode. |
108
+ | `4` | `OVERWRITE_BLOCKED` | Target `Dockerfile` already exists and `--overwrite` was not passed. |
109
+
110
+ ---
111
+
112
+ ## License
113
+
114
+ MIT
@@ -0,0 +1,67 @@
1
+ [build-system]
2
+ requires = ["poetry-core>=1.9.0"]
3
+ build-backend = "poetry.core.masonry.api"
4
+
5
+ [project]
6
+ name = "dockseed"
7
+ version = "0.1.0"
8
+ description = "Inspect Python projects and generate deterministic, best-practice Dockerfiles automatically."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10,<3.15"
11
+ license = "MIT"
12
+ authors = [
13
+ { name = "Dockseed Contributors" }
14
+ ]
15
+ keywords = ["docker", "dockerfile", "containers", "python", "devtools", "cli"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Environment :: Console",
19
+ "Intended Audience :: Developers",
20
+ "Operating System :: OS Independent",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3.10",
23
+ "Programming Language :: Python :: 3.11",
24
+ "Programming Language :: Python :: 3.12",
25
+ "Programming Language :: Python :: 3.13",
26
+ "Programming Language :: Python :: 3.14",
27
+ "Topic :: Software Development :: Build Tools",
28
+ "Typing :: Typed",
29
+ ]
30
+ dependencies = [
31
+ "tomli (>=2.0.0) ; python_version < '3.11'",
32
+ ]
33
+
34
+ [project.scripts]
35
+ dockseed = "dockseed.cli:main"
36
+
37
+ [tool.poetry]
38
+ packages = [{ include = "dockseed", from = "src" }]
39
+ include = ["src/dockseed/py.typed"]
40
+
41
+ [tool.poetry.group.dev.dependencies]
42
+ pytest = "^8.0.0"
43
+ pytest-cov = "^5.0.0"
44
+ ruff = "^0.6.0"
45
+ mypy = "^1.11.0"
46
+
47
+ [tool.ruff]
48
+ line-length = 100
49
+ target-version = "py310"
50
+ src = ["src", "tests"]
51
+
52
+ [tool.ruff.lint]
53
+ select = ["E", "F", "I", "B", "UP", "SIM", "RUF"]
54
+
55
+ [tool.mypy]
56
+ python_version = "3.11"
57
+ strict = true
58
+ warn_return_any = true
59
+ warn_unused_configs = true
60
+ mypy_path = "src"
61
+
62
+ [tool.pytest.ini_options]
63
+ testpaths = ["tests"]
64
+ markers = [
65
+ "integration: marks tests that require an external container runtime (docker/podman/nerdctl)",
66
+ ]
67
+ addopts = "-ra -q"
@@ -0,0 +1,47 @@
1
+ """Dockseed — Automated, deterministic Dockerfile generator for Python projects."""
2
+
3
+ from dockseed.exceptions import (
4
+ AmbiguityError,
5
+ DockseedError,
6
+ OverwriteBlockedError,
7
+ ValidationError,
8
+ )
9
+ from dockseed.generators import generate_dockerfile, generate_dockerignore
10
+ from dockseed.inference import format_scan_report, scan_project
11
+ from dockseed.models import (
12
+ CLIOverrides,
13
+ ConfidenceLevel,
14
+ Detection,
15
+ Evidence,
16
+ ExitCode,
17
+ Framework,
18
+ GenerationResult,
19
+ PackageManager,
20
+ ProjectModel,
21
+ )
22
+ from dockseed.validators import ValidationReport, validate_dockerfile
23
+
24
+ __version__ = "0.1.0"
25
+
26
+ __all__ = [
27
+ "__version__",
28
+ "AmbiguityError",
29
+ "CLIOverrides",
30
+ "ConfidenceLevel",
31
+ "Detection",
32
+ "DockseedError",
33
+ "Evidence",
34
+ "ExitCode",
35
+ "Framework",
36
+ "GenerationResult",
37
+ "OverwriteBlockedError",
38
+ "PackageManager",
39
+ "ProjectModel",
40
+ "ValidationError",
41
+ "ValidationReport",
42
+ "format_scan_report",
43
+ "generate_dockerfile",
44
+ "generate_dockerignore",
45
+ "scan_project",
46
+ "validate_dockerfile",
47
+ ]
@@ -0,0 +1,8 @@
1
+ """Allow running dockseed via `python -m dockseed`."""
2
+
3
+ import sys
4
+
5
+ from dockseed.cli import main
6
+
7
+ if __name__ == "__main__":
8
+ sys.exit(main())