Re: PEP about recommended project folder layout

2022-07-31 Thread Weatherby,Gerard
I’m not aware of any standard convention for laying out packages.

PEP 8 (https://peps.python.org/pep-0008/) specifies conventions for how to 
write Python, so a standard layout PEP would not be inconsistent.

—
Gerard Weatherby | Application Architect NMRbox | NAN | Department of Molecular 
Biology and Biophysics
 UConn Health 263 Farmington Avenue, Farmington, CT 06030-6406 uchc.edu
On Jul 30, 2022, 4:37 PM -0400, Barry , wrote:
*** Attention: This is an external email. Use caution responding, opening 
attachments or clicking on links. ***

On 30 Jul 2022, at 13:52, [email protected] wrote:

Isn't there a PEP?

PEP are for improving python. They are not for telling people how to use python.
I would be surprised to fine a PEP that addressed this.

Barry


On 2022-07-26 07:14 [email protected] wrote:
Hello,

I am not sure if I looked into the correct sources. I was looking in
"PEP 609 – Python Packaging Authority (PyPA) Governance" [1] and the
"PyPA specifications" [2].

My question in short: Is there an official document (e.g. a PEP)
about a recommended layout for project folders.

Looking into the wild and past there are a lot of variations of such
layouts. I am far away from being a pro but depending on experience
in my own projects and what I have learned from others (e.g. in
blog-posts/tutorials) I recommend to have the "test" folder and the
package folder side by side on the same level in the project folder
(the root).

my_project
|- tests
| └ test_*.py
|- my_package
| └ __init__.py
└-- README.md

I sometimes add to it the so called "src"-Layout where the package
folder is one level deeper in an extra "src" folder.

my_project
|- tests
| └ test_*.py
|- src
| └- my_package
| └ __init__.py
└-- README.md

I don't want to discuss the pros and cons of all variations. What I
need is an official document I can use in discussions with other
maintainers. If there is a PEP/document against my current
recommendation I am also fine with this. ;)

Kind
Christian

[1] -- 

[2] -- 


--
https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!ipqSQS5_ZFxO37h5h5XALf2DxE3eV-x6qNSrVnKJU3cLZIkLfKhuTzSxi1fb-BvYNVPXeT-nYFX8ogse6_J2Hg$

--
https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!ipqSQS5_ZFxO37h5h5XALf2DxE3eV-x6qNSrVnKJU3cLZIkLfKhuTzSxi1fb-BvYNVPXeT-nYFX8ogse6_J2Hg$
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PEP about recommended project folder layout

