Re: Terminal Emulator (Posting On Python-List Prohibited)

2024-05-19 Thread Skip Montanaro via Python-list
Modern debian (ubuntu) and fedora block users installing using pip.
>

Even if you're telling it to install in ~/.local? I could see not allowing
to run it as root.

I honestly haven't tried. Maybe I should... 樂 I have an old laptop running
XUbuntu 22.04 which I generally only use to compile the most recent
branches on GitHub (main, 3.12, & 3.13 at the moment).

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


Re: PyCon

2024-05-18 Thread Skip Montanaro via Python-list
>
> > I’m at PyCon in Pittsburgh and I’m haven’t an amazing time!
>
> s/haven’t/having/
>

No need to explain/correct. We understand you are excited. Many of us have
been in the same state before. ;-)

Enjoy,

Skip

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


Re: xkcd.com/353 ( Flying with Python )

2024-03-30 Thread Skip Montanaro via Python-list
>
> > https://xkcd.com/1306/
> >   what does  SIGIL   mean?
>
> I think its' a Perl term, referring to the $/@/# symbols in front of
> identifiers.
>

I had a vague recollection of hearing it elsewhere (*Game of Thrones,* on
the armies' battle flags?), but didn't know what it meant. Google tells me:

*an inscribed or painted symbol considered to have magical power.*

So, they're more than just line noise. They confer power on their users...

Perhaps '@' in the context of decorators is the most prominent example in
Python, since decorators technically don't allow the programmer to do
something they couldn't before, but are now are used everywhere, a key
feature of many applications and modules.

Magical-ly, y'rs,

Skip

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


Re: Testing (sorry)

2024-02-19 Thread Skip Montanaro via Python-list
>
> Here is a typical bounce message that I get:
>
> : host mail.python.org[188.166.95.178] said:
> 450-4.3.2
>  Service currently unavailable 450 4.3.2
>
> Some time after I get one of these messages I re-send the post.  Usually
> it gets through then.
>

Looks kinda like greylisting to me. I'm pretty sure that's one of the tool
in the mail.python.org chain.

Skip

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


Re: Testing (sorry)

2024-02-18 Thread Skip Montanaro via Python-list
I can't explain the delays, but will note that the gate-news program on the
server runs every 5 minutes via cron. There are multiple moving parts in
the overall system. You'll probably get a more useful answer from
postmas...@python.org.

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


Re: test-ignore

2024-02-15 Thread Skip Montanaro via Python-list
>
> True, but did the poster really need to send another one to say "yes,
> that worked"?
>

Maybe to test the bidirectionality of the gateway? 路 If the messages stop
I think we can let it die. It's not like this sort of activity is a regular
occurrence. (A bigger problem for me was always Usenet posters who used
fake email addresses.)

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


Re: test-ignore

2024-02-15 Thread Skip Montanaro via Python-list
>
> > Test post to see if my Newsgroup post program is working.
>
> Aim your test messages at alt.test, please.
>

I agree that basic Usenet connectivity messages should go to alt.test. It's
not clear from the original post, but if the poster's aim was to see if
posts to comp.lang.python traverse the gateway and show up on this list,
then alt.test won't help.

Skip

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


Re: Question about garbage collection

2024-01-15 Thread Skip Montanaro via Python-list
> I do have several circular references. My experience is that if I do not
> take some action to break the references when closing the session, the
> objects remain alive. Below is a very simple program to illustrate this.
>
> Am I missing something? All comments appreciated.

Python has normal reference counting, but also has a cyclic garbage
collector. Here's plenty of detail about how it works:

https://devguide.python.org/internals/garbage-collector/index.html

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


Re: Python 3.11.5 Pip Issue

2023-09-14 Thread Skip Montanaro via Python-list
> I downloaded Python 3.11.5, and there was nothing in the “Scripts” file,
> and there was no Pip. I would like to know why.
>

Can't help with the empty/missing Scripts folder. Does running

python -m ensurepip

get you a working pip? Which you should then run as

python -m pip ...

Skip

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


Re: What to use instead of nntplib?

2023-05-22 Thread Skip Montanaro
>
> My understanding is that nntplib isn't being erased from reality,
> it's merely being removed from the set of modules that are provided
> by default.
>
> I presume that once it's removed from the core, it will still be
> possible to install it via pip or some other mechanism.
>

It won't magically be available via pip unless someone steps up to maintain
it as a PyPI package

Skip

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


Re: What to use instead of nntplib?

2023-05-15 Thread Skip Montanaro
> I got a nice warning today from the inews utility I use daily:
>
> DeprecationWarning: 'nntplib' is deprecated and slated for removal in 
> Python 3.13
>
> What should I use in place of nntplib?

I'd recommend creating a PyPI project with the existing 3.12 code,
then using that from 3.13 onward.

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


Re: replacement for nntplib on Python3

2023-04-26 Thread Skip Montanaro
You could create a git repo with just nntplib and generate a package on
PyPI, then use that when running a version of Python which lacks nntplib.

Skip

On Wed, Apr 26, 2023, 8:42 PM Retrograde  wrote:

> I used to use a script that relied on nntplib, which is currently still
> available in Python3 but scheduled for deprecation in the near future.
> What would be a suitable replacement?
>
> --
> Retrograde 
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Small lament...

2023-04-03 Thread Skip Montanaro
Just wanted to throw this out there... I lament the loss of waking up on
April 1st to see a creative April Fool's Day joke on one or both of these
lists, often from our FLUFL... Maybe such frivolity still happens, just not in
the Python ecosystem? I know you can still import "this" or "antigravity",
but those are now old (both introduced before 2010). When was the last time
a clever easter egg was introduced or an April Fool's Day joke played?

¯\_(ツ)_/¯

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


Re: JOB | Lead Linux Sysadmin (Edinburgh/London)

2023-03-08 Thread Skip Montanaro
There's a link at the bottom of each message to the list info pager. Follow
the directions on that page to unsubscribe.

Skip

On Wed, Mar 8, 2023, 5:38 PM Thomas Gregg  wrote:

> Is there any way to be removed from this list?
> Thank you,  Tom
>
> On Wed, Mar 8, 2023 at 3:51 PM Skip Montanaro 
> wrote:
>
> > > Hello, I'm working with an employer that is looking to hire someone in
> > > (Edinburgh or London) that can administer on-prem and vmware
> > > platforms.
> > >
> >
> > James,
> >
> > If you haven't already, please post to the Phone Jobs Board:
> >
> > https://www.python.org/jobs/
> >
> > Skip
> >
> > >
> > --
> > https://mail.python.org/mailman/listinfo/python-list
> >
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: JOB | Lead Linux Sysadmin (Edinburgh/London)

2023-03-08 Thread Skip Montanaro
> Hello, I'm working with an employer that is looking to hire someone in
> (Edinburgh or London) that can administer on-prem and vmware
> platforms.
>

James,

If you haven't already, please post to the Phone Jobs Board:

https://www.python.org/jobs/

Skip

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


Re: Python 3.10 Fizzbuzz

2023-02-26 Thread Skip Montanaro
Dang auto-correct... Should read

... double quotes around "strings" and single quotes around 'c'haracters ...

On Sun, Feb 26, 2023, 6:28 PM Skip Montanaro 
wrote:

> is there any reason to prefer"over'   ?
>>
>
> Not really. As an old C programmer for many years I used double
> quotes"around "strings" and single word around 'c'haracters, because that's
> what I was used to. (This was long before triple quoted strings appeared in
> the language.)
>
> Aside: Given all the various ways to quote strings for display, it irks me
> a bit to see repr() still use single quotes in all cases, which requires
> display of single quotes to be escaped. (In similar fashion, it would be a
> minor improvement in my mind if the repr() code used raw strings where they
> would simplify the display.)
>
> Skip
>
>>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3.10 Fizzbuzz

2023-02-26 Thread Skip Montanaro
>
> is there any reason to prefer"over'   ?
>

Not really. As an old C programmer for many years I used double
quotes"around "strings" and single word around 'c'haracters, because that's
what I was used to. (This was long before triple quoted strings appeared in
the language.)

Aside: Given all the various ways to quote strings for display, it irks me
a bit to see repr() still use single quotes in all cases, which requires
display of single quotes to be escaped. (In similar fashion, it would be a
minor improvement in my mind if the repr() code used raw strings where they
would simplify the display.)

Skip

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


Re: Is there a more efficient threading lock?

2023-02-26 Thread Skip Montanaro
> And yet, it appears that *something* changed between Python 2 and Python
3 such that it *is* atomic:

I haven't looked, but something to check in the source is opcode
prediction. It's possible that after the BINARY_OP executes, opcode
prediction jumps straight to the STORE_FAST opcode, avoiding the transfer
to the top of the virtual machine loop. That would (I think) avoid checks
related to GIL release and thread switches.

I don't guarantee that's what's going on, and even if I'm correct, I don't
think you can rely on it.

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


Re: Is there a more efficient threading lock?

2023-02-25 Thread Skip Montanaro
Thanks for the responses.

Peter wrote:

> Which OS is this?

MacOS Ventura 13.1, M1 MacBook Pro (eight cores).

Thomas wrote:

> I'm no expert on locks, but you don't usually want to keep a lock while
> some long-running computation goes on.  You want the computation to be
> done by a separate thread, put its results somewhere, and then notify
> the choreographing thread that the result is ready.

In this case I'm extracting the noun phrases from the body of an email
message (returned as a list). I have a collection of email messages
organized by month (typically 1000 to 3000 messages per month). I'm using
concurrent.futures.ThreadPoolExecutor() with the default number of workers (
os.cpu_count() * 1.5, or 12 threads on my system) to process each month, so
12 active threads at a time. Given that the process is pretty much CPU
bound, maybe reducing the number of workers to the CPU count would make
sense. Processing of each email message enters that with block once. That's
about as minimal as I can make it. I thought for a bit about pushing the
textblob stuff into a separate worker thread, but it wasn't obvious how to
set up queues to handle the communication between the threads created by
ThreadPoolExecutor() and the worker thread. Maybe I'll think about it
harder. (I have a related problem with SQLite, since an open database can't
be manipulated from multiple threads. That makes much of the program's
end-of-run processing single-threaded.)

> This link may be helpful -
>
> https://anandology.com/blog/using-iterators-and-generators/

I don't think that's where my problem is. The lock protects the generation
of the noun phrases. My loop which does the yielding operates outside of
that lock's control. The version of the code is my latest, in which I
tossed out a bunch of phrase-processing code (effectively dead end ideas
for processing the phrases). Replacing the for loop with a simple return
seems not to have any effect. In any case, the caller which uses the
phrases does a fair amount of extra work with the phrases, populating a
SQLite database, so I don't think the amount of time it takes to process a
single email message is dominated by the phrase generation.

Here's timeit output for the noun_phrases code:

% python -m timeit -s 'text = """`python -m timeit --help`""" ; from
textblob import TextBlob ; from textblob.np_extractors import
ConllExtractor ; ext = ConllExtractor() ; phrases = TextBlob(text,
np_extractor=ext).noun_phrases' 'phrases = TextBlob(text,
np_extractor=ext).noun_phrases'
5000 loops, best of 5: 98.7 usec per loop

I process the output of timeit's help message which looks to be about the
same length as a typical email message, certainly the same order of
magnitude. Also, note that I call it once in the setup to eliminate the
initial training of the ConllExtractor instance. I don't know if ~100us
qualifies as long running or not.

I'll keep messing with it.

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


Is there a more efficient threading lock?

2023-02-25 Thread Skip Montanaro
I have a multi-threaded program which calls out to a non-thread-safe
library (not mine) in a couple places. I guard against multiple
threads executing code there using threading.Lock. The code is
straightforward:

from threading import Lock

# Something in textblob and/or nltk doesn't play nice with no-gil, so just
# serialize all blobby accesses.
BLOB_LOCK = Lock()

def get_terms(text):
with BLOB_LOCK:
phrases = TextBlob(text, np_extractor=EXTRACTOR).noun_phrases
for phrase in phrases:
yield phrase

When I monitor the application using py-spy, that with statement is
consuming huge amounts of CPU. Does threading.Lock.acquire() sleep
anywhere? I didn't see anything obvious poking around in the C code
which implements this stuff. I'm no expert though, so could easily
have missed something.

Thx,

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


Re: Upgrading Python on Ubuntu 22.04.1 LTS

2023-02-01 Thread Skip Montanaro
>
>
> I have a server with Ubuntu 22.04.1 LTS and the Python version there
> is Python 3.10.6. Is there a safe way to upgrade to the latest version of
> Python 3.10 (3.10.9)? I tried with the OS update and upgrade but the Python
> version remained the same.
>
> I have an Ubuntu 22.04 system. The installed Python 3.10 version is 3.10.7:

$ apt search python3 | egrep '^python3.10.*installed'


WARNING: apt does not have a stable CLI interface. Use with caution in
scripts.


python3.10/now 3.10.7-1+focal1 amd64 [installed,local]
python3.10-distutils/now 3.10.7-1+focal1 all [installed,local]
python3.10-doc/jammy-updates,jammy-security,now 3.10.6-1~22.04.2 all
[installed]
python3.10-gdbm/now 3.10.7-1+focal1 amd64 [installed,local]
python3.10-lib2to3/now 3.10.7-1+focal1 all [installed,local]
python3.10-minimal/now 3.10.7-1+focal1 amd64 [installed,local]
python3.10-venv/now 3.10.7-1+focal1 amd64 [installed,local]


Off the top of my head, I can't recall if it's LTS or not. If you want to
go beyond 3.10.6, it should be possible. As Grant indicated though,
upgrading packages on an Ubuntu system (of any flavor) is the province of
the Ubuntu community.

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


Re: Android APK

2023-01-25 Thread Skip Montanaro
>
> Is there a good python library for converting python3 to android APK
>

I'm not an app type of person, so don't watch that space. I've heard of
Kivy:

https://kivy.org/

I also something called python-for-android on PyPI with a recent release:

https://pypi.org/project/python-for-android/

I'd be interested to see what else turns up.

Skip

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


Re: argparse — adding a --version flag in the face of positional args

2022-11-28 Thread Skip Montanaro
Thanks. It occurs to me that instead of providing two special actions
("help" and "version"), it might be worthwhile to provide a standard way of
saying, "if present, process this option and exit before considering other
details of the command line." Matt's example action works well enough for
my needs, but it would be nice if more than one such option could be given.
For example:

import argparse

parser = argparse.ArgumentParser()
parser.add_argument("url")
parser.add_argument("--version", version="777", action="version")

args = parser.parse_args(["--help", "--version"])

Which option is processed depends on their order on the command line. I
don't believe it's possible to run the script and see them both processed.
That's probably a secondary consideration though. My script is working well
enough in this regard now.

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


Re: argparse — adding a --version flag in the face of positional args

2022-11-27 Thread Skip Montanaro
>
> ummm, hate to say this, but have you checked the documentation?  this
> case is supported using an action named 'version' without doing very much.
>

Thanks, Mats.

I actually searched all over the argparse docs. (There's a lot to digest.
Honestly, if I wasn't attempting to be sort of up-to-date I'd just continue
using getopt.) It never occurred to me that "version" would be special, so
I didn't specifically search for it, or realize there would be a specific
action devoted to it. I knew (the default) "help" was special, so I focused
my search for it. Obviously, "--help" is a pretty bad search term.

Skip

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


Re: argparse — adding a --version flag in the face of positional args

2022-11-27 Thread Skip Montanaro
> class VersionAction(argparse.Action):
> def __call__(self, parser, namespace, values, option_string):
> print(VERSION)
> exit()
...
> parser.add_argument("-v", "--version", nargs=0, action=VersionAction)

Thanks. An action class didn't occur to me. I looked briefly at the
code for argparse to see how it handled --help. The added argument
seemed normal, so gave up, figuring there was some special handling of
that option.

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


argparse — adding a --version flag in the face of positional args

2022-11-27 Thread Skip Montanaro
I have a script to which I'd like to add a --version flag. It should print
the version number then exit, much in the same way --help prints the help
text then exits. I haven't been able to figure that out. I always get a
complaint about the required positional argument.

I think I could use something like nargs='*', but that would push off
detection of the presence of the positional arg to the application.
Shouldn't I be able to tell argparse I'm going to process --verbose, then
exit?

Thx,

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


Re: Ref-strings in logging messages (was: Performance issue with CPython 3.10 + Cython)

2022-10-07 Thread Skip Montanaro
Dang autocorrect. Subject first word was supposed to be "f-strings" not
"ref-strings." Sorry about that.

S

On Fri, Oct 7, 2022, 10:45 AM Skip Montanaro 
wrote:

>
>
> On Fri, Oct 7, 2022 at 9:42 AM Andreas Ames 
> wrote:
>
>> 1. The culprit was me. As lazy as I am, I have used f-strings all over the
>> place in calls to `logging.logger.debug()` and friends, evaluating all
>> arguments regardless of whether the logger was enabled or not.
>>
>
> I thought there was some discussion about whether and how to efficiently
> admit f-strings to the logging package. I'm guessing that's not gone
> anywhere (yet).
>
> Skip
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Ref-strings in logging messages (was: Performance issue with CPython 3.10 + Cython)

2022-10-07 Thread Skip Montanaro
On Fri, Oct 7, 2022 at 9:42 AM Andreas Ames 
wrote:

> 1. The culprit was me. As lazy as I am, I have used f-strings all over the
> place in calls to `logging.logger.debug()` and friends, evaluating all
> arguments regardless of whether the logger was enabled or not.
>

I thought there was some discussion about whether and how to efficiently
admit f-strings to the logging package. I'm guessing that's not gone
anywhere (yet).

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


Python gets a mention on Reddit - in r/tifu

2022-08-07 Thread Skip Montanaro
Not exactly where I expected to see Python mentioned on Reddit, but I found
this amusing (yes, despite the subreddit, it should be safe for work):

https://www.reddit.com/r/tifu/comments/wibmkh/tifu_by_teaching_my_13yo_brother_python/

Just a little diversion for a Sunday afternoon. I was particularly amused,
as my son is in dev ops, writes Python from time-to-time, and my grandson
is 13. I could definitely see the pattern in the story transferring over to
Chris and Carmine.

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


Re: Dictionary order?

2022-08-01 Thread Skip Montanaro
>
> So I decided to write a little test program to run on a variety of
> CPythons, to confirm what I was thinking.
>
> And instead I got a surprise.
>
> On 1.4 through 2.1 I got descending key order.  I expected the keys to be
> scattered, but they weren't.
>
> On 2.2 through 3.5 I got ascending key order.  I expected the keys to be
> scattered, but they weren't.
>
> On 3.6 through 3.10 I got insertion order, as expected.
>
> But why are 1.4 through 3.5 ordering so much?
>

That's long in the past, but I seem to recall that key order was
unspecified. That would give the implementer (likely Tim Peters much of the
time) the freedom to do whatever worked best for performance or simplicity
of implementation.

Skip

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


Re: Resolving Weekday Schedules to Dates

2022-07-21 Thread Skip Montanaro
> Do you know of a library that resolves schedules like every Wednesday
> at 3:00pm to absolute time, that is return the datetime of the next
> occurrence?

Take a look at the `rrule` module in the `dateutil` package:

https://dateutil.readthedocs.io/en/stable/rrule.html

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


Now for something completely different...

2022-05-22 Thread Skip Montanaro
This isn't really Python-related, but I don't wander around any more
general software engineering/computer science places on the web, so I will
throw this out here.

I start a framebuilding class next week (lugged steel construction for
those into bikes). After about three weeks of work, I should have a
custom-made frame, which will also happen to have been built by me. It will
need paint or powder coat and graphics. I'm looking for ideas about the
graphics.

Though I spent most of my professional life noodling around with Python
(I'm now retired), I don't really want the graphics to be terribly
Python-centric. Consequently, "import this" is probably not going to work.
I have decided to go ahead and use my first name in lower case Courier as
the core piece of the downtube graphic:

skip

That's not too informative (other than its relationship to moi), and I have
room for probably four or five more characters. (I have a graphic artist in
mind, so the space need not strictly be text either.)

So, how would you fill the remaining space? I've considered "n++" or "n+1",
but not thought of anything more than that. For those who are not into
bikes, you may not have heard of the Velominati Rules
<https://www.velominati.com/>. I quote Rule #12:

*The correct number of bikes to own is n+1.*
While the minimum number of bikes one should own is three, the correct
number is n+1, where n is the number of bikes currently owned. This
equation may also be re-written as s-1, where s is the number of bikes
owned that would result in separation from your partner.

I currently have six to ten, depending on how demanding you are that they
be ready to ride with nothing more than air in the tires. This project,
while definitely n+1 might well also be approaching s-1. :-)

Ideas about head tube graphics are also welcome. I have no idea there at
all yet. Again, some subtle reference to software engineering would be nice.

So, if you'd like to play along, toss out some ideas. I'll consider
everything as long as it's not NSFW.

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


Re: Do projects exist to audit PyPI-hosted packages?

2022-05-06 Thread Skip Montanaro
>
> A related problem is that even if a package is maintained by somebody with
> good intentions, the account might be hijacked by a malicious actor and
> since PyPi is separate from source control, people might not be able to
> find out easily and malware could spread through PyPi.
>

I hadn't considered that. Some sort of authenticated connection between the
source code hosting service and the PyPI user posting the package would be
nice.



Some other (only tangentially related) stuff occurs to me as I search for
useful bits...

I'd kinda be curious what hosting services other than GitHub or GitLab are
in common use. GNU Savannah? SourceForge? PyPI relevance isn't a terrific
indicator (I assume it uses Libraries.io's SourceRank to get a relevance
score), but it's still some kind of indicator how useful a package is.
Perhaps the PyPI BigQuery stuff has hosting info. I've not dug into it.
(Thinking that obscure hosting service might be a small knock against a
package, but that's just a thought. I realize not everyone is happy with
corporate hosting services.)

Having a decent idea what functional alternatives are out there to a
particular package would be nice as well. Again, considering pynput, I hit
Google up for "python packages similar to pynput" which led me here:

https://www.libhunt.com/r/pynput

I was unaware of its existence before. I have no idea how useful it might
be for narrowly focused packages like pynput. Something with application to
a much wider community, like numpy, returns a bunch more:

https://www.libhunt.com/r/numpy



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


Do projects exist to audit PyPI-hosted packages?

2022-05-06 Thread Skip Montanaro
I woke with a start in what amounted to the middle of the night (I really
need to get about three more hours of sleep, but you'll understand why I
was awake to write this).

Many years ago, so as to preserve my wrists, I wrote a tool
<https://github.com/smontanaro/python-bits/blob/main/src/watch.py> to
monitor mouse and keyboard activity. It tells me when to rest. I use it
when I have problems, then put it away until it's needed again. I have
resurrected it a few times over the years, most recently a month or two
ago. Having never been all that fond of how I tracked keyboard and mouse
activity, I was happy when I stumbled upon pynput
<https://pypi.org/project/pynput/>. "Yay!", I thought. My worries are over.

Then extremely early this morning I woke thinking, "Damn, this runs on my
computer and it can see my mouse and keyboard activity. How do I know it's
not stealing my keystrokes?" Not going back to sleep after that. So, I'm
going through the code (and the Xlib package on which it relies) to make
myself more comfortable that there are no issues. Note: I am *most
certainly not* accusing the pynput author of any mischief. In fact, I
suspect there's no problem with the package. It's got a bunch of stars and
plenty of forks on GitHub (for what that's worth). I suspect the code has
had plenty of eyeballs looking at it. Still, I don't really know how well
vetted it might be, so I have no assurances of that. I saw it mentioned
somewhere (discuss I think?), checked it out, and thought it would solve my
activity tracking in a cross-platform way. (I currently only use an Xorg
environment, so while I am looking at the code, I'm not paying attention to
the Windows or MacOS bits either.)

This got me thinking. If I'm curious about pynput, might other people be as
well? What about other packages? I'm actually not worried about Python
proper or vulnerabilities which have already been found
<https://github.com/pypa/advisory-database>. PyPI currently advertises that
it hosts over 373k packages. With that many hosted packages, it is almost
certainly a haven for some undetected vulnerabilities. Knowing which
packages have been audited — at least in a cursory fashion — could be used
as a further criterion to use when deciding which packages to consider
using on a project.

So, does something already exist (pointers appreciated)? Thx...

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


Re: Receive a signal when waking or suspending?

2022-04-25 Thread Skip Montanaro
> https://duckduckgo.com/?t=ffab=python+up+time pointed-out the
> "uptime — Cross-platform uptime library"
> - TLDR; I'm not sure if "uptime" and "boot" relate only to a
> 'cold-start' or if they include bringing the machine out of 'stand-by'
> or 'hibernation'

Yeah, that won't help. uptime(1) gives the time since the last boot.
Wake/suspend doesn't change the system's notion of boot time.

> https://duckduckgo.com/?t=ffab=python+battery+status pointed-out
> several ideas which require MS-Windows, but apparently the psutil
> library could be bent to your will:
>
https://www.geeksforgeeks.org/python-script-to-shows-laptop-battery-percentage/

I actually already have psutil installed. It gives you details about
various system bits (like battery status, which is why I installed it). It
doesn't seem to have anything that will notify about state changes, just
the current state (or — for example — continuous values like the battery
state of charge). I didn't see anything regarding wake/suspend, but I might
have missed it. Since my tool can't run while the system is suspended, it
would always see the system as "awake" but not know for how long it was in
that state. (I'm sure I could track in my tick routine and pay attention to
unusually long gaps.)

I think Marco's response gives me a bit better handle on what I need(*). Maybe
just an easier way to do things. For example, just before suspending and
just after waking, all scripts in /usr/lib/systemd/system-sleep/ are
executed. The only difference is the arguments with which they are called.
A script to suit my needs can just write a stream of records with
timestamps. It took just a minute or so:

#!/bin/sh

echo "`date --iso-8601=seconds` $1 $2" >> /tmp/suspensions
chmod 0644 /tmp/suspensions

Here's what /tmp/suspensions looks like after a couple cycles:

root@montanaro:/usr/lib/systemd/system-sleep# cat /tmp/suspensions
2022-04-23T19:17:41-05:00 pre suspend
2022-04-23T19:17:54-05:00 post suspend
2022-04-23T19:18:48-05:00 pre suspend
2022-04-23T19:19:04-05:00 post suspend


My tool can monitor that file for changes and keep track of the times of
state changes. It can thus track rest intervals across system suspensions
and know if I've been resting for a long enough period of time to allow me
to subject my wrists to further agony
<https://github.com/smontanaro/python-bits/blob/master/src/watch.py> with
the keyboard and mouse.

Skip

(*) man systemd-sleep contains this admonition:

Note that scripts or binaries dropped in /lib/systemd/system-sleep/ are
intended for local use only and *should be considered hacks*. If
applications want to react to system suspend/hibernation and resume,
they should
rather use the Inhibitor interface[1].


A hack should suit my needs just fine. I'll leave more elegant solutions to
others. :-)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Receive a signal when waking or suspending?

2022-04-23 Thread Skip Montanaro
> I don't know in Python, but maybe you can create a script that writes
> on a named pipe and read it from Python?
> https://askubuntu.com/questions/226278/run-script-on-wakeup

Thanks, that gives me something to munch on.
-- 
https://mail.python.org/mailman/listinfo/python-list


Receive a signal when waking or suspending?

2022-04-23 Thread Skip Montanaro
It's not clear there is a straightforward way to catch a signal or get
an event notification when my computer (Dell running XUbuntu 20.04) is
about to sleep or when it's just awakened. The app uses tkinter. Is
there some more-or-less easy way to do this? Mac support would be nice
(I have my eye on a new MacBook one of these days). I suppose bonus
points for something which works on Windows, but that's not a platform
I actually care about.

Thx,

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


[issue27546] Integrate tkinter and asyncio (and async)

2022-04-04 Thread Skip Montanaro


Change by Skip Montanaro :


--
nosy:  -skip.montanaro

___
Python tracker 
<https://bugs.python.org/issue27546>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27546] Integrate tkinter and asyncio (and async)

2022-04-04 Thread Skip Montanaro


Skip Montanaro  added the comment:

See also (perhaps)

https://bugs.python.org/issue47190

--
nosy: +skip.montanaro

___
Python tracker 
<https://bugs.python.org/issue27546>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue47190] Integrating tkinter and asyncio event loops

2022-04-04 Thread Skip Montanaro


Skip Montanaro  added the comment:

That's fine. My brief search didn't turn up

https://bugs.python.org/issue27546

I'm happy to close this.

--
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue47190>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue47190] Integrating tkinter and asyncio event loops

