Request - for python Requests module in v5 pip install

129 views
Skip to first unread message

Chris Alemany

unread,
Aug 23, 2023, 3:53:56 PM8/23/23
to weewx...@googlegroups.com
Hello all,

I’ve moved over to v5 successfully for the most part. One missing piece I’ve come across with two extensions now is the Requests modules. I use the weewx-purpleAir and a Mastodon wxtoot extension that both rely on this module. I’m not sure how common it is in other extensions.

I’m sure you want to keep the number of modules down to a minimum but I’ll put my hand up to include pip requests in the weewx-venv.

Cheers
Chris

Tom Keffer

unread,
Aug 23, 2023, 4:06:17 PM8/23/23
to weewx...@googlegroups.com
We are trying to keep the number of modules down to a minimum.

I suppose we could add a feature to the WeeWX extension installer that allowed extension writers to specify which pypi modules they need for their extension. It would look something like

class MyInstaller(ExtensionInstaller):
    def __init__(self):
        super().__init__(
            version="0.5",
            name='my',
            ...
            files=[
                ...
            ],
        pypi = [requests,]
        )

The installer would then run pip to install the specified modules.

-tk

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/06890F55-849E-42BB-93BB-72CFCDB28960%40gmail.com.

Chris Alemany

unread,
Aug 23, 2023, 5:49:47 PM8/23/23
to weewx...@googlegroups.com
That sounds like a great solution!

Message has been deleted

vince

unread,
Aug 23, 2023, 8:01:35 PM8/23/23
to weewx-user
I'm sorry - misread Tom's reply.  Anything that we can add to an extension to make it install better sounds great to me !

On Wednesday, August 23, 2023 at 5:00:45 PM UTC-7 vince wrote:
I would suggest that if you want to keep weewx 'wee' that you should not include modules the core does not need.

You're going to see the same issue with paho-mqtt for lots of users too, FWIW.

matthew wall

unread,
Aug 24, 2023, 8:59:08 AM8/24/23
to weewx-user
invoking pip as a possible side effect of installing a weewx extension has "danger will robinson" and "there be dragons" written all over it.

although it *could* mean one fewer step when installing a weewx extension, and it probably would not be a problem on a system that is running only weewx and where weewx was installed using pip and where weewx is being run in a virtual environment (and i might have missed a few more 'and's), it could be problematic in many other situations.

pip is horrible at dependency management - it will happily break one python package as it tries to satisfy dependencies for another, and unless you have extensive unit tests for everything you ever want to run, you won't notice it until something that used to run just fine breaks.

i wish there were a good solution to python installation/upgrade/management that works across operating environments and packaging systems.

Tom Keffer

unread,
Aug 24, 2023, 10:03:03 AM8/24/23
to weewx...@googlegroups.com
Good reason to always run out of a virtual environment.

Karen K

unread,
Aug 24, 2023, 3:18:01 PM8/24/23
to weewx-user
Most Linux distributions provide Python requests by means of their package management and update system. pip would mess up with this.

vince

unread,
Aug 24, 2023, 3:35:56 PM8/24/23
to weewx-user
For v5 pip installations in a venv you still possibly need to add modules via pip within the venv....

Here, I needed to add requests and paho-mqtt for a couple skins/extensions....

Tom Keffer

unread,
Aug 24, 2023, 6:18:47 PM8/24/23
to weewx...@googlegroups.com
On Thu, Aug 24, 2023 at 12:18 PM Karen K <kk44...@gmail.com> wrote:
Most Linux distributions provide Python requests by means of their package management and update system. pip would mess up with this.

Could you explain? Seems to me that if you use a virtual environment, pip is much less likely to mess up the system. 

-tk
Reply all
Reply to author
Forward
0 new messages