messense / messense/typst-py

`typst.compile` type hint issue

Open Beginner friendly
#173 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
353
Forks
30
Avg merge
19m
Merged PRs (30d)
1

Description

Thank you for creating this awesome package!

I was having some issues with type hints on `typst.compile`:

```
def compile(
input: Input,
output: Optional[Input] = None,
root: Optional[Input] = None,
font_paths: Union[Fonts, List[Input]] = [],
ignore_system_fonts: bool = False,
format: Optional[OutputFormat] = None,
ppi: Optional[float] = None,
sys_inputs: Dict[str, str] = {},
pdf_standards: PDFStandards = [],
package_path: Optional[PathLike] = None,
timestamp: Optional[CreationTimestamp] = None,
pretty: bool = False,
package_cache_path: Optional[PathLike] = None,
) -> Optional[Union[bytes, List[bytes]]]:
```

1. Perhaps `root` shall be `Optional[PathLike]` rather than `Optional[Input]`?
2. `Input` defined with `TypeVar`, which blocks us to use a `bytes` input with a `str` output. (I'm not sure if this was intentional.)

Contributor guide

No contributing guide indexed for this repository

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 from the type annotations for `typst.compile` and inspect how `root`, `Input`, and the input/output relationship are defined. Verify the intended accepted combinations with a type checker, then update the annotations so the documented path and byte/string combinations are represented accurately.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.