2022-04-03 Thread Skip Montanaro


Change by Skip Montanaro :


--
keywords: +patch
pull_requests: +30355
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/32293

___
Python tracker 
<https://bugs.python.org/issue47190>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue47190] Integrating tkinter and asyncio event loops

2022-04-01 Thread Skip Montanaro


New submission from Skip Montanaro :

After looking around and asking, it appears there is no built-in integration of 
the tkinter and asyncio event loops. That would seem to be a good thing, at 
least as an example. I wrote a simple hello world which creates an AsyncTk 
class and uses asyncio-driven event handling. This is clearly incomplete, but 
might be a useful starting point, even if just as a seed for discussion or as 
an example for tkinter or asyncio documentation.

Discussion/thread references:

https://mail.python.org/pipermail/python-list/2022-March/905783.html
https://discuss.python.org/t/connecting-asyncio-and-tkinter-event-loops/14722/7

The code in its most basic form is attached. (I have another version which uses 
pynput to track keyboard and mouse events.)

--
components: Tkinter
files: tkasyncio.py
messages: 416500
nosy: skip.montanaro
priority: normal
severity: normal
status: open
title: Integrating tkinter and asyncio event loops
versions: Python 3.11
Added file: https://bugs.python.org/file50712/tkasyncio.py

___
Python tracker 
<https://bugs.python.org/issue47190>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: asyncio+tkinter

