@suss/adapter-python 0.36.0 → 0.37.0

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.
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { RequestSpellingMetadata, TypeShape, WrapperReference, BehavioralSummary } from '@suss/behavioral-ir';
1
+ import { RequestSpellingMetadata, MessageBusTechnology, TypeShape, WrapperReference, BehavioralSummary } from '@suss/behavioral-ir';
2
2
  import { Tree, Node } from 'web-tree-sitter';
3
3
  export { Node as PyNode, Tree as PyTree } from 'web-tree-sitter';
4
4
  import { Database } from '@suss/datalog';
@@ -145,6 +145,70 @@ interface PythonPack {
145
145
  requestSpelling?: RequestSpellingMetadata;
146
146
  /** How the library's test runner collects tests, so a PRD scenario can say which test covers it. */
147
147
  tests?: PyTestCases[];
148
+ /** How the library runs a project function as a background job, and the calls that enqueue one. DESIGN.md says how each is read. */
149
+ jobQueues?: PyJobQueue[];
150
+ }
151
+ /**
152
+ * A library that runs a project's functions off a queue, such as Celery.
153
+ * A function under one of `taskDecorators` becomes a consumer unit, and a
154
+ * call that enqueues it becomes a `message-send` on the same channel.
155
+ * Every name here is one the library defines.
156
+ */
157
+ interface PyJobQueue {
158
+ /** The bus the bindings say, `celery`. */
159
+ messageBus: MessageBusTechnology;
160
+ /** The module the library's decorators and app class come from, `celery`. */
161
+ module: string;
162
+ /** Decorators that make a function a task: `shared_task`, and `task` on the app. */
163
+ taskDecorators: string[];
164
+ /** The keyword a task decorator takes the task's name under: `name`. */
165
+ nameKeyword: string;
166
+ /** The keyword a task decorator takes its queue under: `queue`. */
167
+ queueKeyword: string;
168
+ /** What the library calls a task whose decorator gives no name. */
169
+ defaultName: PyDefaultTaskName;
170
+ /** Methods on a task that enqueue it, and where each takes the task's arguments. */
171
+ enqueueMethods: PyEnqueueMethod[];
172
+ /** Methods on the app that enqueue a task by its name, `send_task`. */
173
+ sendByName?: PySendByName[];
174
+ /** The app's class, and the objects the module exports that stand for the app: `Celery`, `current_app`. */
175
+ apps: string[];
176
+ }
177
+ /**
178
+ * `modulePath` is Celery's: the dotted path of the module the function
179
+ * is written in, a dot, and the function's name.
180
+ */
181
+ type PyDefaultTaskName = "modulePath";
182
+ /** Where a method takes one of its inputs: a position, a keyword, or both. */
183
+ interface PyCallArgument {
184
+ argument?: number;
185
+ keyword?: string;
186
+ }
187
+ /**
188
+ * How an enqueue call passes the task's arguments. `spread` passes them
189
+ * as the call's own, `delay(a, b, c=1)`. `packed` passes the positional
190
+ * ones as one sequence and the keyword ones as one mapping,
191
+ * `apply_async((a, b), {"c": 1})`.
192
+ */
193
+ type PyTaskArguments = {
194
+ type: "spread";
195
+ } | {
196
+ type: "packed";
197
+ args: PyCallArgument;
198
+ kwargs: PyCallArgument;
199
+ };
200
+ interface PyEnqueueMethod {
201
+ /** The method's name, `delay`. */
202
+ method: string;
203
+ arguments: PyTaskArguments;
204
+ }
205
+ interface PySendByName {
206
+ /** The method's name, `send_task`. */
207
+ method: string;
208
+ /** Where it takes the task's name. */
209
+ name: PyCallArgument;
210
+ /** Where it takes the task's arguments. */
211
+ arguments: PyTaskArguments;
148
212
  }
149
213
  /**
150
214
  * How a test runner finds tests and what it runs around each one. Every
@@ -1535,4 +1599,4 @@ declare function pythonImportEvidence(options: PythonImportEvidenceOptions): Pro
1535
1599
  */
1536
1600
  declare const ADAPTER_VERSION = "0.1.0";
1537
1601
 
