You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: rethink of states, result types, adds batch_ids, gen/job thread safety
refactor: dynamic params via `additional_params` for image gen
This allows extendibility, allowing parameter types or categories either unknown the SDK or as implemented by third parties.
style: catch up
fix/style: missing import, lingering style issues
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
fix: remove `type` syntax for now
I am unclear how to guard it from raising an exception right now and its not terribly important as it just helps my IDE color it a certain way
fix: use compat version of horde_model_reference
fix: using `typing_extensions` for `override`
This namespace migration is only effective as of python 3.12 and later, and the old namespace appears to still be valid in 3.12 and 3.13 at this time.
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@
51
51
- See all rules (but not necessarily used in the project) availible in rust [here](https://beta.ruff.rs/docs/rules/).
52
52
- Run with `ruff check .`
53
53
- Note: When using autofixing (`ruff check . --fix`), changes may be made that require running black, which can then result in needing to run `ruff check . --fix` again.
- I recommending using the [mypy daemon](https://mypy.readthedocs.io/en/stable/mypy_daemon.html) instead of periodically running `pre-commit` (or `mypy` directly.).
@@ -65,7 +65,7 @@
65
65
-`"python.analysis.languageServerMode": "full"`
66
66
-`"python.testing.pytestEnabled": true`
67
67
-[**tach**](https://github.com/gauge-sh/tach)
68
-
- Enforces internal namespace dependency constraints. This helps avoid circular dependencies and helps ensure implementations are in a logical place.
68
+
- Enforces internal namespace dependency constraints. This helps avoid circular dependencies and helps ensure implementations are in a logical place.
69
69
70
70
## Code Style and System Design
71
71
@@ -120,7 +120,7 @@ The Horde ecosystem is a collaborative effort made possible through volunteer ef
120
120
- Update documentation for new features or changes to existing functionality
121
121
- Use descriptive commit messages consistent with the project commit history, especially for medium-to-large changesets.
122
122
- While it is possible we will squash commits before merging, it is still helpful to have descriptive commit messages for review and opens the possibility of rebasing instead.
123
-
123
+
124
124
#### Don't
125
125
126
126
- Make large sweeping changes unrelated to your primary goal
Copy file name to clipboardExpand all lines: docs/concepts/style_guide.md
+17-17Lines changed: 17 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -71,7 +71,7 @@ Many classes contain standardized prefixes, suffixes, or identifiers within thei
71
71
-**Base** (Always a Prefix): Indicates a foundational class that provides core functionality and may be abstract or partially implemented. It is intended to be extended by more specific classes.
-**Manual**: Refers to classes that do not have context management or automatic session handling. These classes require the user to clean up server resources manually.
@@ -134,7 +134,7 @@ Many docstrings in the SDK have additional requirements when they are related to
134
134
```
135
135
136
136
- Children classes of `HordeResponse` must have additional information, for example:
137
-
137
+
138
138
```python
139
139
class HordePerformanceResponse(HordeResponseBaseModel):
140
140
"""Information about the performance of the horde, such as worker counts and queue sizes.
@@ -146,7 +146,7 @@ Many docstrings in the SDK have additional requirements when they are related to
146
146
```
147
147
148
148
- Children classes of `HordeRequest` must have additional information, for example:
149
-
149
+
150
150
```python
151
151
class HordePerformanceRequest(BaseAIHordeRequest):
152
152
"""Request performance information about the horde, such as worker counts and queue sizes.
@@ -160,14 +160,14 @@ Many docstrings in the SDK have additional requirements when they are related to
160
160
- Class and method signatures should prefer keyword-only arguments especially when there are multiple arguments of the same type
161
161
- This improves readability and reduces the chance of passing arguments in the wrong order. Additionally, it improves the ability to add new arguments in the future without breaking existing code.
@@ -189,23 +189,23 @@ Many docstrings in the SDK have additional requirements when they are related to
189
189
- This is technically enforced by type hints, but it is still important to consider the implications of returning different types, especially as a consumer.
190
190
- Generally, for methods which mutate orreturn a different type based on input, it should be clear from the method name and documentation that this is the case and which types can be expected based on different inputs.
191
191
- For example, the following method signature should be considered bad practice:
- Methods which *can*return a listor a container should *always*return a listor container, even if it is a single item.
199
199
- For example, the following method signature should be considered bad practice:
200
-
200
+
201
201
```python
202
202
def get_items(self) -> list[Item] | Item:
203
203
...
204
204
```
205
205
206
206
- Methods should avoid returning different container types *unless that is the purpose of the method*.
207
207
- For example, the following method signatures should be considered bad practice:
208
-
208
+
209
209
```python
210
210
def get_items(self) -> list[Item] | set[Item]:
211
211
...
@@ -221,7 +221,7 @@ Many docstrings in the SDK have additional requirements when they are related to
221
221
222
222
- Prefer guard clauses over deeply nested if statements.
223
223
- For example, instead of:
224
-
224
+
225
225
```python
226
226
def process_item(item: Item):
227
227
if item isnotNone:
@@ -231,7 +231,7 @@ Many docstrings in the SDK have additional requirements when they are related to
231
231
```
232
232
233
233
Prefer:
234
-
234
+
235
235
```python
236
236
def process_item(item: Item):
237
237
if item isNoneornot item.is_valid():
@@ -242,18 +242,18 @@ Many docstrings in the SDK have additional requirements when they are related to
242
242
243
243
- Prefer meaningfully named composite `bool` conditionals over complex multi-line `if` statements.
244
244
- For example, instead of:
245
-
245
+
246
246
```python
247
247
def is_valid_item(item: Item) ->bool:
248
-
if (item.has_name() and item.has_value()) or
248
+
if (item.has_name() and item.has_value()) or
249
249
(item.has_description() and item.description_valid()):
250
250
if item.is_active():
251
251
returnTrue
252
252
returnFalse
253
253
```
254
254
255
255
Prefer:
256
-
256
+
257
257
```python
258
258
def is_valid_item(item: Item) ->bool:
259
259
has_name_and_value= item.has_name() and item.has_value()
@@ -299,15 +299,15 @@ Many docstrings in the SDK have additional requirements when they are related to
299
299
-`Enum`s should be used to represent numbers with a specific set of valid values and regular constants can be used for isolated (unconnected) values.
300
300
- If many constants relate to each other, they should be grouped into a class.
301
301
- For example, instead of:
302
-
302
+
303
303
```python
304
304
MAX_RETRIES=5
305
305
TIMEOUT=30
306
306
...
307
307
```
308
308
309
309
Prefer:
310
-
310
+
311
311
```python
312
312
class APIConfig:
313
313
MAX_RETRIES=5
@@ -317,7 +317,7 @@ Many docstrings in the SDK have additional requirements when they are related to
317
317
318
318
### "KNOWN" Constants
319
319
320
-
- For consumer convenience, parameters which have a fixed set of known values should be defined as constants in an appropriate `consts.py`file. These constants should be named with the `KNOWN_` prefix and should be defined as`StrEnum`s or`Enum`s as appropriate.
320
+
- For consumer convenience, parameters which have a fixed set of known values should be defined as constants in an appropriate `consts.py`file. These constants should be named with the `KNOWN_` prefix and should be defined as`StrEnum`s or`Enum`s as appropriate.
321
321
- However, these values should **always be considered optional**. Consumers of the SDK should be able to use any valid value for the parameter aslongas its typeis correct. It would be ideal, but not required, that classes or functions which require these parameters validate them against the live API at runtime.
322
322
-**_Rationale_**: This prevents the SDKfrom needing to be updated every time a new value is added to an API, and allows consumers to use any valid value without needing to wait for an SDK update.
0 commit comments