weave-python 0.10.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.
Files changed (69) hide show
  1. weave_python-0.10.0/.github/workflows/format-lint.yaml +13 -0
  2. weave_python-0.10.0/.github/workflows/generate.yaml +105 -0
  3. weave_python-0.10.0/.github/workflows/release.yaml +39 -0
  4. weave_python-0.10.0/.gitignore +326 -0
  5. weave_python-0.10.0/.python-version +1 -0
  6. weave_python-0.10.0/PKG-INFO +6 -0
  7. weave_python-0.10.0/buf.gen.yaml +17 -0
  8. weave_python-0.10.0/pyproject.toml +21 -0
  9. weave_python-0.10.0/renovate.json +6 -0
  10. weave_python-0.10.0/sqlc.yaml +19 -0
  11. weave_python-0.10.0/tools/fiximports/go.mod +3 -0
  12. weave_python-0.10.0/tools/fiximports/main.go +86 -0
  13. weave_python-0.10.0/tools/package/go.mod +3 -0
  14. weave_python-0.10.0/tools/package/main.go +61 -0
  15. weave_python-0.10.0/uv.lock +136 -0
  16. weave_python-0.10.0/weave/datamanagement/db/models.py +131 -0
  17. weave_python-0.10.0/weave/datamanagement/db/queries.py +140 -0
  18. weave_python-0.10.0/weave/datamanagement/generate/v1/configuration_pb2.py +51 -0
  19. weave_python-0.10.0/weave/datamanagement/generate/v1/configuration_pb2.pyi +283 -0
  20. weave_python-0.10.0/weave/datamanagement/generate/v1/configuration_pb2_grpc.py +4 -0
  21. weave_python-0.10.0/weave/datamanagement/generate/v1/configuration_pb2_grpc.pyi +17 -0
  22. weave_python-0.10.0/weave/datamanagement/generate/v1/service_pb2.py +63 -0
  23. weave_python-0.10.0/weave/datamanagement/generate/v1/service_pb2.pyi +159 -0
  24. weave_python-0.10.0/weave/datamanagement/generate/v1/service_pb2_grpc.py +206 -0
  25. weave_python-0.10.0/weave/datamanagement/generate/v1/service_pb2_grpc.pyi +92 -0
  26. weave_python-0.10.0/weave/datamanagement/storage/v1/auth_pb2.py +37 -0
  27. weave_python-0.10.0/weave/datamanagement/storage/v1/auth_pb2.pyi +32 -0
  28. weave_python-0.10.0/weave/datamanagement/storage/v1/auth_pb2_grpc.py +4 -0
  29. weave_python-0.10.0/weave/datamanagement/storage/v1/auth_pb2_grpc.pyi +17 -0
  30. weave_python-0.10.0/weave/datamanagement/storage/v1/nosql_database_pb2.py +54 -0
  31. weave_python-0.10.0/weave/datamanagement/storage/v1/nosql_database_pb2.pyi +263 -0
  32. weave_python-0.10.0/weave/datamanagement/storage/v1/nosql_database_pb2_grpc.py +4 -0
  33. weave_python-0.10.0/weave/datamanagement/storage/v1/nosql_database_pb2_grpc.pyi +17 -0
  34. weave_python-0.10.0/weave/datamanagement/storage/v1/object_store_pb2.py +44 -0
  35. weave_python-0.10.0/weave/datamanagement/storage/v1/object_store_pb2.pyi +117 -0
  36. weave_python-0.10.0/weave/datamanagement/storage/v1/object_store_pb2_grpc.py +4 -0
  37. weave_python-0.10.0/weave/datamanagement/storage/v1/object_store_pb2_grpc.pyi +17 -0
  38. weave_python-0.10.0/weave/datamanagement/storage/v1/service_pb2.py +68 -0
  39. weave_python-0.10.0/weave/datamanagement/storage/v1/service_pb2.pyi +386 -0
  40. weave_python-0.10.0/weave/datamanagement/storage/v1/service_pb2_grpc.py +301 -0
  41. weave_python-0.10.0/weave/datamanagement/storage/v1/service_pb2_grpc.pyi +150 -0
  42. weave_python-0.10.0/weave/datamanagement/storage/v1/sql_database_pb2.py +53 -0
  43. weave_python-0.10.0/weave/datamanagement/storage/v1/sql_database_pb2.pyi +284 -0
  44. weave_python-0.10.0/weave/datamanagement/storage/v1/sql_database_pb2_grpc.py +4 -0
  45. weave_python-0.10.0/weave/datamanagement/storage/v1/sql_database_pb2_grpc.pyi +17 -0
  46. weave_python-0.10.0/weave/datamanagement/storage/v1/storage_pb2.py +40 -0
  47. weave_python-0.10.0/weave/datamanagement/storage/v1/storage_pb2.pyi +49 -0
  48. weave_python-0.10.0/weave/datamanagement/storage/v1/storage_pb2_grpc.py +4 -0
  49. weave_python-0.10.0/weave/datamanagement/storage/v1/storage_pb2_grpc.pyi +17 -0
  50. weave_python-0.10.0/weave/datamanagement/synthesize/v1/dataset_pb2.py +43 -0
  51. weave_python-0.10.0/weave/datamanagement/synthesize/v1/dataset_pb2.pyi +143 -0
  52. weave_python-0.10.0/weave/datamanagement/synthesize/v1/dataset_pb2_grpc.py +4 -0
  53. weave_python-0.10.0/weave/datamanagement/synthesize/v1/dataset_pb2_grpc.pyi +17 -0
  54. weave_python-0.10.0/weave/datamanagement/synthesize/v1/inline_data_pb2.py +39 -0
  55. weave_python-0.10.0/weave/datamanagement/synthesize/v1/inline_data_pb2.pyi +67 -0
  56. weave_python-0.10.0/weave/datamanagement/synthesize/v1/inline_data_pb2_grpc.py +4 -0
  57. weave_python-0.10.0/weave/datamanagement/synthesize/v1/inline_data_pb2_grpc.pyi +17 -0
  58. weave_python-0.10.0/weave/datamanagement/synthesize/v1/relationship_pb2.py +41 -0
  59. weave_python-0.10.0/weave/datamanagement/synthesize/v1/relationship_pb2.pyi +109 -0
  60. weave_python-0.10.0/weave/datamanagement/synthesize/v1/relationship_pb2_grpc.py +4 -0
  61. weave_python-0.10.0/weave/datamanagement/synthesize/v1/relationship_pb2_grpc.pyi +17 -0
  62. weave_python-0.10.0/weave/datamanagement/synthesize/v1/service_pb2.py +45 -0
  63. weave_python-0.10.0/weave/datamanagement/synthesize/v1/service_pb2.pyi +52 -0
  64. weave_python-0.10.0/weave/datamanagement/synthesize/v1/service_pb2_grpc.py +77 -0
  65. weave_python-0.10.0/weave/datamanagement/synthesize/v1/service_pb2_grpc.pyi +41 -0
  66. weave_python-0.10.0/weave/datamanagement/synthesize/v1/training_pb2.py +44 -0
  67. weave_python-0.10.0/weave/datamanagement/synthesize/v1/training_pb2.pyi +120 -0
  68. weave_python-0.10.0/weave/datamanagement/synthesize/v1/training_pb2_grpc.py +4 -0
  69. weave_python-0.10.0/weave/datamanagement/synthesize/v1/training_pb2_grpc.pyi +17 -0