1538
- export { ADAPTER_VERSION, type AnnotationContext, type Binding, type BoundPythonFile, type DecoratedClassRoute, type DecoratedFunctionRoute, type DecoratorArg, type DecoratorClassification, type DiscoveryOptions, type ExtractPythonOptions, type ExtractPythonResult, type FileFactsOptions, type KeptPythonParses, type ModuleBinding, type ModuleResolution, type ModuleResolverOptions, type MountObjectCarrier, type MountObjectPrefix, type MountPrefixEffect, type NoValuePrefix, type ParameterSource, type PathRepeatedSlashes, type PrefixTrailingSlash, type PyModelEntryFunction, type PyModelEntryMethod, type PyModelQueries, type PyStatusCall, type PyTestCases, type PyTestMocks, type PyTestSetUp, type PythonDiscoveryPattern, type PythonImportEvidence, type PythonImportEvidenceOptions, type PythonImportSite, type PythonPack, type PythonSourceRoots, type PythonValueHandle, PythonWhySession, type PythonWhySessionOptions, type RawSqlPattern, type RelativeModuleSpec, type RequestObject, type RouteConventions, type RoutePrefixResolution, type RouterComposition, type RouterIndex, type Scope, type ScopeKind, type SqlCallArgument, type SqlClientHandoff, type SqlClientPattern, type SqlStatementCall, type SqlTableCall, type StoragePattern, type TomlFileRead, type TomlTable, type UnreadManifest, annotationToShape, bindModule, buildRouterIndex, classifyDecorator, containedValues, discoverUnits, emitModuleImportFacts, emitValueFacts, extractPythonProject, factsForFile, findPythonFiles, keptPythonParses, nameKeyIn, nodeId, objectReturnedBy, parsePython, parsePythonAhead, parsePythonSync, preloadPythonGrammar, pythonImportEvidence, pythonSourceRoots, readKey, readTomlFile, resolveAbsoluteModule, resolveCalls, resolveModule, resolveName, resolveRelativeModule, shapeFromName, tableAt };
1602
+ export { ADAPTER_VERSION, type AnnotationContext, type Binding, type BoundPythonFile, type DecoratedClassRoute, type DecoratedFunctionRoute, type DecoratorArg, type DecoratorClassification, type DiscoveryOptions, type ExtractPythonOptions, type ExtractPythonResult, type FileFactsOptions, type KeptPythonParses, type ModuleBinding, type ModuleResolution, type ModuleResolverOptions, type MountObjectCarrier, type MountObjectPrefix, type MountPrefixEffect, type NoValuePrefix, type ParameterSource, type PathRepeatedSlashes, type PrefixTrailingSlash, type PyCallArgument, type PyDefaultTaskName, type PyEnqueueMethod, type PyJobQueue, type PyModelEntryFunction, type PyModelEntryMethod, type PyModelQueries, type PySendByName, type PyStatusCall, type PyTaskArguments, type PyTestCases, type PyTestMocks, type PyTestSetUp, type PythonDiscoveryPattern, type PythonImportEvidence, type PythonImportEvidenceOptions, type PythonImportSite, type PythonPack, type PythonSourceRoots, type PythonValueHandle, PythonWhySession, type PythonWhySessionOptions, type RawSqlPattern, type RelativeModuleSpec, type RequestObject, type RouteConventions, type RoutePrefixResolution, type RouterComposition, type RouterIndex, type Scope, type ScopeKind, type SqlCallArgument, type SqlClientHandoff, type SqlClientPattern, type SqlStatementCall, type SqlTableCall, type StoragePattern, type TomlFileRead, type TomlTable, type UnreadManifest, annotationToShape, bindModule, buildRouterIndex, classifyDecorator, containedValues, discoverUnits, emitModuleImportFacts, emitValueFacts, extractPythonProject, factsForFile, findPythonFiles, keptPythonParses, nameKeyIn, nodeId, objectReturnedBy, parsePython, parsePythonAhead, parsePythonSync, preloadPythonGrammar, pythonImportEvidence, pythonSourceRoots, readKey, readTomlFile, resolveAbsoluteModule, resolveCalls, resolveModule, resolveName, resolveRelativeModule, shapeFromName, tableAt };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { RequestSpellingMetadata, TypeShape, WrapperReference, BehavioralSummary } from '@suss/behavioral-ir';
1
+ import { RequestSpellingMetadata, MessageBusTechnology, TypeShape, WrapperReference, BehavioralSummary } from '@suss/behavioral-ir';
2
2
  import { Tree, Node } from 'web-tree-sitter';
