Azure / Azure/typespec-azure

Can python not rely on install hooks

Open
#5,050 0 comments 0 reactions 0 assignees View on GitHub
design:needed emitter:python eng
Dominant language
TypeScript
Stars
27
Forks
90
Avg merge
1d 22h
Merged PRs (30d)
156

Description

Right now there is this install hook

```json
"install": "tsx ./eng/scripts/setup/run-python3.ts ./eng/scripts/setup/install.py",
```

while it works with is blocked by default by all package manager to have any install hooks, they need to be authorized.

I think there is 2 parts to this
1. Is installing the python dependencies during `pnpm install` the right choice(java does it during build for example). Not sure what is the best right now both have pros and cons
2. For users of the python emitter they need to approve with `pnpm approve-builds`/`npm approve-scripts` which is not super clean, often only native dependencies need that and the build is optional only needed for the not common platforms where it might need to compile the sources. Is it possible to bundle the python emitter into a self contained library without any pip deps for users? We have to balance here also the size of the package we shouldn't push to npm the whole python ecosystem

# Dev experience
Requirement `pnpm install && pnpm build` should be able to build everything with no extra steps

Here we have 2 options
1. Keep install to install all deps, kind of make sense, pip/pnpm seems smart enough to not be slow on later rerun
2. Keep `pnpm install` only for npm deps and we have a `pnpm install:native` that will install all natives deps combined with a hook in teh `build` steps that makes sure they are installed so we can still just run `pnpm install && pnpm build`

Contributor guide

Open the contributing guide

Research direction

Start with the install hook invoking eng/scripts/setup/run-python3.ts and eng/scripts/setup/install.py, then compare the current pnpm install and pnpm build flows. Determine whether the requested pnpm install && pnpm build requirement can work without manual approval or extra steps, while accounting for Python dependencies, native builds, and package size.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, typescript
Domain
build-system, developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.