Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Submodule protobuf #41

Merged
merged 26 commits into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/update-interfaces.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Update protobuf stubs

on:
push:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably only want this running on main (once it is known to work), and possibly with a path filter to just when api-interfaces is changed.

workflow_dispatch:

jobs:
update_proto:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Copy files
run: |
SRC=./api-interfaces/gooseai
TGT=./src/stability_sdk/interfaces/gooseai
KIND=generation
cp $SRC/$KIND/${KIND}_pb2_grpc.py $TGT/$KIND/${KIND}_pb2_grpc.py
cp $SRC/$KIND/${KIND}_pb2.py $TGT/$KIND/${KIND}_pb2.py
#############################
# for backwards compatibility
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how I feel about copying these files out of the submodule. I know people already rely on this directory structure, but I wonder if it would be better for us to have a clean, versioned break. Open to arguments either way, though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm inclined to agree. Since people can now pull these generated files out of the api-interfaces, I think it makes sense to only have this project be concerned about the generated files meant for python consumption.

Like Chia said, we'll want to cut a major version so we don't break existing consumers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's been less than a month since the beta release so the timing for a major version is good too. especially considering the third party ts client is currently broken because of this dependency already. maybe we do this PR leaving the backwards compatibility stuff in it as a temporary fix to get people who are using the third party ts client back on their feet, and then follow that up with a new major version. this would give a little bit of breathing room to users depending on the current structure to upgrade without requiring that their stuff be broken and unavilable while they're in transition

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alternatively, choosing not to support backwards compatibility is a good forcing function for upgrading

#############################
cp ./api-interfaces/src/proto/generation.proto ./src/proto/generation.proto
cp $SRC/$KIND/${KIND}_pb_service.d.ts ./src/js/${KIND}_pb_service.d.ts
cp $SRC/$KIND/${KIND}_pb_service.js ./src/js/${KIND}_pb_service.js
cp $SRC/$KIND/${KIND}_pb.d.ts ./src/js/${KIND}_pb.d.ts
cp $SRC/$KIND/${KIND}_pb.js ./src/js/${KIND}_pb.js
#- name: Commit files
# run: |
# shopt -s globstar
# git config --local user.name ${{ github.actor }}
# git add ./src/**/*.py
# git add ./src/**/*.js
# git add ./src/**/*.ts
# git add ./src/**/*.proto
# git commit -m "Updated protobuf files"
#- name: Push change
# uses: ad-m/github-push-action@master
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# branch: ${{ github.ref }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
add-paths: |
api-interfaces/
src/
base: main
delete-branch: true
branch: "actions/update-interfaces"
commit-message: "chore: update protobuf stubs"
title: "chore: update protobuf stubs"
body: "Update protobuf stubs from changes in ${{ github.sha }}"
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "api-interfaces"]
path = api-interfaces
url = https://github.com/stability-ai/api-interfaces
1 change: 1 addition & 0 deletions api-interfaces
Submodule api-interfaces added at c54bce
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name='stability-sdk',
version='0.2.2',
version='0.2.3',
author='Wes Brown',
author_email='wesbrown18@gmail.com',
maintainer='David Marx',
Expand Down
187 changes: 181 additions & 6 deletions src/js/generation_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,34 @@ export namespace ConditionerParameters {
}
}

export class ScheduleParameters extends jspb.Message {
hasStart(): boolean;
clearStart(): void;
getStart(): number;
setStart(value: number): void;

hasEnd(): boolean;
clearEnd(): void;
getEnd(): number;
setEnd(value: number): void;

serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): ScheduleParameters.AsObject;
static toObject(includeInstance: boolean, msg: ScheduleParameters): ScheduleParameters.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: ScheduleParameters, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): ScheduleParameters;
static deserializeBinaryFromReader(message: ScheduleParameters, reader: jspb.BinaryReader): ScheduleParameters;
}

export namespace ScheduleParameters {
export type AsObject = {
start: number,
end: number,
}
}

export class StepParameter extends jspb.Message {
getScaledStep(): number;
setScaledStep(value: number): void;
Expand All @@ -375,6 +403,11 @@ export class StepParameter extends jspb.Message {
getSampler(): SamplerParameters | undefined;
setSampler(value?: SamplerParameters): void;

hasSchedule(): boolean;
clearSchedule(): void;
getSchedule(): ScheduleParameters | undefined;
setSchedule(value?: ScheduleParameters): void;

serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): StepParameter.AsObject;
static toObject(includeInstance: boolean, msg: StepParameter): StepParameter.AsObject;
Expand All @@ -389,6 +422,7 @@ export namespace StepParameter {
export type AsObject = {
scaledStep: number,
sampler?: SamplerParameters.AsObject,
schedule?: ScheduleParameters.AsObject,
}
}

Expand Down Expand Up @@ -589,6 +623,30 @@ export namespace ClassifierParameters {
}
}

export class AssetParameters extends jspb.Message {
getAction(): AssetActionMap[keyof AssetActionMap];
setAction(value: AssetActionMap[keyof AssetActionMap]): void;

getProject(): string;
setProject(value: string): void;

serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): AssetParameters.AsObject;
static toObject(includeInstance: boolean, msg: AssetParameters): AssetParameters.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: AssetParameters, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): AssetParameters;
static deserializeBinaryFromReader(message: AssetParameters, reader: jspb.BinaryReader): AssetParameters;
}