3
3
  export { Node as PyNode, Tree as PyTree } from 'web-tree-sitter';
4
4
  import { Database } from '@suss/datalog';
@@ -145,6 +145,70 @@ interface PythonPack {
145
145
  requestSpelling?: RequestSpellingMetadata;
146
146
  /** How the library's test runner collects tests, so a PRD scenario can say which test covers it. */
147
147
  tests?: PyTestCases[];
148
+ /** How the library runs a project function as a background job, and the calls that enqueue one. DESIGN.md says how each is read. */
149
+ jobQueues?: PyJobQueue[];
150
+ }
151
+ /**
152
+ * A library that runs a project's functions off a queue, such as Celery.
153
+ * A function under one of `taskDecorators` becomes a consumer unit, and a
154
+ * call that enqueues it becomes a `message-send` on the same channel.
155
+ * Every name here is one the library defines.
156
+ */
157
+ interface PyJobQueue {
158
+ /** The bus the bindings say, `celery`. */
159
+ messageBus: MessageBusTechnology;
160
+ /** The module the library's decorators and app class come from, `celery`. */
161
+ module: string;
162
+ /** Decorators that make a function a task: `shared_task`, and `task` on the app. */
163
+ taskDecorators: string[];
164
+ /** The keyword a task decorator takes the task's name under: `name`. */
165
+ nameKeyword: string;
166
+ /** The keyword a task decorator takes its queue under: `queue`. */
167
+ queueKeyword: string;
168
+ /** What the library calls a task whose decorator gives no name. */
169
+ defaultName: PyDefaultTaskName;
170
+ /** Methods on a task that enqueue it, and where each takes the task's arguments. */
171
+ enqueueMethods: PyEnqueueMethod[];
172
+ /** Methods on the app that enqueue a task by its name, `send_task`. */
173
+ sendByName?: PySendByName[];
174
+ /** The app's class, and the objects the module exports that stand for the app: `Celery`, `current_app`. */
175
+ apps: string[];
176
+ }
177
+ /**
178
+ * `modulePath` is Celery's: the dotted path of the module the function
179
+ * is written in, a dot, and the function's name.
180
+ */
181
+ type PyDefaultTaskName = "modulePath";
182
+ /** Where a method takes one of its inputs: a position, a keyword, or both. */
183
+ interface PyCallArgument {
184
+ argument?: number;
185
+ keyword?: string;
186
+ }
187
+ /**
188
+ * How an enqueue call passes the task's arguments. `spread` passes them
189
+ * as the call's own, `delay(a, b, c=1)`. `packed` passes the positional
190
+ * ones as one sequence and the keyword ones as one mapping,
191
+ * `apply_async((a, b), {"c": 1})`.
192
+ */
193
+ type PyTaskArguments = {
194
+ type: "spread";
195
+ } | {
196
+ type: "packed";
197
+ args: PyCallArgument;
198
+ kwargs: PyCallArgument;
199
+ };
200
+ interface PyEnqueueMethod {
201
+ /** The method's name, `delay`. */
202
+ method: string;
203
+ arguments: PyTaskArguments;
204
+ }
205
+ interface PySendByName {
206
+ /** The method's name, `send_task`. */
207
+ method: string;
208
+ /** Where it takes the task's name. */
209
+ name: PyCallArgument;
210
+ /** Where it takes the task's arguments. */
211
+ arguments: PyTaskArguments;
148
212
  }
149
213
  /**
150
214
  * How a test runner finds tests and what it runs around each one. Every
@@ -1535,4 +1599,4 @@ declare function pythonImportEvidence(options: PythonImportEvidenceOptions): Pro
1535
1599
  */
1536
1600
  declare const ADAPTER_VERSION = "0.1.0";
1537
1601
 
