Re: Checking if email is valid

2023-11-03 Thread Thomas Passin via Python-list

On 11/3/2023 6:51 AM, Jon Ribbens via Python-list wrote:

On 2023-11-03, Chris Angelico  wrote:

On Fri, 3 Nov 2023 at 12:21, AVI GROSS via Python-list
 wrote:

My guess is that a first test of an email address might be to see if
a decent module of that kind fills out the object to your
satisfaction. You can then perhaps test parts of the object, rather
than everything at once, to see if it is obviously invalid. As an
example, what does u...@alpha...com with what seems to be lots of
meaningless periods, get parsed into?


What do you mean by "obviously invalid"? Have you read the RFC?


What do you mean by 'What do you mean by "obviously invalid"?'
Have you read the RFC?


About reading the RFC, there's this ... but read the comments too ...

https://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx/


--
https://mail.python.org/mailman/listinfo/python-list


Re: Checking if email is valid

2023-11-03 Thread Simon Connah via Python-list


> 

> 

> On 11/2/23 00:42, Simon Connah via Python-list wrote:
> 

> > Basically I'm writing unit tests and one of them passess in a string
> > with an invalid email address. I need to be able to check the string
> > to see if it is a valid email so that the unit test passess.
> 

> 

> If you truly have managed to code an RFC-compliant verifier, I commend you.

Sorry I wasn't clear. I haven't written anything of the sort but I was looking 
to see if there was a third party option but from feedback in this thread it 
appears that way is considered a bad option.

Simon.

signature.asc
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Checking if email is valid

2023-11-03 Thread Grant Edwards via Python-list
On 2023-11-02, Michael Torrie via Python-list  wrote:
> On 11/2/23 00:42, Simon Connah via Python-list wrote:
>
>> Valid as in conforms to the standard. Although having looked at the
>> standard that might be more difficult than originally planned.
>
> You'll have to read the relevant RFCs.  Lots of corner cases!  From what
> I can see virtually no one on the internet gets it right, judging by the
> number of times I have valid email addresses flagged as not valid by
> poor algorithms.

I've wondered if there are addresses that violate the RFC (and would
therefore be "correctly" rejected), but but in practice will work just
fine.  I've never spent enough time looking at the RFC to even propose
test cases for that...

--
Grant
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: pip/pip3 confusion and keeping up to date

2023-11-03 Thread Dieter Maurer via Python-list
Karsten Hilbert wrote at 2023-11-3 14:47 +0100:
> ...
>> Are they not available in your system's package manager?
>
>... this clearly often answers to "no" for applications of
>any complexity.
>
>Is there a suggested proper path to deal with that (Debian is
>of interest to me here) ?

Complex applications may maintain a set of "known workable versions"
associated with the application's releases.
They may describe those "known workable versions" in a `pip` constraint file.
In this case, you can upgrade to a new application release
by using this constraint file.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: pip/pip3 confusion and keeping up to date

2023-11-03 Thread Karsten Hilbert via Python-list
Am Thu, Nov 02, 2023 at 09:35:43PM - schrieb Jon Ribbens via Python-list:

Regardless of ...

> Because pip barely plays well by itself, let alone with other package
> managers at the same time.

... being true ...

> > I do only install a few things using pip.
>
> Are they not available in your system's package manager?

... this clearly often answers to "no" for applications of
any complexity.

Is there a suggested proper path to deal with that (Debian is
of interest to me here) ?

Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: Checking if email is valid

2023-11-03 Thread AVI GROSS via Python-list
Chris,

I don't mean anything specific in the abstract approach I outlined as a
possible alternative to using one complex regular expression.

My suggestion was that some of the work could be done by the module you used
and THEN you may test various parts of the rest. For example, perhaps
another module lets you test if the domain name is registered. I have not
read the RFC and have not worked on email applications in decades and am not
offering specific advice. I am merely suggesting the possible use of
existing software modules that may provide a better approach in weeding out
SOME bad addresses.

-Original Message-
From: Python-list  On
Behalf Of Chris Angelico via Python-list
Sent: Friday, November 3, 2023 1:43 AM
To: python-list@python.org
Subject: Re: Checking if email is valid

On Fri, 3 Nov 2023 at 12:21, AVI GROSS via Python-list
 wrote:
> My guess is that a first test of an email address might be to see if a
decent module of that kind fills out the object to your satisfaction. You
can then perhaps test parts of the object, rather than everything at once,
to see if it is obviously invalid. As an example, what does
u...@alpha...com with what seems to be lots of meaningless periods, get
parsed into?
>

What do you mean by "obviously invalid"? Have you read the RFC?

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Checking if email is valid

2023-11-03 Thread Jon Ribbens via Python-list
On 2023-11-03, Chris Angelico  wrote:
> On Fri, 3 Nov 2023 at 12:21, AVI GROSS via Python-list
> wrote:
>> My guess is that a first test of an email address might be to see if
>> a decent module of that kind fills out the object to your
>> satisfaction. You can then perhaps test parts of the object, rather
>> than everything at once, to see if it is obviously invalid. As an
>> example, what does u...@alpha...com with what seems to be lots of
>> meaningless periods, get parsed into?
>
> What do you mean by "obviously invalid"? Have you read the RFC?

What do you mean by 'What do you mean by "obviously invalid"?'
Have you read the RFC?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: pip/pip3 confusion and keeping up to date

2023-11-03 Thread Chris Green via Python-list
Jon Ribbens  wrote:
> On 2023-11-02, Chris Green  wrote:
> > Jon Ribbens  wrote:
> >> On 2023-11-02, Chris Green  wrote:
> >> > I have a couple of systems which used to have python2 as well as
> >> > python3 but as Ubuntu and Debian verions have moved on they have
> >> > finally eliminated all dependencies on python2.
> >> >
> >> > So they now have only python3 and there is no python executable in
> >> > PATH. 
> >> >
> >> > There's still both /usr/bin/pip and /usr/bin/pip3 but they're
> >> > identical so presuably I can now simply use pip and it will be a
> >> > python3 pip.
> >> >
> >> >
> >> > So, going on from this, how do I do the equivalent of "apt update; apt
> >> > upgrade" for my globally installed pip packages?
> >> 
> >> I'm not sure what that question has to do with everything that preceded
> >> it, but you don't want to install python packages globally using pip.
> >> Either install them with 'apt', or install them in a virtual environment.
> >
> > Why in a virtual environment?  When I install a package whether from
> > apt or from pip I want everyone/everything on my system to be able to
> > use it.
> 
> Because pip barely plays well by itself, let alone with other package
> managers at the same time.
> 
Well that's a criticism of pip rather than of how I use it! :-)

OK, there are risks.


> > I do only install a few things using pip.
> 
> Are they not available in your system's package manager?
> I guess you might get away with "sudo -H pip install -U foo"
> for a couple of things, if they don't have many dependencies.

I obviously check the package manager and also other sources which
work through apt before resorting to using pip.

The sort of thing I have to use pip for is software for odd I2C sensor
devices and such.  These rarely have any dependencies or they are all
the same dependencies as the other I2C device software.  So,
hopefully, I won't hit any big problems.  I have to say that so far I
haven't been bitten.  

I would point out that this is mostly for a headless Beaglebone Black
single board computer (comparable with a Raspberry Pi) with only a
minimal 'console' installation of Debian so it's a pretty minimal
system.

-- 
Chris Green
ยท
-- 
https://mail.python.org/mailman/listinfo/python-list