2022-07-31 Thread Chris Angelico
On Sun, 31 Jul 2022 at 20:27, Weatherby,Gerard  wrote:
>
> I’m not aware of any standard convention for laying out packages.
>
> PEP 8 (https://peps.python.org/pep-0008/) specifies conventions for how to 
> write Python, so a standard layout PEP would not be inconsistent.
>

PEP 8 species rules for laying out the code of the Python standard
library. Its adoption by other projects does not constitute the Python
developers declaring that it's a convention for how to write all
Python code.

A better example would be PEP 257 https://peps.python.org/pep-0257/
but even that is more for the purpose of tooling. It does at least try
to describe usage conventions, though.

Conventions for laying out packages (as opposed to actual requirements
defined by the packaging system itself) would be better described
somewhere other than a PEP.

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


Re: Simple TCP proxy

2022-07-31 Thread Morten W. Petersen
Well, initially I was just curious.

As the name implies, it's a TCP proxy, and different features could go into
that.

I looked at for example port knocking for hindering unauthorized access to
the (protected) TCP service SMPS, but there you also have the possibility
of someone eavesdropping, and learning the right handshake, if you will.
So it's something that will work, until someone gets determined to make a
mess.

In short, it will give better control than backlog does, enabling
Python-style code and logic to deal with different situations.

I was about to say "deal with things intelligently"; but I think
"intelligent" is a word that doesn't fit here or in many other applications.

Say for example this service comes under attack for unknown reasons; it
could be possible to teach the proxy to only accept connections to the
backend server for IP addresses / subnets that have previously n number of
transmissions back and forth.  If you know that the service will have max
50 different clients.

Anyway, what Chris said earlier, I think we can file that under "eagerness
to tech others and show what you know".  Right Chris? :)

Regards,

Morten

On Sat, Jul 30, 2022 at 10:31 PM Barry  wrote:

>
>
>
> > On 30 Jul 2022, at 20:33, Morten W. Petersen  wrote:
> > I thought it was a bit much.
> >
> > I just did a bit more testing, and saw that the throughput of wget
> through
> > regular lighttpd was 1,3 GB/s, while through STP it was 122 MB/s, and
> using
> > quite a bit of CPU.
> >
> > Then I increased the buffer size 8-fold for reading and writing in
> run.py,
> > and the CPU usage went way down, and the transfer speed went up to 449
> MB/s.
>
> You are trading latency for through put.
>
> >
> > So it would require well more than a gigabit network interface to max out
> > STP throughput; CPU usage was around 30-40% max, on one processor core.
>
> With how many connections?
>
> >
> > There is good enough, and then there's general practice and/or what is
> > regarded as an elegant solution.  I'm looking for good enough, and in the
> > process I don't mind pushing the envelope on Python threading.
>
> You never did answer my query on why a large backlog is not good enough.
> Why do you need this program at all?
>
> Barry
> >
> > -Morten
> >
> > On Sat, Jul 30, 2022 at 12:59 PM Roel Schroeven 
> > wrote:
> >
> >> Morten W. Petersen schreef op 29/07/2022 om 22:59:
> >>> OK, sounds like sunshine is getting the best of you.
> >> It has to be said: that is uncalled for.
> >>
> >> Chris gave you good advice, with the best of intentions. Sometimes we
> >> don't like good advice if it says something we don't like, but that's no
> >> reason to take it off on the messenger.
> >>
> >> --
> >> "Iceland is the place you go to remind yourself that planet Earth is a
> >> machine... and that all organic life that has ever existed amounts to a
> >> greasy
> >> film that has survived on the exterior of that machine thanks to furious
> >> improvisation."
> >> -- Sam Hughes, Ra
> >>
> >> --
> >> https://mail.python.org/mailman/listinfo/python-list
> >
> >
> > --
> > I am https://leavingnorway.info
> > Videos at https://www.youtube.com/user/TheBlogologue
> > Twittering at http://twitter.com/blogologue
> > Blogging at http://blogologue.com
> > Playing music at https://soundcloud.com/morten-w-petersen
> > Also playing music and podcasting here:
> > http://www.mixcloud.com/morten-w-petersen/
> > On Google+ here https://plus.google.com/107781930037068750156
> > On Instagram at https://instagram.com/morphexx/
> > --
> > https://mail.python.org/mailman/listinfo/python-list
>
>

-- 
I am https://leavingnorway.info
Videos at https://www.youtube.com/user/TheBlogologue
Twittering at http://twitter.com/blogologue
Blogging at http://blogologue.com
Playing music at https://soundcloud.com/morten-w-petersen
Also playing music and podcasting here:
http://www.mixcloud.com/morten-w-petersen/
On Google+ here https://plus.google.com/107781930037068750156
On Instagram at https://instagram.com/morphexx/
-- 
https://mail.python.org/mailman/listinfo/python-list


Register multiple excepthooks?

2022-07-31 Thread Albert-Jan Roskam
   Hi,
   I have a function init_logging.log_uncaught_errors() that I use for
   sys.excepthook. Now I also want to call another function (ffi.dlclose())
   upon abnormal termination. Is it possible to register multiple
   excepthooks, like with atexit.register? Or should I rename/redefine
   log_uncaught_errors() so it does both things?
   Thanks!
   Albert-Jan
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: Register multiple excepthooks?

2022-07-31 Thread avi.e.gross
Albert-Jan,

Unless there is something special in your scenario, aren't there many ways
within python proper to create functions that effectively call another
function or more as needed? Think decorators as one example.

Of course if the caller expects some specific result when it calls your
function, running a single function that returns say the value of the last
thing it does, may not meet your needs. 

Now assuming all your functions take the same required argument and do not
in any way tamper with the argument, you could indeed define a function that
accepts arguments and internally calls one after another other functions in
some order and intercepts anything they return (or errors) and consolidates
them as needed and returns a result. I suspect there is a module that
provides such functionality.




-Original Message-
From: Python-list  On
Behalf Of Albert-Jan Roskam
Sent: Sunday, July 31, 2022 5:40 AM
To: [email protected]
Subject: Register multiple excepthooks?

   Hi,
   I have a function init_logging.log_uncaught_errors() that I use for
   sys.excepthook. Now I also want to call another function (ffi.dlclose())
   upon abnormal termination. Is it possible to register multiple
   excepthooks, like with atexit.register? Or should I rename/redefine
   log_uncaught_errors() so it does both things?
   Thanks!
   Albert-Jan
-- 
https://mail.python.org/mailman/listinfo/python-list

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