2022-03-31 Thread Skip Montanaro
>
> > Given that both asyncio & tkinter are modules in the standard lib and
> both
> > have event loops, I would have expected to find some "best practice"
> > solution to mixing the two.
>
> Agreed. For GTK, you can use a dedicated loop policy like this:
>
> import asyncio_glib
> asyncio.set_event_loop_policy(asyncio_glib.GLibEventLoopPolicy())
>
> It should be possible to make it this easy for asyncio + tkinter.
>

I haven't used GTK in ages and ages, but I do still have a tkinter program
that I drag out every now and then when my wrists start acting up. After
opining about this on the PyIdeas discuss forum, I spent a few minutes and
came up with a simple AsyncTk subclass of tkinter.Tk. Here's its hello
world:

https://gist.github.com/smontanaro/5e12c557602a76c609e46ca59387ad1c

I modified my activity watcher to use it:

https://github.com/smontanaro/python-bits/blob/master/src/watch.py

A few warnings:

   1. copy/paste reuse of that AsyncTk class
   2. the code is a mess (it's probably 20-25 years old, I make no
   apologies for the mess)
   3. as of about an hour ago it now uses pynput to watch for mouse/kbd
   watching

So, Tk+asyncio turns out to be fairly easy to do, at least for simple stuff.

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