@@ -0,0 +1,13 @@
1
+ name: "Format and Lint"
2
+
3
+ on:
4
+ pull_request:
5
+
6
+ permissions:
7
+ contents: "read"
8
+
9
+ jobs:
10
+ format-lint:
11
+ uses: weave-labs/ci/.github/workflows/python-lint.yaml@main
12
+ with:
13
+ src: "./weave"
@@ -0,0 +1,105 @@
1
+ name: "generate schema"
2
+
3
+ on:
4
+ repository_dispatch:
5
+ types:
6
+ - schema-release
7
+
8
+ permissions:
9
+ contents: write
10
+ pull-requests: write
11
+
12
+ jobs:
13
+ generate:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - id: app_token
17
+ uses: actions/create-github-app-token@v2
18
+ with:
19
+ app-id: ${{ secrets.STITCH_ID }}
20
+ private-key: ${{ secrets.STITCH_PRIVATE_KEY }}
21
+ owner: weave-labs
22
+
23
+ - uses: actions/checkout@v4
24
+ with:
25
+ persist-credentials: 'false'
26
+
27
+ - name: Checkout schema
28
+ uses: actions/checkout@v4
29
+ with:
30
+ path: schema
31
+ persist-credentials: 'false'
32
+ repository: weave-labs/schema
33
+ ref: ${{ github.event.client_payload.ref }}
34
+ token: ${{ steps.app_token.outputs.token }}
35
+
36
+ - name: Setup sqlc
37
+ uses: sqlc-dev/setup-sqlc@v4
38
+ with:
39
+ sqlc-version: '1.28.0'
40
+
41
+ - name: Setup buf
42
+ uses: bufbuild/buf-action@v1
43
+ with:
44
+ setup_only: 'true'
45
+
46
+ - name: Setup protoc
47
+ uses: arduino/setup-protoc@v3
48
+ with:
49
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
50
+
51
+ - name: Setup uv
52
+ uses: astral-sh/setup-uv@v5
53
+ with:
54
+ cache-dependency-glob: "uv.lock"
55
+ enable-cache: true
56
+ pyproject-file: pyproject.toml
57
+
58
+ - name: Setup Go
59
+ uses: actions/setup-go@v5
60
+ with:
61
+ go-version: stable
62
+
63
+ - name: Generate sql schema
64
+ run: sqlc generate
65
+
66
+ - name: Generate proto schema
67
+ run: buf generate
68
+
69
+ - name: Remove schema directory
70
+ run: rm -rf schema
71
+
72
+ - name: Run uv sync
73
+ run: uv sync
74
+
75
+ # - name: Fix import paths in generated files
76
+ # run: go run ./tools/fiximports
77
+ #
78
+ # - name: Create packages
79
+ # run: go run ./tools/package/main.go --target-dir ./weave
80
+
81
+ - name: Check for changes
82
+ id: check_changes
83
+ run: |
84
+ if [[ -z $(git status --porcelain) ]]; then
85
+ echo "No changes detected"
86
+ echo "has_changes=false" >> $GITHUB_OUTPUT
87
+ else
88
+ echo "Changes detected"
89
+ git status
90
+ echo "has_changes=true" >> $GITHUB_OUTPUT
91
+ fi
92
+
93
+ - name: Create Pull Request
94
+ if: steps.check_changes.outputs.has_changes == 'true'
95
+ uses: peter-evans/create-pull-request@v7
96
+ with:
97
+ base: 'main'
98
+ delete-branch: 'true'
99
+ body: |
100
+ This PR updates the generated code from schema version ${{ github.event.client_payload.schema_version }}.
101
+ Automated changes by GitHub Actions workflow.
102
+ branch: "update-schema-${{ github.event.client_payload.schema_version }}"
103
+ commit-message: "feat: update generated code from schema ${{ github.event.client_payload.schema_version }}"
104
+ title: "Update generated code from schema ${{ github.event.client_payload.schema_version }}"
105
+ token: ${{ steps.app_token.outputs.token }}
@@ -0,0 +1,39 @@
1
+ name: publish python
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ # paths:
8
+ # - weave/**
9
+ # - pyproject.toml
10
+ # - .python-version
11
+
12
+ permissions:
13
+ contents: write
14
+ id-token: write
15
+
16
+ jobs:
17
+ tag-and-release:
18
+ uses: weave-labs/ci/.github/workflows/tag-and-release.yaml@main
19
+ package:
20
+ needs: tag-and-release
21
+ uses: weave-labs/ci/.github/workflows/publish-python.yaml@main
22
+ publish:
23
+ needs: package
24
+ runs-on: ubuntu-latest
25
+ permissions:
26
+ id-token: write
27
+ environment:
28
+ name: pypi
29
+ url: https://pypi.org/p/<your-pypi-project-name>
30
+ steps:
31
+ - uses: actions/download-artifact@v4
32
+ with:
33
+ name: dist
34
+ path: dist/
35
+
36
+ - name: Publish package distributions to PyPI
37
+ uses: pypa/gh-action-pypi-publish@release/v1
38
+ with:
39
+ attestations: 'true'
@@ -0,0 +1,326 @@
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
+ ### Linux template
95
+ *~
96
+
97
+ # temporary files which can be created if a process still has a handle open of a deleted file
98
+ .fuse_hidden*
99
+
100
+ # KDE directory preferences
101
+ .directory
102
+
103
+ # Linux trash folder which might appear on any partition or disk
104
+ .Trash-*
105
+
106
+ # .nfs files are created when an open file is removed but is still being accessed
107
+ .nfs*
108
+
109
+ ### Windows template
110
+ # Windows thumbnail cache files
111
+ Thumbs.db
112
+ Thumbs.db:encryptable
113
+ ehthumbs.db
114
+ ehthumbs_vista.db
115
+
116
+ # Dump file
117
+ *.stackdump
118
+
119
+ # Folder config file
120
+ [Dd]esktop.ini
121
+
122
+ # Recycle Bin used on file shares
123
+ $RECYCLE.BIN/
124
+
125
+ # Windows Installer files
126
+ *.cab
127
+ *.msi
128
+ *.msix
129
+ *.msm
130
+ *.msp
131
+
132
+ # Windows shortcuts
133
+ *.lnk
134
+
135
+ ### macOS template
136
+ # General
137
+ .DS_Store
138
+ .AppleDouble
139
+ .LSOverride
140
+
141
+ # Icon must end with two \r
142
+ Icon
143
+
144
+ # Thumbnails
145
+ ._*
146
+
147
+ # Files that might appear in the root of a volume
148
+ .DocumentRevisions-V100
149
+ .fseventsd
150
+ .Spotlight-V100
151
+ .TemporaryItems
152
+ .Trashes
153
+ .VolumeIcon.icns
154
+ .com.apple.timemachine.donotpresent
155
+
156
+ # Directories potentially created on remote AFP share
157
+ .AppleDB
158
+ .AppleDesktop
159
+ Network Trash Folder
160
+ Temporary Items
161
+ .apdisk
162
+
163
+ ### Python template
164
+ # Byte-compiled / optimized / DLL files
165
+ __pycache__/
166
+ *.py[cod]
167
+ *$py.class
168
+
169
+ # C extensions
170
+ *.so
171
+
172
+ # Distribution / packaging
173
+ .Python
174
+ build/
175
+ develop-eggs/
176
+ dist/
177
+ downloads/
178
+ eggs/
179
+ .eggs/
180
+ lib/
181
+ lib64/
182
+ parts/
183
+ sdist/
184
+ var/
185
+ wheels/
186
+ share/python-wheels/
187
+ *.egg-info/
188
+ .installed.cfg
189
+ *.egg
190
+ MANIFEST
191
+
192
+ # PyInstaller
193
+ # Usually these files are written by a python script from a template
194
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
195
+ *.manifest
196
+ *.spec
197
+
198
+ # Installer logs
199
+ pip-log.txt
200
+ pip-delete-this-directory.txt
201
+
202
+ # Unit test / coverage reports
203
+ htmlcov/
204
+ .tox/
205
+ .nox/
206
+ .coverage
207
+ .coverage.*
208
+ .cache
209
+ nosetests.xml
210
+ coverage.xml
211
+ *.cover
212
+ *.py,cover
213
+ .hypothesis/
214
+ .pytest_cache/
215
+ cover/
216
+
217
+ # Translations
218
+ *.mo
219
+ *.pot
220
+
221
+ # Django stuff:
222
+ *.log
223
+ local_settings.py
224
+ db.sqlite3
225
+ db.sqlite3-journal
226
+
227
+ # Flask stuff:
228
+ instance/
229
+ .webassets-cache
230
+
231
+ # Scrapy stuff:
232
+ .scrapy
233
+
234
+ # Sphinx documentation
235
+ docs/_build/
236
+
237
+ # PyBuilder
238
+ .pybuilder/
239
+ target/
240
+
241
+ # Jupyter Notebook
242
+ .ipynb_checkpoints
243
+
244
+ # IPython
245
+ profile_default/
246
+ ipython_config.py
247
+
248
+ # pyenv
249
+ # For a library or package, you might want to ignore these files since the code is
250
+ # intended to run in multiple environments; otherwise, check them in:
251
+ # .python-version
252
+
253
+ # pipenv
254
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
255
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
256
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
257
+ # install all needed dependencies.
258
+ #Pipfile.lock
259
+
260
+ # poetry
261
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
262
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
263
+ # commonly ignored for libraries.
264
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
265
+ #poetry.lock
266
+
267
+ # pdm
268
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
269
+ #pdm.lock
270
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
271
+ # in version control.
272
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
273
+ .pdm.toml
274
+ .pdm-python
275
+ .pdm-build/
276
+
277
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
278
+ __pypackages__/
279
+
280
+ # Celery stuff
281
+ celerybeat-schedule
282
+ celerybeat.pid
283
+
284
+ # SageMath parsed files
285
+ *.sage.py
286
+
287
+ # Environments
288
+ .env
289
+ .venv
290
+ env/
291
+ venv/
292
+ ENV/
293
+ env.bak/
294
+ venv.bak/
295
+
296
+ # Spyder project settings
297
+ .spyderproject
298
+ .spyproject
299
+
300
+ # Rope project settings
301
+ .ropeproject
302
+
303
+ # mkdocs documentation
304
+ /site
305
+
306
+ # mypy
307
+ .mypy_cache/
308
+ .dmypy.json
309
+ dmypy.json
310
+
311
+ # Pyre type checker
312
+ .pyre/
313
+
314
+ # pytype static type analyzer
315
+ .pytype/
316
+
317
+ # Cython debug symbols
318
+ cython_debug/
319
+
320
+ # PyCharm
321
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
322
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
323
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
324
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
325
+ #.idea/
326
+
@@ -0,0 +1 @@
1
+ 3.13
@@ -0,0 +1,6 @@
1
+ Metadata-Version: 2.4
2
+ Name: weave-python
3
+ Version: 0.10.0
4
+ Requires-Python: >=3.10
5
+ Requires-Dist: protobuf>=6.30.2
6
+ Requires-Dist: sqlalchemy>=2.0.40
@@ -0,0 +1,17 @@
1
+ version: v2
2
+ managed:
3
+ enabled: true
4
+ inputs:
5
+ - directory: "schema"
6
+ plugins:
7
+ - remote: "buf.build/protocolbuffers/python"
8
+ out: "."
9
+
10
+ - remote: "buf.build/grpc/python"
11
+ out: "."
12
+
13
+ - remote: "buf.build/community/nipunn1313-mypy"
14
+ out: "."
15
+
16
+ - remote: "buf.build/community/nipunn1313-mypy-grpc"
17
+ out: "."
@@ -0,0 +1,21 @@
1
+ [project]
2
+ name = "weave-python"
3
+ dynamic = ["version"]
4
+ requires-python = ">=3.10"
5
+ dependencies = [
6
+ "protobuf>=6.30.2",
7
+ "sqlalchemy>=2.0.40",
8
+ ]
9
+
10
+ [build-system]
11
+ requires = ["hatchling", "hatch-vcs"]
12
+ build-backend = "hatchling.build"
13
+
14
+ [tool.hatch.build.targets.wheel]
15
+ packages = ["weave"]
16
+
17
+ [tool.hatch.version]
18
+ source = "vcs"
19
+
20
+ [tool.hatch.version.raw-options]
21
+ version_scheme = "only-version"
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
+ "extends": [
4
+ "config:recommended"
5
+ ]
6
+ }
@@ -0,0 +1,19 @@
1
+ version: "2"
2
+ plugins:
3
+ - name: py
4
+ wasm:
5
+ url: https://downloads.sqlc.dev/plugin/sqlc-gen-python_1.3.0.wasm
6
+ sha256: fbedae96b5ecae2380a70fb5b925fd4bff58a6cfb1f3140375d098fbab7b3a3c
7
+ sql:
8
+ - schema: "schema/weave/datamanagement/sql/migrations"
9
+ queries: "schema/weave/datamanagement/sql/queries"
10
+ engine: "postgresql"
11
+ codegen:
12
+ - out: "weave/datamanagement/db"
13
+ plugin: "py"
14
+ options:
15
+ package: "weave.datamanagement.db"
16
+ emit_async_querier: true
17
+ emit_str_enum: true
18
+ emit_sync_querier: true
19
+ query_parameter_limit: 2
@@ -0,0 +1,3 @@
1
+ module github.com/weave-labs/weave-python/tools/fiximports
2
+
3
+ go 1.24
@@ -0,0 +1,86 @@
1
+ package main
2
+
3
+ import (
4
+ "flag"
5
+ "fmt"
6
+ "os"
7
+ "path/filepath"
8
+ "regexp"
9
+ )
10
+
11
+ // Regular expressions for replacing import statements
12
+ var (
13
+ importRegex = regexp.MustCompile(`from datamanagement`)
14
+ dbImportRegex = regexp.MustCompile(`from db import models`)
15
+ )
16
+
17
+ func main() {
18
+ // Parse command line arguments
19
+ var directory string
20
+ flag.StringVar(&directory, "directory", "weave/gen", "Directory containing generated files to fix")
21
+ flag.Parse()
22
+
23
+ // If a positional argument is provided, use it as the directory
24
+ if flag.NArg() > 0 {
25
+ directory = flag.Arg(0)
26
+ }
27
+
28
+ fmt.Printf("Fixing imports in %s\n", directory)
29
+
30
+ // Walk through all Python files in the directory
31
+ err := filepath.Walk(directory, func(path string, info os.FileInfo, err error) error {
32
+ if err != nil {
33
+ return err
34
+ }
35
+
36
+ // Skip directories
37
+ if info.IsDir() {
38
+ return nil
39
+ }
40
+
41
+ // Only process Python files
42
+ if filepath.Ext(path) != ".py" {
43
+ return nil
44
+ }
45
+
46
+ return fixFileImports(path)
47
+ })
48
+
49
+ if err != nil {
50
+ fmt.Printf("Error walking directory: %v\n", err)
51
+ os.Exit(1)
52
+ }
53
+
54
+ fmt.Println("Import fixing completed")
55
+ }
56
+
57
+ // fixFileImports fixes imports in a single file
58
+ func fixFileImports(filePath string) error {
59
+ // Read file content
60
+ content, err := os.ReadFile(filePath)
61
+ if err != nil {
62
+ return fmt.Errorf("error reading file %s: %v", filePath, err)
63
+ }
64
+
65
+ // Convert to string for regex operations
66
+ contentStr := string(content)
67
+
68
+ // Fix import statements
69
+ // Pattern: from datamanagement... import ...
70
+ modifiedContent := importRegex.ReplaceAllString(contentStr, "from weave.gen.datamanagement")
71
+
72
+ // Fix BuildTopDescriptorsAndMessages calls
73
+ // Pattern: _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'datamanagement...', _globals)
74
+ modifiedContent = dbImportRegex.ReplaceAllString(modifiedContent, "from weave.gen.datamanagement.db import models")
75
+
76
+ // Only write back if changes were made
77
+ if contentStr != modifiedContent {
78
+ fmt.Printf("Fixing imports in %s\n", filePath)
79
+ err = os.WriteFile(filePath, []byte(modifiedContent), 0644)
80
+ if err != nil {
81
+ return fmt.Errorf("error writing file %s: %v", filePath, err)
82
+ }
83
+ }
84
+
85
+ return nil
86
+ }
@@ -0,0 +1,3 @@
1
+ module github.com/weave-labs/weave-python/tools/package
2
+
3
+ go 1.24