export namespace AssetParameters {
export type AsObject = {
action: AssetActionMap[keyof AssetActionMap],
project: string,
}
}

export class Request extends jspb.Message {
getEngineId(): string;
setEngineId(value: string): void;
Expand All @@ -609,16 +667,21 @@ export class Request extends jspb.Message {
getImage(): ImageParameters | undefined;
setImage(value?: ImageParameters): void;

hasConditioner(): boolean;
clearConditioner(): void;
getConditioner(): ConditionerParameters | undefined;
setConditioner(value?: ConditionerParameters): void;

hasClassifier(): boolean;
clearClassifier(): void;
getClassifier(): ClassifierParameters | undefined;
setClassifier(value?: ClassifierParameters): void;

hasAsset(): boolean;
clearAsset(): void;
getAsset(): AssetParameters | undefined;
setAsset(value?: AssetParameters): void;

hasConditioner(): boolean;
clearConditioner(): void;
getConditioner(): ConditionerParameters | undefined;
setConditioner(value?: ConditionerParameters): void;

getParamsCase(): Request.ParamsCase;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Request.AsObject;
Expand All @@ -637,13 +700,108 @@ export namespace Request {
requestedType: ArtifactTypeMap[keyof ArtifactTypeMap],
promptList: Array<Prompt.AsObject>,
image?: ImageParameters.AsObject,
conditioner?: ConditionerParameters.AsObject,
classifier?: ClassifierParameters.AsObject,
asset?: AssetParameters.AsObject,
conditioner?: ConditionerParameters.AsObject,
}

export enum ParamsCase {
PARAMS_NOT_SET = 0,
IMAGE = 5,
CLASSIFIER = 7,
ASSET = 8,
}
}

export class OnStatus extends jspb.Message {
clearReasonList(): void;
getReasonList(): Array<FinishReasonMap[keyof FinishReasonMap]>;
setReasonList(value: Array<FinishReasonMap[keyof FinishReasonMap]>): void;
addReason(value: FinishReasonMap[keyof FinishReasonMap], index?: number): FinishReasonMap[keyof FinishReasonMap];

hasTarget(): boolean;
clearTarget(): void;
getTarget(): string;
setTarget(value: string): void;

clearActionList(): void;
getActionList(): Array<StageActionMap[keyof StageActionMap]>;
setActionList(value: Array<StageActionMap[keyof StageActionMap]>): void;
addAction(value: StageActionMap[keyof StageActionMap], index?: number): StageActionMap[keyof StageActionMap];

serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): OnStatus.AsObject;
static toObject(includeInstance: boolean, msg: OnStatus): OnStatus.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: OnStatus, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): OnStatus;
static deserializeBinaryFromReader(message: OnStatus, reader: jspb.BinaryReader): OnStatus;
}

export namespace OnStatus {
export type AsObject = {
reasonList: Array<FinishReasonMap[keyof FinishReasonMap]>,
target: string,
actionList: Array<StageActionMap[keyof StageActionMap]>,
}
}

export class Stage extends jspb.Message {
getId(): string;
setId(value: string): void;

hasRequest(): boolean;
clearRequest(): void;
getRequest(): Request | undefined;
setRequest(value?: Request): void;

clearOnStatusList(): void;
getOnStatusList(): Array<OnStatus>;
setOnStatusList(value: Array<OnStatus>): void;
addOnStatus(value?: OnStatus, index?: number): OnStatus;

serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Stage.AsObject;
static toObject(includeInstance: boolean, msg: Stage): Stage.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: Stage, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): Stage;
static deserializeBinaryFromReader(message: Stage, reader: jspb.BinaryReader): Stage;
}

export namespace Stage {
export type AsObject = {
id: string,
request?: Request.AsObject,
onStatusList: Array<OnStatus.AsObject>,
}
}

export class ChainRequest extends jspb.Message {
getRequestId(): string;
setRequestId(value: string): void;

clearStageList(): void;
getStageList(): Array<Stage>;
setStageList(value: Array<Stage>): void;
addStage(value?: Stage, index?: number): Stage;

serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): ChainRequest.AsObject;
static toObject(includeInstance: boolean, msg: ChainRequest): ChainRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: ChainRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): ChainRequest;
static deserializeBinaryFromReader(message: ChainRequest, reader: jspb.BinaryReader): ChainRequest;
}

export namespace ChainRequest {
export type AsObject = {
requestId: string,
stageList: Array<Stage.AsObject>,
}
}

Expand All @@ -665,6 +823,7 @@ export interface ArtifactTypeMap {
ARTIFACT_TOKENS: 4;
ARTIFACT_EMBEDDING: 5;
ARTIFACT_CLASSIFICATIONS: 6;
ARTIFACT_MASK: 7;
}

export const ArtifactType: ArtifactTypeMap;
Expand Down Expand Up @@ -708,3 +867,19 @@ export interface ClassifierModeMap {

export const ClassifierMode: ClassifierModeMap;

export interface AssetActionMap {
ASSET_PUT: 0;
ASSET_GET: 1;
ASSET_DELETE: 2;
}

export const AssetAction: AssetActionMap;

export interface StageActionMap {
STAGE_ACTION_PASS: 0;
STAGE_ACTION_DISCARD: 1;
STAGE_ACTION_RETURN: 2;
}

export const StageAction: StageActionMap;

Loading