Re: Set tkinter top-level window to "always on visible workspace"

2022-03-29 Thread Skip Montanaro
> Also, wmctrl accepts window names instead of ids if you omit the -i
> option. In case winfo_id() is not returning the id you need.

Nice. That worked. FWIW, Tk never gave me the very outermost window as the
parent of the tkinter.Tk instance. Here's the start of hierarchy:

% xwininfo -tree

xwininfo: Please select the window about which you
  would like information by clicking the
  mouse in that window.

xwininfo: Window id: 0x5a0001f "Typing Watcher"

  Root window id: 0x7a2 (the root window) (has no name)
  Parent window id: 0xc73880 (has no name)
 1 child:
 0x5a0001e (has no name): ()  178x126+0+0  +2+43
1 child:
0x5a00020 (has no name): ()  178x126+0+0  +2+43
   5 children:
...

Tk thought 0x5a0001e was the top, but as you can see 0x5a0001f is the named
window. Calling wmctrl using "Typing Watcher" as the target window did the
trick.

Thanks,

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


Re: Set tkinter top-level window to "always on visible workspace"

2022-03-28 Thread Skip Montanaro
> Would you accept a solution that involves a subprocess call?
>
> wmctrl -ir {id} -b add,sticky

I'm already checking idle time with xprintidle(1), so what's one more
(one-time) subprocess call?

Small amount of history, I'm referring to this mouse/typing watcher:

https://github.com/smontanaro/python-bits/blob/master/src/watch.py

I wrote this years and years ago when I first started having RSI problems.
So long ago that I just deleted a commented out piece of code which was
there in case I ever ran it with Python 1.4(!).

Over the years I've needed it on Linux, Linux+WIndows, Mac, etc. I'd put it
away for a couple years, then suffer a flare-up and pull it back out. I
never thought I'd need it after I retired, but here I am again. I've tried
all sorts of things to monitor mouse and keyboard activity. At the moment
I'm just using a Linux laptop, so have tossed out any sort of attempted
cross-platform tracking functionality.

> Now, the only problem is... figuring out your window ID. Worst case,
> parse wmctrl -lG to get that info, but it might be possible to get the
> window ID from Tkinter itself.

I'm struggling to get the outermost window (not sure what's going on), but
I will keep messing around.

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


Re: Set tkinter top-level window to "always on visible workspace"

2022-03-28 Thread Skip Montanaro
> I think you must be using xfce4, not fvwm4 (there's an fvwm3 in
> development). See https://xfce.org/

Both?

% pgrep -fla xfwm4
1803 xfwm4 --replace
539426 xfwm4-settings

% pgrep -fla xfce
1599 xfce4-session
1755 /usr/bin/ssh-agent /usr/bin/im-launch startxfce4
1782 /usr/lib/x86_64-linux-gnu/xfce4/xfconf/xfconfd
...

I kind of assume xfce4 is the session manager sort of thing, while
xfwm4 is the actual window manager.

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


Re: Set tkinter top-level window to "always on visible workspace"

2022-03-28 Thread Skip Montanaro
> I might be misguided, but on modern desktops that should be possible
> with a few mouseclicks. E.g. in KDE, there is a little pin icon
> displayed in every title bar of a toplevel window on the left side.

Correct, and that's what I'm currently doing. I'm lazy though. I want
the program to start always visible on the active virtual desktop. As
Cameron showed, this is possible. I have vague recollection of doing
this with the same program probably 15-20 years ago in an age when
window managers weren't largely configured with the mouse.
Unfortunately, I no longer recall what window manager(s) I used at the
time (probably twm or fvwm). Now I use fvwm4 and can't find squat
online about configuration files. I do have a ~/.config/xfce4/xfwm4/
directory, but it is completely empty.

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


Re: Set tkinter top-level window to "always on visible workspace"

2022-03-27 Thread Skip Montanaro
> So you might tell your window manager to keep that window on the main
workspace.

Thanks. I'd forgotten about the possibility of doing this sort of thing in
the window manager config. That would certainly be fine in this case. (It's
been ages since I messed with this sort of thing.)

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


Set tkinter top-level window to "always on visible workspace"

2022-03-27 Thread Skip Montanaro
I have a tkinter app (Ubuntu/X11 env) whose main window should always be
displayed on the currently visible workspace. Is there some way to set that
attribute programmatically? I see that there is a tkinter.Wm class and that
Toplevel widgets have a wm_attributes method, but haven't found any
examples in the library doc or on the wider net which demonstrate control
of this particular window manager interaction. (I don't care about Windows
or Mac, at least for the time being.)

Thx,

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


Re: How to detect an undefined method?

2022-03-27 Thread Skip Montanaro
> Let's say I have a Python app and have used an undefined method somewhere.
> Let
> us further assume I have not detected it thru my tests.
>
> Is there a way to detect it before deploying the app? pylint doesn't
> notice it.
>

This is maybe not exactly what you're looking for, but writing a test to
exercise that function call (if possible) would be top of my list. Next on
my list would be to use coverage to get a good idea of what code is not
tested. Writing more test cases to reduce the number of uncovered lines
will also make it easier to manually examine the rest of your (untested) code
to find calls to missing functions or methods.

Skip

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


asyncio+tkinter

