411 on Editable Installs

Liste des GroupesRevenir à cl python 
Sujet : 411 on Editable Installs
De : ram (at) *nospam* zedat.fu-berlin.de (Stefan Ram)
Groupes : comp.lang.python
Date : 26. Aug 2024, 12:50:03
Autres entêtes
Organisation : Stefan Ram
Message-ID : <editable-20240826114758@ram.dialup.fu-berlin.de>
  So, you're cruising along in your Python journey, and bam!
  You hit that wall where you wanna import your homemade module
  "mymodule" into different projects scattered across your
  hard drive like so many In-N-Out wrappers.

  Most Python books ghost this topic harder than your Tinder
  matches. If you pester enough people, they'll tell you to
  whip up an "editable install" with

pip install -e <path to your modules>

  . But hold up, you got to craft a "setup.py" or "pyproject.toml"
  first. Then you run into this whole "setuptools" rigmarole.
  You're supposed to install those bad boys ("Batteries included"),
  but even when you do and "import setuptools" runs smoother than
  the 405 at 3 AM, pip still throws a fit about missing setuptools!

  This ain't my cup of kombucha, folks. It's giving me Java flashbacks.
  After some trial and error that'd make a Silicon Valley startup
  blush, I stumbled on this hack that works with the latest CPython:

  Mosey on over to the "Lib/site-packages" directory in your
  Python install. Create a file ending in ".pth" - let's call it
  "mymodule.pth". Drop a single line in there with the file system
  path to the directory housing your modules. Boom, you're golden.

  It's so stupid simple, I bet the Python overlords have already
  slapped a "deprecated" sticker on it and are plotting its
  demise as we speak . . .



Date Sujet#  Auteur
26 Aug 24 o 411 on Editable Installs1Stefan Ram

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal