Discussion:
Using pipx for packages as opposed to applications
Add Reply
Chris Green
2025-01-11 21:54:32 UTC
Reply
Permalink
Can one use pipx to wrap the process of creating an independent
environment for a python package as opposed to a runnable application?

E.g. I want to install and use pksheet but, as it's not available from
the Debian repositories, I'll have to install it from PyPi. So I
should put it in its own environment. Can pipx help me with this?
--
Chris Green
·
Stefan Ram
2025-01-12 09:54:35 UTC
Reply
Permalink
Post by Chris Green
Can one use pipx to wrap the process of creating an independent
environment for a python package as opposed to a runnable application?
.---------------------------------------------------------------.
| Heads up, I haven't put this advice through its paces myself, |
| so take it with a grain of salt! |
'---------------------------------------------------------------'

Yo, pipx is really more for setting up and running Python CLI
apps in their own little bubbles, not so much for creating
separate playgrounds for regular Python packages. But hey,
you can still use pipx to kind of sorta get what you want with
pksheet, even if it's not your typical command-line deal.

Here's the lowdown on using pipx for pksheet:

1. Drop pksheet in with pipx:

bash

pipx install pksheet

This bad boy will whip up a special spot just for pksheet and
plop it in there.

2. To rock pksheet in your Python scripts, you can run it through
pipx like this:

bash

pipx run pksheet your_script.py

This move will fire up your script using the pksheet setup in
its own little world.

Now, while this trick works, it's not exactly smooth sailing for
everyday package use. For non-CLI packages like pksheet, you're
better off sticking to the old-school virtual environment tools:

1. Whip up a virtual environment:

bash

python3 -m venv pksheet_env

2. Jump into that environment:

bash

source pksheet_env/bin/activate

3. Grab pksheet:

bash

pip install pksheet

4. Now you're golden to use pksheet in your Python scripts within
this environment.

To wrap it up, pipx can technically handle pksheet, but it's really
more at home with CLI apps. For your run-of-the-mill Python packages,
cooking up a dedicated virtual environment is the way to go.
Left Right
2025-01-12 10:02:00 UTC
Reply
Permalink
What would be the intended use? If this is for other Debian users,
then why not make a Debian package? If it's for yourself, why do you
need to automate it?

To be fair, I don't see a point in tools like pipx. Have never used
it, and cannot imagine a scenario where I'd want to. It seems like
there's always a better way to do what this tool alleges to be able to
do...

Also, you say that you want it in its own environment: then what
difference does it make if it's on Debian or anywhere else? If you
are distributing a library, it makes sense to incorporate it into the
user's infrastructure. Either you do the integration, or let users
decide how to best integrate it. If you provide them with the
environment that they *must* use, that's going to be the worst of both
worlds: users won't be able to use the library in the environment
created by them, nor will this library integrate with the other
libraries provided by the system. So, it's hard to imagine why your
users would want that.

On Sun, Jan 12, 2025 at 12:47 AM Chris Green via Python-list
Post by Chris Green
Can one use pipx to wrap the process of creating an independent
environment for a python package as opposed to a runnable application?
E.g. I want to install and use pksheet but, as it's not available from
the Debian repositories, I'll have to install it from PyPi. So I
should put it in its own environment. Can pipx help me with this?
--
Chris Green
·
--
https://mail.python.org/mailman/listinfo/python-list
Stefan Ram
2025-01-12 10:26:17 UTC
Reply
Permalink
Post by Chris Green
E.g. I want to install and use pksheet but, as it's not available from
the Debian repositories, I'll have to install it from PyPi.
I can't dig up any "pksheet" on PyPI. So, you got to take
my earlier response like a rumor from a random tech meetup in
Palo Alto - sounds interesting, but needs serious verification.
Chris Green
2025-01-12 12:11:22 UTC
Reply
Permalink
Post by Stefan Ram
Post by Chris Green
E.g. I want to install and use pksheet but, as it's not available from
the Debian repositories, I'll have to install it from PyPi.
I can't dig up any "pksheet" on PyPI. So, you got to take
my earlier response like a rumor from a random tech meetup in
Palo Alto - sounds interesting, but needs serious verification.
Ah, oops, a typo. It's pysheet (I have pk on the brain from it being
Point Kilometrique, distance markers on canals in France).

Thanks for your previous response, it told me what I needed to know,
that pipx isn't really going to do what I want particularly easily.


If I DIY an environment for pysheet and then develop some python that
uses it, how do I then make it accessible as a 'normal' program? This
is just for my own use by the way, on (probably) just a couple of
Linux systems.
--
Chris Green
·
Thomas Passin
2025-01-13 18:15:49 UTC
Reply
Permalink
Post by Chris Green
Post by Stefan Ram
Post by Chris Green
E.g. I want to install and use pksheet but, as it's not available from
the Debian repositories, I'll have to install it from PyPi.
I can't dig up any "pksheet" on PyPI. So, you got to take
my earlier response like a rumor from a random tech meetup in
Palo Alto - sounds interesting, but needs serious verification.
Ah, oops, a typo. It's pysheet (I have pk on the brain from it being
Point Kilometrique, distance markers on canals in France).
Thanks for your previous response, it told me what I needed to know,
that pipx isn't really going to do what I want particularly easily.
If I DIY an environment for pysheet and then develop some python that
uses it, how do I then make it accessible as a 'normal' program? This
is just for my own use by the way, on (probably) just a couple of
Linux systems.
Create a launch script that sets the environmental variables and
launches the program.
Lawrence D'Oliveiro
2025-01-12 22:42:52 UTC
Reply
Permalink
I can't dig up any "pksheet" on PyPI. So, you got to take my earlier
response like a rumor from a random tech meetup in Palo Alto - sounds
interesting, but needs serious verification.
More of a fill-in-the-blanks type of response, shall we say?
Henry S. Thompson
2025-01-13 16:09:36 UTC
Reply
Permalink
I've spent several days trying to get this example [1] working, using
Python3.11 and Cython 3.0.11 of Debian.

I've copied the example files as carefully as I can, renamed some to
avoid a name clash with the queue.py library, but the Pure Python
version throws errors at compile time and although the Cython version
compiles, it doesn't work.

Before giving details, just checking first if anyone can simply point
to a set of files, preferably Pure Python but failing that Cython,
that actually work for them.

Thanks,

ht
--
Henry S. Thompson, School of Informatics, University of Edinburgh
10 Crichton Street, Edinburgh EH8 9AB, SCOTLAND
e-mail: ***@inf.ed.ac.uk
URL: https://www.ltg.ed.ac.uk/~ht/
[mail from me _always_ has a .sig like this -- mail without it is forged spam]
Henry S. Thompson
2025-01-13 19:58:45 UTC
Reply
Permalink
[with link]
Post by Henry S. Thompson
I've spent several days trying to get this example [1] working, using
Python3.11 and Cython 3.0.11 of Debian.
I've copied the example files as carefully as I can, renamed some to
avoid a name clash with the queue.py library, but the Pure Python
version throws errors at compile time and although the Cython version
compiles, it doesn't work.
Before giving details, just checking first if anyone can simply point
to a set of files, preferably Pure Python but failing that Cython,
that actually work for them.
Thanks,
ht
[1] https://cython.readthedocs.io/en/stable/src/tutorial/clibraries.html
--
Henry S. Thompson, School of Informatics, University of Edinburgh
10 Crichton Street, Edinburgh EH8 9AB, SCOTLAND
e-mail: ***@inf.ed.ac.uk
URL: https://www.ltg.ed.ac.uk/~ht/
[mail from me _always_ has a .sig like this -- mail without it is forged spam]
Thomas Passin
2025-01-13 18:18:50 UTC
Reply
Permalink
Post by Henry S. Thompson
I've spent several days trying to get this example [1] working, using
Python3.11 and Cython 3.0.11 of Debian.
I've copied the example files as carefully as I can, renamed some to
avoid a name clash with the queue.py library, but the Pure Python
version throws errors at compile time and although the Cython version
compiles, it doesn't work.
Before giving details, just checking first if anyone can simply point
to a set of files, preferably Pure Python but failing that Cython,
that actually work for them.
Your reference [1] is missing from your post. If it was an attachment,
this list doesn't do attachments.

Loading...