2022-03-21 Thread Skip Montanaro
Given that both asyncio & tkinter are modules in the standard lib and both
have event loops, I would have expected to find some "best practice"
solution to mixing the two. I've not used asyncio, but might find it useful
with the pynput module in the context of a Tk app. I see a few solutions
out in the wild, but this seems like something which might best be
addressed in either the asyncio or tkinter documentation, or better yet,
implemented in one or the other.

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


Re: Gunicorn - HTTP and HTTPS in the same instance?

2022-01-08 Thread Skip Montanaro
Thanks all. I was hoping to get away without something more
sophisticated like NGINX. This is just a piddly little archive of an
old mailing list running on a single-core Ubuntu VM somewhere on the
East Coast. Speed is not a real requirement. Load balancing seemed
like overkill to me. Still, I guess if it has to be, then it has to
be.

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


Gunicorn - HTTP and HTTPS in the same instance?

2022-01-07 Thread Skip Montanaro
Hopefully some Pythonistas are also Gunicornistas. I've had little success
finding help with a small dilemma in the docs or in other more specific
sources.

I'm testing out a new, small website. It is just Gunicorn+Flask. I'd like
to both listen for HTTP and HTTPS connections. Accordingly, in my config, I
have the Gunicorn process bind to both ports 80 and 443 if running as root:

if IAM_ROOT:
bind = [
'0.0.0.0:443',
'0.0.0.0:80',
]
else:
bind = [
'0.0.0.0:8080',
]

Gunicorn listens on both ports, but insists on SSL/TLS chit chat over port
80, not just port 443 (which seems to work okay). Is there some magic
incantation to get it to just talk HTTP on port 80, or will I need to spin
up two instances? (The non-root config works fine - plain old HTTP over
port 8080.)

Thx,

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


Re: email.message_from_file & quoted printable

2021-12-25 Thread Skip Montanaro
> That sometimes you want the raw content as it was in the file? That if
> you have that choice (decoded or raw) the default should be False, as it
> does less?

Yeah, thinking back later, the round-trip possibility seemed plausible.
I'll stop overthinking this now...

> That we my _first_ instinct - I've never used get_payload(), myself, and
> I've written my own complete mailfiler :-)

I'm only trying to display email through a web browser, possibly with a
link to the raw message.


> Really, if a function isn't doing what you want you should always read
> the docs for that function specificly, even if you don't want to read
> the entire module docs (which is a big ask).

Yeah, my mental model was simply off. I frequently pull up docs in my
browser. I was thinking the message contents would be normalized when
reading. It didn't occur to me the transformation would occur on the way
out.

I think another way I might have saved myself was if I was using a modern
IDE where I might have gotten some hints hovering over the method call.
But, I'm an End user. I'm sure there is some add-on package I could
install, but I haven't looked.

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


Re: email.message_from_file & quoted printable

2021-12-24 Thread Skip Montanaro
Cameron> Try decode=True.

Skip> :dopeslap: Thanks. Never been all that consistent reading documentation.

The more I think about it, the more I think maybe my lack of
documentation reading wasn't all that unreasonable. The content
transfer encoding and charset are properties of the message as a
whole. Iexpected the internal form of the message body to be already
decoded. Am I missing some key bit of perspective here?

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


Re: email.message_from_file & quoted printable

2021-12-23 Thread Skip Montanaro
>
> From the docs:
>
>  get_payload(i=None, decode=False)


...

Try decode=True.


:dopeslap: Thanks. Never been all that consistent reading documentation.

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


email.message_from_file & quoted printable

2021-12-23 Thread Skip Montanaro
I have a bunch of old email archives I'm messing around with, for example,
rendering them on-demand in HTML. Some of the files use quoted printable
content transfer encoding. Here's one (with a number of headers elided):

>From classicrendezvous-admin  Mon Dec  4 15:29:22 2000
Message-ID: <027801bfcdaa$fa175230$268cbcd4@stewart>
Reply-To: "Stewart Barrie" 
From: "Stewart Barrie" 
To: 
Date: Sat, 3 Jun 2000 23:28:00 +0100
MIME-Version: 1.0
X-StripMime: Non-text section removed by stripmime
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;charset="iso-8859-1"
Subject: {ClassicRend]Frame dent


Just inherited a nice 531 Claud Butler from the 60's I think. No =
eylelets and pencil stays. Unfortunately there is nice dent in the =
middle of the seat tube just above front mech clip height. Otherwise it = seems
fine.=20


Any thoughts on restoration? Are there any techniques for fixing dents =
in situ (I can hear the screams already) or are we definitely looking at =
a new seat tube? In which case, is it worth it?


Cheers



Stewart


--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---


This message is stored in a file. I read it using email.message_from_file.
In the example above, the payload still retains the quoted printable bits.
Maybe it's not correctly encoded (no "=20" at the end of the second
paragraph, for example), but I would have thought the email package would
do what it could to decode things, but nope:

>>> print(msg.get_payload())
Just inherited a nice 531 Claud Butler from the 60's I think. No =
eylelets and pencil stays. Unfortunately there is nice dent in the =
middle of the seat tube just above front mech clip height. Otherwise it =
seems fine.=20


Any thoughts on restoration? Are there any techniques for fixing dents =
in situ (I can hear the screams already) or are we definitely looking at =
a new seat tube? In which case, is it worth it?


Cheers



Stewart


--- StripMime Report -- processed MIME parts ---
multipart/alternative

  text/plain (text body -- kept)
  text/html
---


Am I expecting too much from the email package when munching on crufty
20+yo archived email messages?

Thx,

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


Re: Sad news: Fredrik Lundh ("Effbot") has passed away

2021-12-12 Thread Skip Montanaro
Like many others, I'm saddened to hear of Fredrik Lundh's passing. I
vaguely recall meeting him just once, probably at a Python workshop,
before they grew big enough to be called conferences. Effbot.org was
my Tkinter, ElemenTree, and PIL reference and cheat sheet.

My attention to Python development has waxed and waned over the years.
Most of the time, the trip through the Python folder in my mail
program was generally pretty quick, hitting the 'd' key far more often
than I'd stop to read a message. There are only a few people whose
messages I'd always read. Effbot was one. In my opinion, Fredrik ranks
up there with Guido, Tim Peters and Barry Warsaw.

I went to effbot.org and saw the "on hiatus" message. Searching
through The Wayback Machine, it seems it went on hiatus in late
November, 2020. The 11 November 2020 snapshot appears to be the last
usable version:

https://web.archive.org/web/2020145627/http://effbot.org/

Probably worth a bookmark in your browser.

Rest easy /F ...

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


Proliferation of Python packaging formats

2021-11-17 Thread Skip Montanaro
Is the proliferation of packaging formats in Python as nutzo as this author
believes?

https://drewdevault.com/2021/11/16/Python-stop-screwing-distros-over.html

Asking because I've never been in the business of releasing "retail" Python
applications or packages.

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


[issue23041] csv needs more quoting rules

2021-11-09 Thread Skip Montanaro


Skip Montanaro  added the comment:

Further question... All the discussion has been on the writer side of the csv 
module. Is there any reason that using QUOTE_STRINGS or QUOTE_NOTNULL should 
have an effect when reading? For example, should this line on input

"",,1,'a'

produce this list

["", None, "1", "a"]

with QUOTE_NOTNULL in effect, and

["", "", 1, "a"]

or

["", None, 1, "a"]

with QUOTE_STRINGS in effect?

--

___
Python tracker 
<https://bugs.python.org/issue23041>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23041] csv needs more quoting rules

2021-11-08 Thread Skip Montanaro


Skip Montanaro  added the comment:

Note to @samwyse and @krypten: I updated the patches and created a pull request 
on GitHub, but I have no way of knowing if at least krypten has signed a CLA 
for Python. Since you're the author of the original patches, we need to verify 
that you have.

--

___
Python tracker 
<https://bugs.python.org/issue23041>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23041] csv needs more quoting rules

2021-11-08 Thread Skip Montanaro


Change by Skip Montanaro :


--
pull_requests: +27722
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/29469

___
Python tracker 
<https://bugs.python.org/issue23041>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45745] ./python -m test --help output for refleaks seems wrong

2021-11-08 Thread Skip Montanaro


Skip Montanaro  added the comment:

Thanks, I get that. My issue is with the apparent mismatch between the English 
meaning of "find leaks" and "fail env changed." It seems to me that the help 
message(s) for one or both of those options is probably incorrect and needs to 
be changed.

--

___
Python tracker 
<https://bugs.python.org/issue45745>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45745] ./python -m test --help output for refleaks seems wrong

2021-11-07 Thread Skip Montanaro


New submission from Skip Montanaro :

Just preparing to make a refleaks test run, so I ran:

./python -m test --help

The output related to refleaks seemed suspicious:

...
Special runs:
  -l, --findleaks   deprecated alias to --fail-env-changed
...
  --fail-env-changedif a test file alters the environment, mark the test as 
failed

It's not obvious that "--fail-env-changed" has anything to do with 
"--findleaks". Does the -l/--findleaks message need to be corrected?

--
components: Build
messages: 405916
nosy: skip.montanaro
priority: normal
severity: normal
status: open
title: ./python -m test --help output for refleaks seems wrong
versions: Python 3.11

___
Python tracker 
<https://bugs.python.org/issue45745>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45714] test_multiprocessing_spawn hangs sometimes

2021-11-04 Thread Skip Montanaro


Skip Montanaro  added the comment:

Took me a while to notice the -i flag to regrtest.py. I think that solves my 
particular problem, so I will close this. Is there a place to see how 'make 
test' is run on the buildbots?

--
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue45714>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45714] test_multiprocessing_spawn hangs sometimes

2021-11-04 Thread Skip Montanaro


New submission from Skip Montanaro :

I find that test_multiprocessing_spawn frequently hangs. Hitting Ctl-C then 
rerunning "make test" generally works. Still, this behavior makes it 
problematic to run testing unattended. I don't think I have an unusual 
environment (XUbuntu 20.04, GCC 9.3.0). Here's some output from the currently 
running/hanging process, just after the last other unit test completed.

0:03:42 load avg: 4.96 [421/422/21] test_concurrent_futures passed (2 min 57 
sec) -- running: test_multiprocessing_spawn (2 min 59 sec)
0:04:12 load avg: 3.19 running: test_multiprocessing_spawn (3 min 29 sec)
0:04:42 load avg: 1.93 running: test_multiprocessing_spawn (3 min 59 sec)
0:05:12 load avg: 1.23 running: test_multiprocessing_spawn (4 min 29 sec)
0:05:42 load avg: 0.74 running: test_multiprocessing_spawn (4 min 59 sec)
...
0:22:12 load avg: 0.42 running: test_multiprocessing_spawn (21 min 29 sec)
0:22:42 load avg: 0.27 running: test_multiprocessing_spawn (21 min 59 sec)
0:23:12 load avg: 0.37 running: test_multiprocessing_spawn (22 min 29 sec)

I'm currerntly mostly messing around with the nogil code and 3.9 tip, but I've 
noticed this problem on other branches as well. The fact that this seems not to 
have been reported before suggests that I'm somehow an outlier. If it was 
common, my guess is that the buildbots would experience this problem on a 
regular basis.

Here is the current python process info (output of pgrep -fla python).

1572195 /home/skip/src/python/cpython/python -u -W default -bb -E -m test -r -w 
-j 0 -u all,-largefile,-audio,-gui
1575193 /home/skip/src/python/cpython/python -bb -E -Wdefault -u -m 
test.regrtest --worker-args [{"testdir": null, "verbose": 0, "quiet": false, 
"exclude": false, "single": false, "randomize": true, "fromfile": null, 
"findleaks": 1, "use_resources": ["curses", "network", "decimal", "cpu", 
"subprocess", "urlfetch"], "trace": false, "coverdir": "coverage", "runleaks": 
false, "huntrleaks": false, "verbose2": true, "print_slow": false, 
"random_seed": 2495022, "use_mp": 10, "verbose3": false, "forever": false, 
"header": false, "failfast": false, "match_tests": null, "ignore_tests": null, 
"pgo": false, "timeout": null, "wait": false, "worker_args": null, "start": 
null, "match_filename": null, "ignore_filename": null, "use": [["all", 
"-largefile", "-audio", "-gui"]], "memlimit": null, "threshold": null, 
"nowindows": false, "list_tests": false, "list_cases": false, "pgo_extended": 
false, "fail_env_changed": false, "xmlpath": null, "tempdir": 
"/home/skip/src/python/cpython/build/test_python_1
 572195", "cleanup": false, "args": []}, "test_multiprocessing_spawn"]
1575489 /home/skip/src/python/cpython/python -bb -E -Wdefault -c from 
multiprocessing.resource_tracker import main;main(3)
1575547 /home/skip/src/python/cpython/python -bb -E -Wdefault -c from 
multiprocessing.forkserver import main; main(6, 7, ['__main__', 
'test.test_multiprocessing_forkserver'], **{'sys_path': 
['/home/skip/src/python/cpython', 
'/home/skip/tmp/nogilpgo_build/lib/python39.zip', 
'/home/skip/src/python/cpython/Lib', 
'/home/skip/src/python/cpython/build/lib.linux-x86_64-3.9', 
'/home/skip/.local/lib/python3.9/site-packages', 
'/home/skip/tmp/nogilpgo_build/lib/python3.9/site-packages']})
1589033 /home/skip/src/python/cpython/python -bb -E -Wdefault -c from 
multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=4, 
pipe_handle=12) --multiprocessing-fork
1589034 /home/skip/src/python/cpython/python -bb -E -Wdefault -c from 
multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=4, 
pipe_handle=14) --multiprocessing-fork

At the moment I can't pstack either of the last two processes. Unfortunately, I 
think I need to tweak ptrace.conf and reboot.

--
messages: 405718
nosy: skip.montanaro
priority: normal
severity: normal
status: open
title: test_multiprocessing_spawn hangs sometimes

___
Python tracker 
<https://bugs.python.org/issue45714>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45638] Does ccbench still require 2.6 compatibility?

2021-11-02 Thread Skip Montanaro


Skip Montanaro  added the comment:

CCbench was mentioned recently in the discussion about Sam Gross's nogil branch:

https://mail.python.org/archives/list/python-...@python.org/message/WRT7F2RHHCQ3N2TYEDC6JSIJ4T2ZM6F7/

I'm not convinced that deleting it is a no-brainer. Maybe if it landed 
somewhere generally useful (pyperformance?).

--

___
Python tracker 
<https://bugs.python.org/issue45638>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45669] An 'ascii_alphanumerics' variable is missing in the 'strings' lib

2021-10-30 Thread Skip Montanaro


Skip Montanaro  added the comment:

I'll be the wet blanket here and say -1. This doesn't seem at all necessary. 81 
occurrences in ~3.5k PyPI packages? That's a hardly overwhelming endorsement. 
To top it off, since this can't be backported to 3.10 and earlier, it creates a 
needless (trivial) difference. Package authors who would like to use this but 
support earlier versions of Py3 will need to do something like this:

try:
from string import ascii_alphanumerics
except ImportError:
ascii_alphanumerics = string.ascii_letters + string.digits

They get no benefit from the addition. In fact, their code gets marginally 
harder to read.

--
nosy: +skip.montanaro

___
Python tracker 
<https://bugs.python.org/issue45669>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45638] Does ccbench still require 2.6 compatibility?

2021-10-27 Thread Skip Montanaro


New submission from Skip Montanaro :

At the top of Tools/ccbench/ccbench.py is this comment dating from 2010 
(probably in the initial version):

# This file should be kept compatible with both Python 2.6 and Python >= 3.0.

Is there still a need for 2.6 compatibility in what is essentially a test 
script? There are probably only a few changes necessary to remove 2.x 
compatibility, but it seems odd to retain them when even the Python library 
documentation no longer has versionchanged/versionadded directives referencing 
Python 2.x.

--
messages: 405141
nosy: skip.montanaro
priority: normal
severity: normal
status: open
title: Does ccbench still require 2.6 compatibility?
versions: Python 3.11

___
Python tracker 
<https://bugs.python.org/issue45638>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Package conflicts trying to install jpegdupes package

2021-09-27 Thread Skip Montanaro
Woo hoo! It's installed. The ultimate error was a missing turbojpeg.h
file. Thank goodness for the apt-file command. I was able to track
that down to the libturbojpeg0-dev package, install that, and after a
bit more fussing around now have jpegdupes installed.

Thanks for the help,

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


Re: Package conflicts trying to install jpegdupes package

2021-09-27 Thread Skip Montanaro
>
> For the most part, a proper colorizing compiler can make the
> errors stand out among the spam of warnings, but it's hard when people
> copy and paste just the text.
>

In my defense, the entire traceback was red. :-) It's quite possible that
GCC colorized its error/warning messages, but colorizing might have been
suppressed by stderr being fed into a pipe, or by distutils tossing it out.

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


Re: Package conflicts trying to install jpegdupes package

2021-09-27 Thread Skip Montanaro
>
> Those are all warnings. Are there any errors that follow them?
>

Maybe I just missed the actual errors, but the compiler exit status was 1,
so there must have been. I'll give it another try.


The package doesn't seem to have had a release since 2018, but the
> GitHub repository has had changes as recently as a month ago. You
> might have better luck cloning the repo and building that.
>

Thanks, good suggestion.

FWIW, I'm trying to whittle down at least 12,000 images to a more
manageable number for the sister of a good friend who recently passed away.
I've got a straightforward dedupe program, but need something which can
compare just the data chunk of JPEGs, ignoring the metadata. This program
apparently does that. Is like to avoid reinventing that wheel.

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


Package conflicts trying to install jpegdupes package

2021-09-27 Thread Skip Montanaro
I'd like to use the jpegdupes package <https://pypi.org/project/jpegdupes/> but
can't seem to get past compilation issued related to jpegtrans-cffi.
Attempts to install any available versions on my XUbuntu system crap out
with this C compiler error message:

 In file included from
jpegtran/__pycache__/_cffi__xd2d84bdexcdb1023.c:267:
src/epeg_private.h:71:17: warning: ‘_jpeg_init_source’ declared
‘static’ but never defined [-Wunused-function]
   71 | METHODDEF(void) _jpeg_init_source(j_decompress_ptr cinfo);
  | ^
