Skip to content

Commit bf48147

Browse files
committed
init
0 parents  commit bf48147

File tree

10 files changed

+1702
-0
lines changed

10 files changed

+1702
-0
lines changed

.gitignore

Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
.py[cod]
2+
__pycache__/
3+
.mypy_cache/
4+
.pytest_cache/
5+
.ruff_cache/
6+
.pdm-python
7+
8+
# Byte-compiled / optimized / DLL files
9+
__pycache__/
10+
*.py[codz]
11+
*$py.class
12+
13+
# C extensions
14+
*.so
15+
16+
# Distribution / packaging
17+
.Python
18+
build/
19+
develop-eggs/
20+
dist/
21+
downloads/
22+
eggs/
23+
.eggs/
24+
lib/
25+
lib64/
26+
parts/
27+
sdist/
28+
var/
29+
wheels/
30+
share/python-wheels/
31+
*.egg-info/
32+
.installed.cfg
33+
*.egg
34+
MANIFEST
35+
36+
# PyInstaller
37+
# Usually these files are written by a python script from a template
38+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
39+
*.manifest
40+
*.spec
41+
42+
# Installer logs
43+
pip-log.txt
44+
pip-delete-this-directory.txt
45+
46+
# Unit test / coverage reports
47+
htmlcov/
48+
.tox/
49+
.nox/
50+
.coverage
51+
.coverage.*
52+
.cache
53+
nosetests.xml
54+
coverage.xml
55+
*.cover
56+
*.py.cover
57+
.hypothesis/
58+
.pytest_cache/
59+
cover/
60+
61+
# Translations
62+
*.mo
63+
*.pot
64+
65+
# Django stuff:
66+
*.log
67+
local_settings.py
68+
db.sqlite3
69+
db.sqlite3-journal
70+
71+
# Flask stuff:
72+
instance/
73+
.webassets-cache
74+
75+
# Scrapy stuff:
76+
.scrapy
77+
78+
# Sphinx documentation
79+
docs/_build/
80+
81+
# PyBuilder
82+
.pybuilder/
83+
target/
84+
85+
# Jupyter Notebook
86+
.ipynb_checkpoints
87+
88+
# IPython
89+
profile_default/
90+
ipython_config.py
91+
92+
# pyenv
93+
# For a library or package, you might want to ignore these files since the code is
94+
# intended to run in multiple environments; otherwise, check them in:
95+
# .python-version
96+
97+
# pipenv
98+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
99+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
100+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
101+
# install all needed dependencies.
102+
# Pipfile.lock
103+
104+
# UV
105+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
106+
# This is especially recommended for binary packages to ensure reproducibility, and is more
107+
# commonly ignored for libraries.
108+
# uv.lock
109+
110+
# poetry
111+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
112+
# This is especially recommended for binary packages to ensure reproducibility, and is more
113+
# commonly ignored for libraries.
114+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
115+
# poetry.lock
116+
# poetry.toml
117+
118+
# pdm
119+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
120+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
121+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
122+
# pdm.lock
123+
# pdm.toml
124+
.pdm-python
125+
.pdm-build/
126+
127+
# pixi
128+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
129+
# pixi.lock
130+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
131+
# in the .venv directory. It is recommended not to include this directory in version control.
132+
.pixi
133+
134+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
135+
__pypackages__/
136+
137+
# Celery stuff
138+
celerybeat-schedule
139+
celerybeat.pid
140+
141+
# Redis
142+
*.rdb
143+
*.aof
144+
*.pid
145+
146+
# RabbitMQ
147+
mnesia/
148+
rabbitmq/
149+
rabbitmq-data/
150+
151+
# ActiveMQ
152+
activemq-data/
153+
154+
# SageMath parsed files
155+
*.sage.py
156+
157+
# Environments
158+
.env
159+
.envrc
160+
.venv
161+
env/
162+
venv/
163+
ENV/
164+
env.bak/
165+
venv.bak/
166+
167+
# Spyder project settings
168+
.spyderproject
169+
.spyproject
170+
171+
# Rope project settings
172+
.ropeproject
173+
174+
# mkdocs documentation
175+
/site
176+
177+
# mypy
178+
.mypy_cache/
179+
.dmypy.json
180+
dmypy.json
181+
182+
# Pyre type checker
183+
.pyre/
184+
185+
# pytype static type analyzer
186+
.pytype/
187+
188+
# Cython debug symbols
189+
cython_debug/
190+
191+
# PyCharm
192+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
193+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
194+
# and can be added to the global gitignore or merged into this file. For a more nuclear
195+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
196+
# .idea/
197+
198+
# Abstra
199+
# Abstra is an AI-powered process automation framework.
200+
# Ignore directories containing user credentials, local state, and settings.
201+
# Learn more at https://abstra.io/docs
202+
.abstra/
203+
204+
# Visual Studio Code
205+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
206+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
207+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
208+
# you could uncomment the following to ignore the entire vscode folder
209+
# .vscode/
210+
211+
# Ruff stuff:
212+
.ruff_cache/
213+
214+
# PyPI configuration file
215+
.pypirc
216+
217+
# Marimo
218+
marimo/_static/
219+
marimo/_lsp/
220+
__marimo__/
221+
222+
# Streamlit
223+
.streamlit/secrets.toml

