agentyper 0.1.2__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,285 @@
1
+ ### VisualStudioCode template
2
+ .vscode/*
3
+ !.vscode/settings.json
4
+ !.vscode/tasks.json
5
+ !.vscode/launch.json
6
+ !.vscode/extensions.json
7
+ !.vscode/*.code-snippets
8
+
9
+ # Local History for Visual Studio Code
10
+ .history/
11
+
12
+ # Built Visual Studio Code Extensions
13
+ *.vsix
14
+
15
+ ### JetBrains template
16
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
17
+ # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
18
+
19
+ # User-specific stuff
20
+ .idea/**/workspace.xml
21
+ .idea/**/tasks.xml
22
+ .idea/**/usage.statistics.xml
23
+ .idea/**/dictionaries
24
+ .idea/**/shelf
25
+
26
+ # AWS User-specific
27
+ .idea/**/aws.xml
28
+
29
+ # Generated files
30
+ .idea/**/contentModel.xml
31
+
32
+ # Sensitive or high-churn files
33
+ .idea/**/dataSources/
34
+ .idea/**/dataSources.ids
35
+ .idea/**/dataSources.local.xml
36
+ .idea/**/sqlDataSources.xml
37
+ .idea/**/dynamic.xml
38
+ .idea/**/uiDesigner.xml
39
+ .idea/**/dbnavigator.xml
40
+
41
+ # Gradle
42
+ .idea/**/gradle.xml
43
+ .idea/**/libraries
44
+
45
+ # Gradle and Maven with auto-import
46
+ # When using Gradle or Maven with auto-import, you should exclude module files,
47
+ # since they will be recreated, and may cause churn. Uncomment if using
48
+ # auto-import.
49
+ # .idea/artifacts
50
+ # .idea/compiler.xml
51
+ # .idea/jarRepositories.xml
52
+ # .idea/modules.xml
53
+ # .idea/*.iml
54
+ # .idea/modules
55
+ # *.iml
56
+ # *.ipr
57
+
58
+ # CMake
59
+ cmake-build-*/
60
+
61
+ # Mongo Explorer plugin
62
+ .idea/**/mongoSettings.xml
63
+
64
+ # File-based project format
65
+ *.iws
66
+
67
+ # IntelliJ
68
+ out/
69
+
70
+ # mpeltonen/sbt-idea plugin
71
+ .idea_modules/
72
+
73
+ # JIRA plugin
74
+ atlassian-ide-plugin.xml
75
+
76
+ # Cursive Clojure plugin
77
+ .idea/replstate.xml
78
+
79
+ # SonarLint plugin
80
+ .idea/sonarlint/
81
+
82
+ # Crashlytics plugin (for Android Studio and IntelliJ)
83
+ com_crashlytics_export_strings.xml
84
+ crashlytics.properties
85
+ crashlytics-build.properties
86
+ fabric.properties
87
+
88
+ # Editor-based Rest Client
89
+ .idea/httpRequests
90
+
91
+ # Android studio 3.1+ serialized cache file
92
+ .idea/caches/build_file_checksums.ser
93
+
94
+ ### macOS template
95
+ # General
96
+ .DS_Store
97
+ .AppleDouble
98
+ .LSOverride
99
+
100
+ # Icon must end with two \r
101
+ Icon
102
+
103
+ # Thumbnails
104
+ ._*
105
+
106
+ # Files that might appear in the root of a volume
107
+ .DocumentRevisions-V100
108
+ .fseventsd
109
+ .Spotlight-V100
110
+ .TemporaryItems
111
+ .Trashes
112
+ .VolumeIcon.icns
113
+ .com.apple.timemachine.donotpresent
114
+
115
+ # Directories potentially created on remote AFP share
116
+ .AppleDB
117
+ .AppleDesktop
118
+ Network Trash Folder
119
+ Temporary Items
120
+ .apdisk
121
+
122
+ ### Python template
123
+ # Byte-compiled / optimized / DLL files
124
+ __pycache__/
125
+ *.py[cod]
126
+ *$py.class
127
+
128
+ # C extensions
129
+ *.so
130
+
131
+ # Distribution / packaging
132
+ .Python
133
+ build/
134
+ develop-eggs/
135
+ dist/
136
+ downloads/
137
+ eggs/
138
+ .eggs/
139
+ lib/
140
+ lib64/
141
+ parts/
142
+ sdist/
143
+ var/
144
+ wheels/
145
+ share/python-wheels/
146
+ *.egg-info/
147
+ .installed.cfg
148
+ *.egg
149
+ MANIFEST
150
+
151
+ # PyInstaller
152
+ # Usually these files are written by a python script from a template
153
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
154
+ *.manifest
155
+ *.spec
156
+
157
+ # Installer logs
158
+ pip-log.txt
159
+ pip-delete-this-directory.txt
160
+
161
+ # Unit test / coverage reports
162
+ htmlcov/
163
+ .tox/
164
+ .nox/
165
+ .coverage
166
+ .coverage.*
167
+ .cache
168
+ nosetests.xml
169
+ coverage.xml
170
+ *.cover
171
+ *.py,cover
172
+ .hypothesis/
173
+ .pytest_cache/
174
+ cover/
175
+
176
+ # Translations
177
+ *.mo
178
+ *.pot
179
+
180
+ # Django stuff:
181
+ *.log
182
+ local_settings.py
183
+ db.sqlite3
184
+ db.sqlite3-journal
185
+
186
+ # Flask stuff:
187
+ instance/
188
+ .webassets-cache
189
+
190
+ # Scrapy stuff:
191
+ .scrapy
192
+
193
+ # Sphinx documentation
194
+ docs/_build/
195
+
196
+ # PyBuilder
197
+ .pybuilder/
198
+ target/
199
+
200
+ # Jupyter Notebook
201
+ .ipynb_checkpoints
202
+
203
+ # IPython
204
+ profile_default/
205
+ ipython_config.py
206
+
207
+ # pyenv
208
+ # For a library or package, you might want to ignore these files since the code is
209
+ # intended to run in multiple environments; otherwise, check them in:
210
+ # .python-version
211
+
212
+ # pipenv
213
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
214
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
215
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
216
+ # install all needed dependencies.
217
+ #Pipfile.lock
218
+
219
+ # poetry
220
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
221
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
222
+ # commonly ignored for libraries.
223
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
224
+ #poetry.lock
225
+
226
+ # pdm
227
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
228
+ #pdm.lock
229
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
230
+ # in version control.
231
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
232
+ .pdm.toml
233
+ .pdm-python
234
+ .pdm-build/
235
+
236
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
237
+ __pypackages__/
238
+
239
+ # Celery stuff
240
+ celerybeat-schedule
241
+ celerybeat.pid
242
+
243
+ # SageMath parsed files
244
+ *.sage.py
245
+
246
+ # Environments
247
+ .env
248
+ .venv
249
+ env/
250
+ venv/
251
+ ENV/
252
+ env.bak/
253
+ venv.bak/
254
+
255
+ # Spyder project settings
256
+ .spyderproject
257
+ .spyproject
258
+
259
+ # Rope project settings
260
+ .ropeproject
261
+
262
+ # mkdocs documentation
263
+ /site
264
+
265
+ # mypy
266
+ .mypy_cache/
267
+ .dmypy.json
268
+ dmypy.json
269
+
270
+ # Pyre type checker
271
+ .pyre/
272
+
273
+ # pytype static type analyzer
274
+ .pytype/
275
+
276
+ # Cython debug symbols
277
+ cython_debug/
278
+
279
+ # PyCharm
280
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
281
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
282
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
283
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
284
+ .idea/
285
+
@@ -0,0 +1,25 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.0] - 2026-03-03
9
+
10
+ ### Added
11
+ - **Core App Framework**: `Agentyper`, `@app.command()`, `@app.callback()`, `app()`, `app.add_agentyper()`, `app.add_typer()`.
12
+ - **Global Flags Auto-injection**:
13
+ - `--format {table,json,csv}` with automatic terminal detection (`isatty()`).
14
+ - `--schema` to auto-export JSON Schema of a specific command or the full application.
15
+ - `--yes` and `--no` bypassing for confirmations.
16
+ - `--answers` JSON payload to bypass all interactive prompts (prompts, edits, confirms) non-blockingly.
17
+ - `-v` and `-vv` for built-in INFO/DEBUG level logging.
18
+ - **Output Interfaces**: `agentyper.output()`, `agentyper.echo()`, structured JSON `agentyper.exit_error()`.
19
+ - **Interactive Interfaces (with bypass)**: `confirm()`, `prompt()`, `edit()`, `progressbar()`, `pager()`, `launch()`.
20
+ - **Agent Ergonomics**:
21
+ - Structured field-level validation errors automatically captured via Pydantic.
22
+ - Exit code taxonomy (`0` success, `1` validation retry, `2` system failure).
23
+ - Schema includes description and metavars derived directly from Python docstrings.
24
+ - Integration with environment variables `envvar` and context objects.
25
+ - **Typer API Compatibility**: Designed as a drop-in replacement (`import agentyper as typer`). Includes aliases for `Exit`, `Abort`, `BadParameter`, `Context`.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Roman Medvedev
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,140 @@
1
+ Metadata-Version: 2.4
2
+ Name: agentyper
3
+ Version: 0.1.2
4
+ Summary: Agent-first Python CLI library — Typer-compatible, built on argparse + pydantic
5
+ Project-URL: Homepage, https://github.com/romamo/agentyper
6
+ Project-URL: Repository, https://github.com/romamo/agentyper
7
+ Project-URL: Issues, https://github.com/romamo/agentyper/issues
8
+ Author-email: Roman Medvedev <pypi@romavm.dev>
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: agent,ai,argparse,cli,pydantic,typer
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: Implementation :: CPython
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Classifier: Topic :: Terminals
23
+ Requires-Python: >=3.10
24
+ Requires-Dist: pydantic>=2.0.0
25
+ Requires-Dist: rich>=13.0.0
26
+ Provides-Extra: completion
27
+ Requires-Dist: argcomplete>=3.0.0; extra == 'completion'
28
+ Description-Content-Type: text/markdown
29
+
30
+ # agentyper
31
+
32
+ **Agent-first Python CLI library** — built on `argparse` + `pydantic`, Typer-compatible.
33
+
34
+ > *Typer was built for the era when type hints changed Python.*
35
+ > *agentyper is built for the era when AI agents changed how software is operated.*
36
+
37
+ ## Install
38
+
39
+ ```bash
40
+ pip install agentyper
41
+ ```
42
+
43
+ ## Quick Start
44
+
45
+ **Single function (like `typer.run()`):**
46
+
47
+ ```python
48
+ import agentyper
49
+
50
+ def search(ticker: str, limit: int = 10):
51
+ """Search securities by ticker."""
52
+ results = service.search(ticker, limit)
53
+ agentyper.output(results) # routes via --format automatically
54
+
55
+ agentyper.run(search)
56
+ ```
57
+
58
+ **Multi-command app:**
59
+
60
+ ```python
61
+ import agentyper
62
+
63
+ app = agentyper.Agentyper(name="my-tool", version="1.0.0")
64
+
65
+ @app.command()
66
+ def search(ticker: str, limit: int = agentyper.Option(10, help="Max results")):
67
+ """Search securities."""
68
+ agentyper.output(service.search(ticker, limit))
69
+
70
+ @app.command()
71
+ def delete(name: str):
72
+ """Delete a record."""
73
+ if agentyper.confirm(f"Delete '{name}'?"):
74
+ service.delete(name)
75
+
76
+ app()
77
+ ```
78
+
79
+ **Typer migration — one line:**
80
+
81
+ ```python
82
+ # import typer ← before
83
+ import agentyper as typer # ← after; everything else stays identical
84
+ ```
85
+
86
+ ## What Agents Get for Free
87
+
88
+ Every command automatically gains:
89
+
90
+ ```bash
91
+ my-tool --schema # full JSON Schema of the entire app
92
+ my-tool search --schema # JSON Schema for this command's params
93
+ my-tool search AAPL --format csv # 4× cheaper output than table
94
+ my-tool search AAPL --format json # structured JSON output
95
+ my-tool delete alice --yes # skip confirm() in agent mode
96
+ my-tool wizard --answers '{"confirms":[true],"prompts":["Alice","admin"]}'
97
+ ```
98
+
99
+ ## Agent Ergonomics
100
+
101
+ | Feature | agentyper | Typer |
102
+ |---|---|---|
103
+ | `--schema` on every command | ✅ automatic | ❌ manual |
104
+ | `--format json/csv/table` | ✅ automatic | ❌ manual |
105
+ | Structured JSON errors | ✅ automatic | ❌ free text |
106
+ | Exit code taxonomy (0/1/2) | ✅ | ❌ 0 or 1 |
107
+ | Interactive features in agent mode | ✅ `--yes/--answers` bypass | ❌ blocks |
108
+ | `isatty()` auto-format detection | ✅ | ❌ |
109
+ | Dependencies | argparse + pydantic | Click + Typer |
110
+
111
+ ## Exit Codes
112
+
113
+ ```python
114
+ agentyper.EXIT_SUCCESS = 0 # success
115
+ agentyper.EXIT_VALIDATION = 1 # bad input — agent should retry with correction
116
+ agentyper.EXIT_SYSTEM = 2 # system error — agent should abort
117
+ ```
118
+
119
+ ## Interactive Features
120
+
121
+ All interactive features from Typer work identically in a terminal.
122
+ In agent/non-TTY mode, they resolve without blocking:
123
+
124
+ ```bash
125
+ # Human terminal: asks interactively
126
+ my-tool delete alice
127
+
128
+ # Agent: auto-confirm via flag
129
+ my-tool delete alice --yes
130
+
131
+ # Agent: pre-supply all answers
132
+ my-tool wizard --answers '{"confirms":[true,false],"prompts":["Alice","admin"]}'
133
+
134
+ # Agent: pipe answers from stdin
135
+ echo '{"confirms":[true]}' | my-tool delete alice --answers -
136
+ ```
137
+
138
+ ## License
139
+
140
+ MIT
@@ -0,0 +1,111 @@
1
+ # agentyper
2
+
3
+ **Agent-first Python CLI library** — built on `argparse` + `pydantic`, Typer-compatible.
4
+
5
+ > *Typer was built for the era when type hints changed Python.*
6
+ > *agentyper is built for the era when AI agents changed how software is operated.*
7
+
8
+ ## Install
9
+
10
+ ```bash
11
+ pip install agentyper
12
+ ```
13
+
14
+ ## Quick Start
15
+
16
+ **Single function (like `typer.run()`):**
17
+
18
+ ```python
19
+ import agentyper
20
+
21
+ def search(ticker: str, limit: int = 10):
22
+ """Search securities by ticker."""
23
+ results = service.search(ticker, limit)
24
+ agentyper.output(results) # routes via --format automatically
25
+
26
+ agentyper.run(search)
27
+ ```
28
+
29
+ **Multi-command app:**
30
+
31
+ ```python
32
+ import agentyper
33
+
34
+ app = agentyper.Agentyper(name="my-tool", version="1.0.0")
35
+
36
+ @app.command()
37
+ def search(ticker: str, limit: int = agentyper.Option(10, help="Max results")):
38
+ """Search securities."""
39
+ agentyper.output(service.search(ticker, limit))
40
+
41
+ @app.command()
42
+ def delete(name: str):
43
+ """Delete a record."""
44
+ if agentyper.confirm(f"Delete '{name}'?"):
45
+ service.delete(name)
46
+
47
+ app()
48
+ ```
49
+
50
+ **Typer migration — one line:**
51
+
52
+ ```python
53
+ # import typer ← before
54
+ import agentyper as typer # ← after; everything else stays identical
55
+ ```
56
+
57
+ ## What Agents Get for Free
58
+
59
+ Every command automatically gains:
60
+
61
+ ```bash
62
+ my-tool --schema # full JSON Schema of the entire app
63
+ my-tool search --schema # JSON Schema for this command's params
64
+ my-tool search AAPL --format csv # 4× cheaper output than table
65
+ my-tool search AAPL --format json # structured JSON output
66
+ my-tool delete alice --yes # skip confirm() in agent mode
67
+ my-tool wizard --answers '{"confirms":[true],"prompts":["Alice","admin"]}'
68
+ ```
69
+
70
+ ## Agent Ergonomics
71
+
72
+ | Feature | agentyper | Typer |
73
+ |---|---|---|
74
+ | `--schema` on every command | ✅ automatic | ❌ manual |
75
+ | `--format json/csv/table` | ✅ automatic | ❌ manual |
76
+ | Structured JSON errors | ✅ automatic | ❌ free text |
77
+ | Exit code taxonomy (0/1/2) | ✅ | ❌ 0 or 1 |
78
+ | Interactive features in agent mode | ✅ `--yes/--answers` bypass | ❌ blocks |
79
+ | `isatty()` auto-format detection | ✅ | ❌ |
80
+ | Dependencies | argparse + pydantic | Click + Typer |
81
+
82
+ ## Exit Codes
83
+
84
+ ```python
85
+ agentyper.EXIT_SUCCESS = 0 # success
86
+ agentyper.EXIT_VALIDATION = 1 # bad input — agent should retry with correction
87
+ agentyper.EXIT_SYSTEM = 2 # system error — agent should abort
88
+ ```
89
+
90
+ ## Interactive Features
91
+
92
+ All interactive features from Typer work identically in a terminal.
93
+ In agent/non-TTY mode, they resolve without blocking:
94
+
95
+ ```bash
96
+ # Human terminal: asks interactively
97
+ my-tool delete alice
98
+
99
+ # Agent: auto-confirm via flag
100
+ my-tool delete alice --yes
101
+
102
+ # Agent: pre-supply all answers
103
+ my-tool wizard --answers '{"confirms":[true,false],"prompts":["Alice","admin"]}'
104
+
105
+ # Agent: pipe answers from stdin
106
+ echo '{"confirms":[true]}' | my-tool delete alice --answers -
107
+ ```
108
+
109
+ ## License
110
+
111
+ MIT
@@ -0,0 +1,74 @@
1
+ [project]
2
+ name = "agentyper"
3
+ version = "0.1.2"
4
+ description = "Agent-first Python CLI library — Typer-compatible, built on argparse + pydantic"
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ authors = [
8
+ { name = "Roman Medvedev", email = "pypi@romavm.dev" }
9
+ ]
10
+ license = { text = "MIT" }
11
+ keywords = ["cli", "agent", "ai", "pydantic", "argparse", "typer"]
12
+ classifiers = [
13
+ "Development Status :: 3 - Alpha",
14
+ "Intended Audience :: Developers",
15
+ "License :: OSI Approved :: MIT License",
16
+ "Topic :: Software Development :: Libraries :: Python Modules",
17
+ "Topic :: Terminals",
18
+ "Programming Language :: Python",
19
+ "Programming Language :: Python :: 3.10",
20
+ "Programming Language :: Python :: 3.11",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Programming Language :: Python :: 3.13",
23
+ "Programming Language :: Python :: Implementation :: CPython",
24
+ ]
25
+ dependencies = [
26
+ "pydantic>=2.0.0",
27
+ "rich>=13.0.0",
28
+ ]
29
+
30
+ [project.optional-dependencies]
31
+ completion = ["argcomplete>=3.0.0"]
32
+
33
+ [project.urls]
34
+ Homepage = "https://github.com/romamo/agentyper"
35
+ Repository = "https://github.com/romamo/agentyper"
36
+ Issues = "https://github.com/romamo/agentyper/issues"
37
+
38
+ [tool.uv]
39
+ dev-dependencies = [
40
+ "ruff",
41
+ "pytest>=8.0.0",
42
+ "mypy>=1.15.0",
43
+ "bandit>=1.8.3",
44
+ "pytest-cov>=6.0.0",
45
+ ]
46
+
47
+ [tool.ruff]
48
+ line-length = 100
49
+ target-version = "py310"
50
+
51
+ [tool.ruff.lint]
52
+ select = ["E", "F", "I", "UP", "B", "SIM", "PLC", "PLE"]
53
+
54
+ [build-system]
55
+ requires = ["hatchling"]
56
+ build-backend = "hatchling.build"
57
+
58
+ [tool.hatch.build.targets.wheel]
59
+ packages = ["src/agentyper"]
60
+
61
+ [tool.hatch.build.targets.sdist]
62
+ include = [
63
+ "/src",
64
+ "/tests",
65
+ "/README.md",
66
+ "/CHANGELOG.md",
67
+ "/LICENSE",
68
+ ]
69
+ exclude = [
70
+ "/.agent",
71
+ "/.github",
72
+ "/uv.lock",
73
+ "/tmp",
74
+ ]