src/epeg_private.h:72:20: warning: ‘_jpeg_fill_input_buffer’ declared
‘static’ but never defined [-Wunused-function]
   72 | METHODDEF(boolean) _jpeg_fill_input_buffer(j_decompress_ptr
cinfo);
  |^~~
src/epeg_private.h:73:17: warning: ‘_jpeg_skip_input_data’ declared
‘static’ but never defined [-Wunused-function]
   73 | METHODDEF(void) _jpeg_skip_input_data(j_decompress_ptr cinfo,
long num_bytes);
  | ^
src/epeg_private.h:74:17: warning: ‘_jpeg_term_source’ declared
‘static’ but never defined [-Wunused-function]
   74 | METHODDEF(void) _jpeg_term_source(j_decompress_ptr cinfo);
  | ^
src/epeg_private.h:76:17: warning: ‘_jpeg_init_destination’ declared
‘static’ but never defined [-Wunused-function]
   76 | METHODDEF(void) _jpeg_init_destination(j_compress_ptr cinfo);
  | ^~
src/epeg_private.h:77:20: warning: ‘_jpeg_empty_output_buffer’ declared
‘static’ but never defined [-Wunused-function]
   77 | METHODDEF(boolean) _jpeg_empty_output_buffer (j_compress_ptr
cinfo);
  |^
src/epeg_private.h:78:17: warning: ‘_jpeg_term_destination’ declared
‘static’ but never defined [-Wunused-function]
   78 | METHODDEF(void) _jpeg_term_destination (j_compress_ptr cinfo);
  | ^~

...
This seems like a rather odd error message for a presumably sort-of-stable
PyPI package. Looking at the version dependencies I see 2.6, 2.7, 3.3 or
PyPy. I thought nmybe I needed to try with Python2... Create a Conda
environment, attempt to install jpegdupes, only to discover it's Python 3
only.

So, I'm kind of stuck. Maybe I need to install Python 3.3 and try that? Any
other ideas?

Thx,

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


[issue23041] csv needs more quoting rules

2021-09-10 Thread Skip Montanaro


Skip Montanaro  added the comment:

Update version - too late for anything older than 3.11.

--
versions:  -Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 
<https://bugs.python.org/issue23041>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Track 3.9 instead of 3.10?

2021-07-27 Thread Skip Montanaro
I have a development branch in my fork of python/cpython, the
register2 branch of https://github.com/smontanaro/cpython. As I am
dealing with virtual machine internals I've found the changes to the
virtual machine between 3.9 and 3.10 too disruptive. I'd like to track
3.9 instead. How would I go about making the switch while minimizing
the number of (inevitable) conflicts? I was thinking of diffing my
current state against 3.10, then creating a new branch off 3.9 and
applying the diff to that. That makes most of the effort outside of
the view of git though, and won't necessarily minimize conflicts. Is
there some way to do this totally within the git infrastructure?

Thx,

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


[issue43941] Unit test failure in test_gdb only with -O0

2021-07-07 Thread Skip Montanaro


Skip Montanaro  added the comment:

Unfortunately, I'm currently not able to build Python 3.8, 3.9 or 3.10 and get 
a non-failing test_gdb. I'll mess around a bit more, but I'm skeptical I'll 
find something simple. (I wonder if something changed in GDB which is causing 
the failure.)

--

___
Python tracker 
<https://bugs.python.org/issue43941>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43941] Unit test failure in test_gdb only with -O0

2021-07-07 Thread Skip Montanaro


Skip Montanaro  added the comment:

I routinely build with -O0 and have been getting test_gdb failures building the 
3.10 branch. I tried adding -g3 to my configure flags:

nice ./configure OPT="-O0 -g3 -Wall" --with-pydebug --with-trace-refs

but test_gdb still fails. Output attached. Note that I have been getting CRC 
mismatches between a couple files. They are copious in the test output, so I 
won't elaborate here.

--
nosy: +skip.montanaro
Added file: https://bugs.python.org/file50140/test_gdb.out

___
Python tracker 
<https://bugs.python.org/issue43941>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43625] CSV has_headers heuristic could be improved

2021-06-29 Thread Skip Montanaro


Skip Montanaro  added the comment:

Here's a NEWS entry.

--
Added file: 
https://bugs.python.org/file50132/2021-06-29-07-27-08.bpo-43625.ZlAxhp.rst

___
Python tracker 
<https://bugs.python.org/issue43625>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43625] CSV has_headers heuristic could be improved

2021-06-29 Thread Skip Montanaro


Skip Montanaro  added the comment:

Here is a change to the has_header documentation and an extra test case 
documenting the behavior when the sample contains strings. I'm not sure about 
the wording of the doc change, perhaps you can tweak it? Seems kind of clumsy 
to me. If it seems okay to you @andrei.avk, can you fold it into your PR?

--
Added file: https://bugs.python.org/file50131/hasheader.diff

___
Python tracker 
<https://bugs.python.org/issue43625>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43625] CSV has_headers heuristic could be improved

2021-06-29 Thread Skip Montanaro


Skip Montanaro  added the comment:

I retract my comment about fixed length strings in the non-numeric case. There 
are clearly test cases (which I probably wrote, considering the values) where 
the sample as a header but the values are of varying length. Misread of the 
code on my part. I have obviously not had enough coffee yet this morning.

--

___
Python tracker 
<https://bugs.python.org/issue43625>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43625] CSV has_headers heuristic could be improved

2021-06-29 Thread Skip Montanaro


Skip Montanaro  added the comment:

Thanks @andrei.avk. You are right, only the complex test is required.

I suppose it's okay to commit this, but reviewing the full code of the 
has_header method leaves me thinking this is just putting lipstick on a pig. If 
I read the code correctly, there are two (undocumented) tacit assumptions:

1. The non-header values are numeric.

2. If not numeric, they are fixed length strings whose length generally differs 
from the length of the putative header.

The second criterion means this has a header:

ab,de
ghi,jkl
ghi,jkl

but this doesn't:

abc,def
ghi,jkl
ghi,jkl

It seems to me that it would be a good idea to at least expand on the 
documentation of that method and maybe add at least one test case where the CSV 
sample doesn't have a header. I'll try to get that done and attach a patch.

--
versions: +Python 3.11 -Python 3.7

___
Python tracker 
<https://bugs.python.org/issue43625>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23041] csv needs more quoting rules

2021-06-28 Thread Skip Montanaro


Skip Montanaro  added the comment:

Ugh... s/QUOTE_NONNULL/QUOTE_NOTNULL/

Not, Non, None... Perl would treat them all the same, right? 

--

___
Python tracker 
<https://bugs.python.org/issue23041>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23041] csv needs more quoting rules

2021-06-28 Thread Skip Montanaro


Skip Montanaro  added the comment:

Missed tweaking a couple settings.

--
resolution: rejected -> 
stage: resolved -> needs patch
versions: +Python 3.11 -Python 3.8

___
Python tracker 
<https://bugs.python.org/issue23041>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23041] csv needs more quoting rules

2021-06-28 Thread Skip Montanaro


Skip Montanaro  added the comment:

Okay, I'll reopen this, at least for the discussion of QUOTE_NONNULL. 
@erdnaxeli please given an example of how PostgreSQL distinguishes between the 
empty string and None cases. Is it a quoted empty string vs an empty field? If 
so, modifying @samwyse's original example, is this what you are after?

>>> csv.register_dialect('quote_notnull', quoting=csv.QUOTE_NOTNULL)
>>> csv.writer(sys.stdout, dialect='quote_notnull').writerow(['', None, 42])
"",,"42"

? Can you modify the original two patches to restrict to QUOTE_NONNULL?

--
status: closed -> open

___
Python tracker 
<https://bugs.python.org/issue23041>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: imaplib: is this really so unwieldy?

2021-05-25 Thread Skip Montanaro
> It's working (with Cyrus), but I have the feeling I'm doing it all wrong
> because it seems so unwieldy.

I have a program, Polly <https://github.com/smontanaro/polly>, which I
wrote to generate XKCD 936 passphrases. (I got the idea - and the name -
from Chris Angelico. See the README.) It builds its dictionary from emails
in my Gmail account which are tagged "polly" by a Gmail filter. I had put
it away for a few years, at which time it was still using Python 2. When I
came back to it, I wanted to update it to Python 3. As with so many 2-to-3
ports, the whole bytes/str problem was my stumbling block. Imaplib's API
(as you've discovered) is not the most Pythonic. I didn't spend much time
horsing around with it. Instead, I searched for higher-level packages,
eventually landing on IMAPClient <https://pypi.org/project/IMAPClient/>.
Once I made the switch, things came together pretty quickly, due in large
part, I think, to its more sane API.

YMMV, but you're more than welcome to steal code from Polly.

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


[issue44058] 'master' refs in 3.10 version of .azure-pipelines

2021-05-07 Thread Skip Montanaro


Skip Montanaro  added the comment:

Perhaps I should point out that this doesn't matter to me. I just noticed the 
old name. I can't claim anything is broken that I need.

--

___
Python tracker 
<https://bugs.python.org/issue44058>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Bloody rubbish

2021-05-06 Thread Skip Montanaro
>
> Machine language is so much simpler, and you can code with just a hexpad.
>

Pshaa... All you need are front panel switches. ;-) (Yes, I had a professor
who required is to 'key' in our programs on the front panel, of a rack
mounted PDP-11 as I recall. Needless to say, we didn't use an assembler
either. We just wrote raw opcodes and their arguments on paper. This was in
the late 70s.)

