Vector35 / Vector35/binaryninja-api

Allow specifying pip `index-url` via settings when installing Python dependencies

Offen
#8,478 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
C++
Sterne
1.3k
Forks
298
Ø Merge
5 T. 5 Std.
Gemergte PRs (30 T.)
19

Beschreibung

What is the feature you'd like to have?

Today, you're unable to specify an --index-url for pip to use when installing Python dependencies for plugins, which means internal mirrors, etc. are unavailable. In environments where direct access to the pypi.org index isn't available, this means that Binary Ninja fails to install Python dependencies of packages.

Rather than disabling --isolated, it'd be nice to be able to specify a global setting (e.g. python.pip.indexUrl) which adds the desired index to the generated pip command line.

Thanks!

Is your feature request related to a problem?
When installing Binary Ninja plugins today, PythonScriptingProvider._install_modules builds a pip command line to install the module in isolated mode:

https://github.com/Vector35/binaryninja-api/blob/c54968e2851d8039079d563c00dafa8d76eefead/python/scriptingprovider.py#L1396-L1401

This means that ~/.pip/pip.conf, etc. configuration settings from the environment are not used by pip - as described above, this means you can't set --index-url in environments where you can't directly hit PyPi

You can kinda hack around this by running something like this to manually install a package into BN's site-packages directory yourself:

uv run python3 -m pip --isolated \
    --disable-pip-version-check install --upgrade --upgrade-strategy only-if-needed \
    --target "$HOME/Library/Application Support/Binary Ninja/python313/site-packages" \
    --index-url "<my_index_url>" \
    <package>

Are any alternative solutions acceptable?
A setting like python.pip.indexUrl (used in the same way as network.httpsProxy) is probably the cleanest solution!

Alternatively a pip.conf file could be specified, but this seems like it could get a bit messy if settings other than index-url are configured 🤔

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Start in python/scriptingprovider.py at PythonScriptingProvider._install_modules, especially lines 1396-1401, where the isolated pip command is built. Review how the network.httpsProxy setting is handled and how settings are defined, then make the configured python.pip.indexUrl affect dependency installation. Done means plugin dependencies can use the configured index URL without disabling isolated mode.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
tooling
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Aktiv
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
74/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.