1538
- export { ADAPTER_VERSION, type AnnotationContext, type Binding, type BoundPythonFile, type DecoratedClassRoute, type DecoratedFunctionRoute, type DecoratorArg, type DecoratorClassification, type DiscoveryOptions, type ExtractPythonOptions, type ExtractPythonResult, type FileFactsOptions, type KeptPythonParses, type ModuleBinding, type ModuleResolution, type ModuleResolverOptions, type MountObjectCarrier, type MountObjectPrefix, type MountPrefixEffect, type NoValuePrefix, type ParameterSource, type PathRepeatedSlashes, type PrefixTrailingSlash, type PyModelEntryFunction, type PyModelEntryMethod, type PyModelQueries, type PyStatusCall, type PyTestCases, type PyTestMocks, type PyTestSetUp, type PythonDiscoveryPattern, type PythonImportEvidence, type PythonImportEvidenceOptions, type PythonImportSite, type PythonPack, type PythonSourceRoots, type PythonValueHandle, PythonWhySession, type PythonWhySessionOptions, type RawSqlPattern, type RelativeModuleSpec, type RequestObject, type RouteConventions, type RoutePrefixResolution, type RouterComposition, type RouterIndex, type Scope, type ScopeKind, type SqlCallArgument, type SqlClientHandoff, type SqlClientPattern, type SqlStatementCall, type SqlTableCall, type StoragePattern, type TomlFileRead, type TomlTable, type UnreadManifest, annotationToShape, bindModule, buildRouterIndex, classifyDecorator, containedValues, discoverUnits, emitModuleImportFacts, emitValueFacts, extractPythonProject, factsForFile, findPythonFiles, keptPythonParses, nameKeyIn, nodeId, objectReturnedBy, parsePython, parsePythonAhead, parsePythonSync, preloadPythonGrammar, pythonImportEvidence, pythonSourceRoots, readKey, readTomlFile, resolveAbsoluteModule, resolveCalls, resolveModule, resolveName, resolveRelativeModule, shapeFromName, tableAt };
1602
+ export { ADAPTER_VERSION, type AnnotationContext, type Binding, type BoundPythonFile, type DecoratedClassRoute, type DecoratedFunctionRoute, type DecoratorArg, type DecoratorClassification, type DiscoveryOptions, type ExtractPythonOptions, type ExtractPythonResult, type FileFactsOptions, type KeptPythonParses, type ModuleBinding, type ModuleResolution, type ModuleResolverOptions, type MountObjectCarrier, type MountObjectPrefix, type MountPrefixEffect, type NoValuePrefix, type ParameterSource, type PathRepeatedSlashes, type PrefixTrailingSlash, type PyCallArgument, type PyDefaultTaskName, type PyEnqueueMethod, type PyJobQueue, type PyModelEntryFunction, type PyModelEntryMethod, type PyModelQueries, type PySendByName, type PyStatusCall, type PyTaskArguments, type PyTestCases, type PyTestMocks, type PyTestSetUp, type PythonDiscoveryPattern, type PythonImportEvidence, type PythonImportEvidenceOptions, type PythonImportSite, type PythonPack, type PythonSourceRoots, type PythonValueHandle, PythonWhySession, type PythonWhySessionOptions, type RawSqlPattern, type RelativeModuleSpec, type RequestObject, type RouteConventions, type RoutePrefixResolution, type RouterComposition, type RouterIndex, type Scope, type ScopeKind, type SqlCallArgument, type SqlClientHandoff, type SqlClientPattern, type SqlStatementCall, type SqlTableCall, type StoragePattern, type TomlFileRead, type TomlTable, type UnreadManifest, annotationToShape, bindModule, buildRouterIndex, classifyDecorator, containedValues, discoverUnits, emitModuleImportFacts, emitValueFacts, extractPythonProject, factsForFile, findPythonFiles, keptPythonParses, nameKeyIn, nodeId, objectReturnedBy, parsePython, parsePythonAhead, parsePythonSync, preloadPythonGrammar, pythonImportEvidence, pythonSourceRoots, readKey, readTomlFile, resolveAbsoluteModule, resolveCalls, resolveModule, resolveName, resolveRelativeModule, shapeFromName, tableAt };