Skip

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


Re: Proposal: Disconnect comp.lang.python from python-list

2021-05-06 Thread Skip Montanaro
> > Not that I support shutting down the Usenet/email gateway -- the
> > signal/noise ration seems fine to me.
> >
> On that I quite agree.  :-)

I remind people that the existing Usenet<->Mail gateway keeps the
mailing list software on mail.python.org from migrating to Mailman 3.
I'm sure Mark Sapiro and other Mailman maintainers would like to keep
moving away from Mailman 2. If the gateway (easier anonymity) and
Mailman 3 (maybe better list archives) are of interest to you, you
might check in with the Mailman dev list and see what would be
involved in porting the gateway code to MM3.

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


[issue44060] Define TARGET macro the same even when computed goto support is not enabled

2021-05-06 Thread Skip Montanaro


Change by Skip Montanaro :


--
keywords: +patch
pull_requests: +24612
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/25949

___
Python tracker 
<https://bugs.python.org/issue44060>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44060] Define TARGET macro the same even when computed goto support is not enabled

2021-05-06 Thread Skip Montanaro

New submission from Skip Montanaro :

When the interpreter is compiled with computed goto support, the TARGET macro 
is defined like this:

#define TARGET(op) op: TARGET_##op

If computed gotos are disabled, the implementation is simpler:

#define TARGET(op) op

I'm finding it useful to use those labels as gdb breakpoint targets. Is there 
some reason not to always define the TARGET_##op label?

--
components: Interpreter Core
messages: 393099
nosy: skip.montanaro
priority: normal
severity: normal
status: open
title: Define TARGET macro the same even when computed goto support is not 
enabled
type: enhancement
versions: Python 3.11

___
Python tracker 
<https://bugs.python.org/issue44060>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44058] 'master' refs in 3.10 version of .azure-pipelines

2021-05-06 Thread Skip Montanaro


New submission from Skip Montanaro :

Should these references to "master" be changed to "main"?

% git co 3.10
Switched to branch '3.10'
Your branch is up to date with 'origin/3.10'.
% egrep master .azure-pipelines/*
.azure-pipelines/ci.yml:trigger: ['master', '3.10', '3.9', '3.8', '3.7']
.azure-pipelines/pr.yml:pr: ['master', '3.10', '3.9', '3.8', '3.7']

--
messages: 393092
nosy: skip.montanaro
priority: normal
severity: normal
status: open
title: 'master' refs in 3.10 version of .azure-pipelines
versions: Python 3.10

___
Python tracker 
<https://bugs.python.org/issue44058>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Proposal: Disconnect comp.lang.python from python-list

2021-05-06 Thread Skip Montanaro
> Are you saying that the messages that appear occasionally from people
> such as Ethan Furman claiming to be moderators and alleging that
> particular people have been banned or suspended are lies? And that the
> message I received once saying that my comp.lang.python post had been
> rejected from the list was also a lie?

I'm sorry, but I don't recall accusing you of lying, neither in my
words nor in my thoughts. If you think I was doing that, you must be
reading everything with a very jaundiced eye.

My issue was that we seem to disagree with the definition of
"moderation." Earlier in this thread it was suggested that
comp.lang.python.moderated be created and that some as-yet-unnamed
moderators would vet every single message to that group. I think of
moderation as things which humans do, not tool chains. I suppose the
python.org postmasters could disable all elements of that tool chain
and let the admins/moderators do it all manually. Still, I don't think
of the mailing list as moderated. Yes, Ethan is one of three listed
admins of the list. I wouldn't have mentioned him by name, but you
did. (I suppose his role common knowledge anyway.)

I see three held messages in the queue right now with received times
between 00:33 to 08:15 today (timezone isn't mentioned). I seriously
doubt Ethan or the other admins approved all the other messages which
have reached the list in that interval. Despite the existing tool
chain, a number of messages which shouldn't probably leak through
without being vetted by Ethan or the other admins.

I will offer one other bit of information. As I understand it, the
only reason python-list@python.org can't be migrated to Mailman 3 is
because it doesn't support the gateway between Usenet and mail. It's
worth considering for people thinking about whether or not to
disconnect the two. (I have no opinion on that subject. Clearly others
do.)

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


Re: Proposal: Disconnect comp.lang.python from python-list

2021-05-06 Thread Skip Montanaro
> Are you unaware that the group is already gatewayed to a moderated
> mailing list for which all of that work is already done?

What is this moderation of which you speak? I'm one of the Python
postmasters (I maintain the SpamBayes setup) and am aware of a
multi-part tool chain (black hole lists, SpamBayes, greylisting, etc),
but not of human moderation on a grand scale, just of the relatively
few posts which are held for the admins/moderators by SpamBayes. My
definition of "moderation" is that a human vets every post. That's
certainly not the case for python-list@python.org. Posts gated from
comp.lang.python to the mailing list only get passed through
SpamBayes. All other elements of the tool chain occur ahead of the
gateway.

If we are using two different definitions of "moderation" I think it
is important to be clear what we mean.

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


[issue41111] [C API] Convert a few stdlib extensions to the limited C API (PEP 384)

2021-04-06 Thread Skip Montanaro


Skip Montanaro  added the comment:

>
> Skip: By the way, I'm curious, why do you use --with-trace-refs?
>

I'm still horsing around with register opcodes and got in the habit of
building with pydebug and trace refs enabled.

--

___
Python tracker 
<https://bugs.python.org/issue4>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: About \033[m

2021-04-04 Thread Skip Montanaro
>Porque quando se usa formatac,ao de cores, o python nao consegue
>
   centralizar dentro da cadeia de 40 caracteres ?
>
>Tive que colocar 54 no parametro pois de alguma forma esta sendo
>considerado os caracteres de dentro do comando \033[m


Python doesn't know there is anything special about escape sequences (that
they take up no space on the screen). I think you will have better results
if you place the escape sequences in the format specifier:

 print("\033[7;30;43m{:^40}\033[m".format("Programac,ao Python"))

( haven't tried this, but I think it will work as you expect.)

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


[issue41111] [C API] Convert a few stdlib extensions to the limited C API (PEP 384)

2021-04-03 Thread Skip Montanaro


Skip Montanaro  added the comment:

I should revise that comment. The xxlimited and xxlimited_35 modules fail to 
build. That seems suboptimal, but perhaps is to be expected. Perhaps it would 
be better that compiling them not be attempted with configuring 
--with-trace-refs?

--

___
Python tracker 
<https://bugs.python.org/issue4>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41111] [C API] Convert a few stdlib extensions to the limited C API (PEP 384)

2021-04-03 Thread Skip Montanaro


Skip Montanaro  added the comment:

The latest commit seems to break the build if configured --with-trace-refs.

--
nosy: +skip.montanaro

___
Python tracker 
<https://bugs.python.org/issue4>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Code Formatter Questions

2021-03-28 Thread Skip Montanaro
> 1) Are there any major other formatters that I can/should look at? I see some 
> "online" pretty printers, but I'm after something I can run on whole 
> recursive directories of code.

I use Emacs, so I'm kind of biased, but I find its python-mode does a
good job, good enough that I wouldn't use a batch formatter to conform
to some other conventions, then wind up having a mixed set of
conventions after my next edit. I presume vim and all IDEs worth their
salt also do a suitable job of formatting code on-the-fly.

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


[issue43627] What are the requirements for a test_sundry-testable script in Tools/scripts?

2021-03-25 Thread Skip Montanaro


Change by Skip Montanaro :


--
title: What are the requirements for a test_sunry-testable script in 
Tools/scripts? -> What are the requirements for a test_sundry-testable script 
in Tools/scripts?

___
Python tracker 
<https://bugs.python.org/issue43627>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43625] CSV has_headers heuristic could be improved

2021-03-25 Thread Skip Montanaro


Skip Montanaro  added the comment:

I assume the OP is referring to this sort of usage:

>>> sniffer = csv.Sniffer()
>>> raw = open("mixed.csv").read()
>>> sniffer.has_header(raw)
False

*sigh*

I really wish the Sniffer class had never been added to the CSV module. I can't 
recall who wrote it (the author is long gone). Though I am responsible for the 
initial commits, it wasn't me or the main authors of csvmodule.c. As far as I 
know, it never really worked well. I can't recall ever using it.

A simpler heuristic would be if the first row contains a bunch of strings and 
the second row contains a bunch of numbers, then the file has a header. That 
assumes that CSV files consist mostly of numeric data.

Looking at has_header, I see this:

for thisType in [int, float, complex]:

I think this particular problem would be solved if the order of those types 
were reversed. The attached diff suggests that as well. Note that the Sniffer 
class currently contains no test cases, so that the test I added failed before 
the change and passes after doesn't mean it doesn't break someone's mission 
critical Sniffer usage.

(Sorry, Raymond. My Github-foo is insufficient to allow me to fork, apply the 
diff and create a PR.)

--
keywords: +patch
Added file: https://bugs.python.org/file49915/csv.diff

___
Python tracker 
<https://bugs.python.org/issue43625>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   3   4   5   6   7   8   9   10   >