models/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"""
2+
Models for Terraform IBM Modules Search
3+
"""
4+
5+
from .terraform_module import TerraformModuleSearchResult, TerraformModuleDetail
6+
7+
__all__ = ["TerraformModuleSearchResult", "TerraformModuleDetail"]

models/terraform_module.py

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
"""
2+
Models for Terraform modules
3+
"""
4+
5+
from typing import Dict, Any, List
6+
7+
8+
class TerraformModuleSearchResult:
9+
def __init__(self, module_data: Dict[str, Any]):
10+
self.id = module_data.get("id", "")
11+
self.namespace = module_data.get("namespace", "")
12+
self.name = module_data.get("name", "")
13+
self.version = module_data.get("version", "")
14+
self.provider = module_data.get("provider", "")
15+
self.description = module_data.get("description", "")
16+
self.downloads = module_data.get("downloads", 0)
17+
self.source = module_data.get("source", "")
18+
self.published_at = module_data.get("published_at", "")
19+
20+
def to_dict(self) -> Dict[str, Any]:
21+
"""Convert module data to dictionary format"""
22+
return {
23+
"id": self.id,
24+
"name": self.name,
25+
"namespace": self.namespace,
26+
"provider": self.provider,
27+
"version": self.version,
28+
"description": self.description,
29+
"downloads": self.downloads,
30+
"source": self.source,
31+
"url": f"https://registry.terraform.io/modules/{self.namespace}/{self.name}/{self.provider}"
32+
}
33+
34+
35+
class TerraformModuleDetail:
36+
def __init__(self, module_data: Dict[str, Any]):
37+
self.id = module_data.get("id", "")
38+
self.namespace = module_data.get("namespace", "")
39+
self.name = module_data.get("name", "")
40+
self.version = module_data.get("version", "")
41+
self.provider = module_data.get("provider", "")
42+
self.description = module_data.get("description", "")
43+
self.source = module_data.get("source", "")
44+
self.published_at = module_data.get("published_at", "")
45+
self.downloads = module_data.get("downloads", 0)
46+
47+
# Root module data
48+
self.root = module_data.get("root", {})
49+
50+
# Submodules
51+
self.submodules = module_data.get("submodules", [])
52+
53+
# Examples
54+
self.examples = module_data.get("examples", [])
55+
56+
def to_filtered_dict(self) -> Dict[str, Any]:
57+
"""Convert module data to filtered dictionary format for LLM consumption"""
58+
# Process examples to include only path and readme
59+
filtered_examples = []
60+
for example in self.examples:
61+
filtered_examples.append({
62+
"path": example.get("path", ""),
63+
"name": example.get("name", ""),
64+
"readme": example.get("readme", "")
65+
})
66+
67+
# Process submodules to include readme
68+
filtered_submodules = []
69+
for submodule in self.submodules:
70+
filtered_submodules.append({
71+
"path": submodule.get("path", ""),
72+
"name": submodule.get("name", ""),
73+
"readme": submodule.get("readme", "")
74+
})
75+
76+
return {
77+
"id": self.id,
78+
"name": self.name,
79+
"namespace": self.namespace,
80+
"provider": self.provider,
81+
"version": self.version,
82+
"description": self.description,
83+
"source": self.source,
84+
"root": {
85+
"readme": self.root.get("readme", "")
86+
},
87+
"submodules": filtered_submodules,
88+
"examples": filtered_examples
89+
}

0 commit comments

Comments
 (0)