replicate / replicate/cog

Disallow setting `default` for files/paths

Open
#606 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

next python type/bug
Dominant language
Go
Stars
9.5k
Forks
696
Avg merge
7d 19h
Merged PRs (30d)
2

Description

For example, this ain't gonna work:

def predict(self, file: Path = Input(default=Path("image.png")):

The thing consuming the schema (e.g. Replicate) can't get that default. We should just not allow this until we've figured out a better solution here.

As an aside: just setting the default to string is allowed but shouldn't be. Maybe we should validate default values to check they're actually the correct type.

Reported by @yael-vinker (thank you!)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the validation for Input defaults and the schema generation path for files and paths. Reproduce the default=Path example, then check how a string default is handled. Done means invalid defaults are rejected before producing a schema, with validation covering the affected input types.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.