Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

BOFH excuse #273: The cord jumped over and hit the power switch.


comp / comp.lang.python / 411 on Editable Installs

SubjectAuthor
o 411 on Editable InstallsStefan Ram

1
Subject: 411 on Editable Installs
From: Stefan Ram
Newsgroups: comp.lang.python
Organization: Stefan Ram
Date: Mon, 26 Aug 2024 10:50 UTC
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.python
Subject: 411 on Editable Installs
Date: 26 Aug 2024 10:50:03 GMT
Organization: Stefan Ram
Lines: 31
Expires: 1 Jul 2025 11:59:58 GMT
Message-ID: <editable-20240826114758@ram.dialup.fu-berlin.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de I0gAjmhTI6+sf1Zr4vedRw4A3BAR3Vx29h03WtVgIzBdVR
Cancel-Lock: sha1:jowvvYclExIEVRcqthPq3UKrAS0= sha256:ynlMC71OqjzrnanHqGbvxUZgHlhA9ae6R9NO6WjAwaU=
X-Copyright: (C) Copyright 2024 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
View all headers

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 . . .

1

rocksolid light 0.9.8
clearnet tor