Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] [RFC] python3: mark as EXTERNALLY-MANAGED
@ 2023-05-03 21:47 classabbyamp
  2023-10-06 16:25 ` ahesford
  2023-10-06 16:25 ` [PR PATCH] [Closed]: " ahesford
  0 siblings, 2 replies; 3+ messages in thread
From: classabbyamp @ 2023-05-03 21:47 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1991 bytes --]

There is a new pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages python3-ext-mgr
https://github.com/void-linux/void-packages/pull/43735

[RFC] python3: mark as EXTERNALLY-MANAGED
this prevents users from breaking xbps-installed python3 packages by using pip outside of a virtual environment. Error message adapted from gentoo's, debian's, and the example from PEP 668

see https://peps.python.org/pep-0668/ for more details

closes #43703

```
$ pip install --user foo
error: externally-managed-environment

× This environment is externally managed
╰─> 
    The system-wide Python installation in Void should be maintained
    using the system package manager, xbps.
    
    If the package in question is not packaged for Void, please
    consider installing it inside a virtual environment, e.g.:
    
    python3 -m venv /path/to/venv
    . /path/to/venv/bin/activate
    pip install mypackage
    
    To exit the virtual environment, run:
    
    deactivate
    
    The virtual environment is not deleted, and can be re-entered by
    re-sourcing the activate file.
    
    To automatically manage virtual environments, pipx (from python3-pipx)
    can be used.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
```

<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

#### TODOs

- [ ] write a news post notifying users of this change
- [ ] (potentially) update [void-linux/void-docker](https://github.com/void-linux/void-docker) containers to not break due to this change

cc: @ahesford


A patch file from https://github.com/void-linux/void-packages/pull/43735.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-python3-ext-mgr-43735.patch --]
[-- Type: text/x-diff, Size: 2293 bytes --]

From d6cbc9cc388c44b58d69db6e731dda30d66f80a5 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Wed, 3 May 2023 17:41:28 -0400
Subject: [PATCH] python3: mark as EXTERNALLY-MANAGED

this prevents users from breaking xbps-installed python3 packages by
using pip outside of a virtual environment. Error message adapted from
gentoo's, debian's, and the example from PEP 668

see https://peps.python.org/pep-0668/ for more details

closes #43703
---
 srcpkgs/python3/files/EXTERNALLY-MANAGED | 21 +++++++++++++++++++++
 srcpkgs/python3/template                 |  5 ++++-
 2 files changed, 25 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/python3/files/EXTERNALLY-MANAGED

diff --git a/srcpkgs/python3/files/EXTERNALLY-MANAGED b/srcpkgs/python3/files/EXTERNALLY-MANAGED
new file mode 100644
index 000000000000..507c9e917628
--- /dev/null
+++ b/srcpkgs/python3/files/EXTERNALLY-MANAGED
@@ -0,0 +1,21 @@
+[externally-managed]
+Error=
+ The system-wide Python installation in Void should be maintained
+ using the system package manager, xbps.
+
+ If the package in question is not packaged for Void, please
+ consider installing it inside a virtual environment, e.g.:
+
+   python3 -m venv /path/to/venv
+   . /path/to/venv/bin/activate
+   pip install mypackage
+
+ To exit the virtual environment, run:
+
+   deactivate
+
+ The virtual environment is not deleted, and can be re-entered by
+ re-sourcing the activate file.
+
+ To automatically manage virtual environments, pipx (from python3-pipx)
+ can be used.
diff --git a/srcpkgs/python3/template b/srcpkgs/python3/template
index aebf41852764..45852a17bcc6 100644
--- a/srcpkgs/python3/template
+++ b/srcpkgs/python3/template
@@ -4,7 +4,7 @@
 #
 pkgname=python3
 version=3.11.3
-revision=1
+revision=2
 build_style="gnu-configure"
 configure_args="--enable-shared --enable-ipv6
  --enable-loadable-sqlite-extensions --with-computed-gotos
@@ -135,6 +135,9 @@ do_install() {
 		${DESTDIR}/usr/bin/python${version%.*}-config \
 		${DESTDIR}/usr/lib/python${version%.*}/_sysconfigdata_*_*.py \
 		${DESTDIR}/usr/lib/python${version%.*}/config-${version%.*}*/Makefile
+
+	# https://peps.python.org/pep-0668/
+	vinstall ${FILESDIR}/EXTERNALLY-MANAGED 644 usr/lib/python${version%.*}
 }
 
 python3-devel_package() {

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: python3: mark as EXTERNALLY-MANAGED
  2023-05-03 21:47 [PR PATCH] [RFC] python3: mark as EXTERNALLY-MANAGED classabbyamp
@ 2023-10-06 16:25 ` ahesford
  2023-10-06 16:25 ` [PR PATCH] [Closed]: " ahesford
  1 sibling, 0 replies; 3+ messages in thread
From: ahesford @ 2023-10-06 16:25 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 168 bytes --]

New comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/43735#issuecomment-1751050957

Comment:
Adopted with Python 3.12.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PR PATCH] [Closed]: python3: mark as EXTERNALLY-MANAGED
  2023-05-03 21:47 [PR PATCH] [RFC] python3: mark as EXTERNALLY-MANAGED classabbyamp
  2023-10-06 16:25 ` ahesford
@ 2023-10-06 16:25 ` ahesford
  1 sibling, 0 replies; 3+ messages in thread
From: ahesford @ 2023-10-06 16:25 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1871 bytes --]

There's a closed pull request on the void-packages repository

python3: mark as EXTERNALLY-MANAGED
https://github.com/void-linux/void-packages/pull/43735

Description:
this prevents users from breaking xbps-installed python3 packages by using pip outside of a virtual environment. Error message adapted from gentoo's, debian's, and the example from PEP 668

see https://peps.python.org/pep-0668/ for more details

closes #43703

```
$ pip install --user foo
error: externally-managed-environment

× This environment is externally managed
╰─> 
    The system-wide Python installation in Void should be maintained
    using the system package manager, xbps.
    
    If the package in question is not packaged for Void, please
    consider installing it inside a virtual environment, e.g.:
    
    python3 -m venv /path/to/venv
    . /path/to/venv/bin/activate
    pip install mypackage
    
    To exit the virtual environment, run:
    
    deactivate
    
    The virtual environment is not deleted, and can be re-entered by
    re-sourcing the activate file.
    
    To automatically manage virtual environments, pipx (from python3-pipx)
    can be used.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
```

<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

#### TODOs

- [ ] write a news post notifying users of this change
- [x] (potentially) update [void-linux/void-containers](https://github.com/void-linux/void-containers) containers to not break due to this change

cc: @ahesford


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-10-06 16:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-03 21:47 [PR PATCH] [RFC] python3: mark as EXTERNALLY-MANAGED classabbyamp
2023-10-06 16:25 ` ahesford
2023-10-06 16:25 ` [PR PATCH] [Closed]: " ahesford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).