MTG: pytest (NZPUG, Auckland, VacExcHndlrs)

2024-01-31 Thread dn via Python-list
Wed 7 Feb (evening NZDT) will be the last virtual gathering in the 
current Vacation Exception Handlers (VacExcHndlrs) series 
(https://danceswithmice.info/Python/2024/VacExcHndlrs.html).


You are cordially-invited to join us to investigate the pytest Python 
testing framework.


"The pytest framework makes it easy to write small, readable tests, and 
can scale to support complex functional testing for applications and 
libraries."



Pre-requisites:

1 Head-set to ask questions and make contributions
2 Lab-/Log-/Note-book
3 Python 3.8+ installed
4 Ability to write intro-level Python program[me]s (at least)
5 Credentials to install from PyPi ("The Cheese Shop")
6 Preparedness to research, experiment, work with others...
As before, we will follow a café style of meeting. So, come prepared 
with a list of objectives you would like to achieve and a list of 
achievements you will be ready to share.



Possible (but far too many) topics:

- installing pytest (individual, system-wide, PyCharm, VSCodium, ...)
- TDD's (Test-Driven Development) red-green refactoring
- the Python assert-statement
- the project directory-tree and auto-discovery
- adding simple-tests
- running pytest
- reporting
- structuring the code-base to facilitate testing
- advantages/disadvantages of automated testing
- using a GAI to suggest/generate tests
- fixtures and dependencies (set-up and/or tear-down)
- scopes (function, class, module, session)
- parametrizing
- monkey-patching
- CI/CD chaining you've built
- plug-ins you're finding helpful
- coverage
- testing strategies
- other testing frameworks and aids
(open-ended - what would you like to add?)


Come to participate, learn-from, and help others!
Please RSVP at https://www.meetup.com/nzpug-auckland/events/298901851/


--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list


magic-folder 24.1.0

2024-01-31 Thread meejah via Python-list
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

Greetings,

We are pleased to announce version 23.6.0 of magic-folder.

Magic Folder synchronizes local data to and from a Tahoe-LAFS Grid,
keeping data private with the end-to-end encrypted "Capabilities" of
Tahoe-LAFS. One or more magic-folder clients can join the same Folder,
adding and synchronizing data across multiple devices. Written in
Python, Magic Folder supports Linux, MacOS and Windows. Python3 and
PyPy are supported.

By itself, this project requires familiarity with the command-line and
long-running processes. The Gridsync project provides a cross-
platform GUI experience using the localhost HTTP API.

Changes in this release include:

- - security: Bump dependencies, including security-relevant cryptography 
library (#716)

- - feature: Added a description of the datamodel to the documentation (#702)
- - feature: Conflict files now named after the Participant (not Author) (#711)

- - bugfix: "magic-folder status" properly parses scan/poll events (#717)
- - bugfix: Handle updates to conflicted files more robustly (#719)

You may download the release from PyPI:

   https://pypi.org/project/magic-folder/23.6.0/#files

Currently the localhost HTTP API used for integration is not 100%
stable, although we do not expect large changes.

thanks,

meejah
on behalf of all contributors


-BEGIN PGP SIGNATURE-

iQEzBAEBCgAdFiEEnVor1WiOy4id680/wmAoAxKAaacFAmSZNRIACgkQwmAoAxKA
aaeMBggAhijgTKRlYSBbIO+Y/mms4drY2ArEptF+Q5secHo9of68xlL1tQoTGgeF
et/xxgrjmn7WmnQYrC6k0f+xH+6mlW6sNb6wCafUmP/oh3p5bjAGv2tJDmfs81e+
iW7IUWBklx2mLdquwU4nWouJKZjeidqOyBvaBxx30hqOQe3yMwL5mxcliZg9ueZ6
M2HnQZmhA0yKblZrQ8H26dGTSvDLSOOCuHJKab04XYrmOJSJRqYK0DFXogjpNZbB
Ep5wiMpxyEsfPc1bHpxdIJmgJZq1iIgx6dFnHiMNe7yQLykLc9kjPJcxvWRLVsk4
OzN5lHzsiYKsS0g3NVSj+2PKxY3d3w==
=abqD
-END PGP SIGNATURE-
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Extract lines from file, add to new files

2024-01-31 Thread Thomas Passin via Python-list

On 1/31/2024 9:05 AM, Rich Shepard via Python-list wrote:

On Tue, 30 Jan 2024, Thomas Passin via Python-list wrote:


If I had a script that's been working for 30 years, I'd probably just use
Python to do the personalizing and let the rest of the bash script do the
rest, like it always has. The Python program would pipe or send the
personalized messages to the rest of the bash program. Something in that
ballpark, anyway.


Thomas,

A bash shell script looks easier for me and more promising. Using a while
loop (one for the name file the other for the address file), and sed for
putting the name at the head of the message replacing a generic placeholder
should work with the existing for loop script.


Sounds good.  I'd still be a bit worried about the two files getting out 
of sync, as others have mentioned.


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


Re: Extract lines from file, add to new files

2024-01-31 Thread Rich Shepard via Python-list

On Tue, 30 Jan 2024, Thomas Passin via Python-list wrote:


If I had a script that's been working for 30 years, I'd probably just use
Python to do the personalizing and let the rest of the bash script do the
rest, like it always has. The Python program would pipe or send the
personalized messages to the rest of the bash program. Something in that
ballpark, anyway.


Thomas,

A bash shell script looks easier for me and more promising. Using a while
loop (one for the name file the other for the address file), and sed for
putting the name at the head of the message replacing a generic placeholder
should work with the existing for loop script.

Thanks,

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


Re: Extract lines from file, add to new files

2024-01-31 Thread Thomas Passin via Python-list

On 1/30/2024 11:25 PM, avi.e.gr...@gmail.com wrote:

Thomas, on some points we may see it differently.


I'm mostly going by what the OP originally asked for back on Jan 11. 
He's been too stingy with information since then to be worth spending 
much time on, IMHO.



Some formats can be done simply but are maybe better done in somewhat
standard ways.

Some of what the OP has is already tables in a database and that can
trivially be exported into a CSV file or other formats like your TSV file
and more. They can also import from there. As I mentioned, many spreadsheets
and all kinds of statistical programs tend to support some formats making it
quite flexible.

Python has all kinds of functionality, such as in the pandas module, to read
in a CSV or write it out. And once you have the data structure in memory, al
kinds of queries and changes can be made fairly straightforwardly. As one
example, Rich has mentioned wanting finer control in selecting who gets some
version of the email based on concepts like market segmentation. He already
may have info like the STATE (as in Arizona) in his database. He might at
some point enlarge his schema so each entry is placed in one or more
categories and thus his CSV, once imported, can do the usual tasks of
selecting various rows and columns or doing joins or whatever.

Mind you, another architecture could place quite a bit of work completely on
the back end and he could send SQL queries to the database from python and
get back his results into python which would then make the email messages
and pass them on to other functionality to deliver. This would remove any
need for files and just rely on the DB.

There as as usual, too many choices and not necessarily one best answer. Of
course if this was a major product that would be heavily used, sure, you
could tweak and optimize. As it is, Rich is getting a chance to improve his
python skills no matter which way he goes.



-Original Message-
From: Python-list  On
Behalf Of Thomas Passin via Python-list
Sent: Tuesday, January 30, 2024 10:37 PM
To: python-list@python.org
Subject: Re: Extract lines from file, add to new files

On 1/30/2024 12:21 PM, Rich Shepard via Python-list wrote:

On Tue, 30 Jan 2024, Thomas Passin via Python-list wrote:


Fine, my toy example will still be applicable. But, you know, you haven't
told us enough to give you help. Do you want to replace text from values
in a file? That's been covered. Do you want to send the messages using
those libraries? You haven't said what you don't know how to do.
Something
else? What is it that you want to do that you don't know how?


Thomas,

For 30 years I've used a bash script using mailx to send messages to a

list

of recipients. They have no salutation to personalize each one. Since I
want
to add that personalized salutation I decided to write a python script to
replace the bash script.

I have collected 11 docs explaining the smtplib and email modules and
providing example scripts to apply them to send multiple individual
messages
with salutations and attachments.


If I had a script that's been working for 30 years, I'd probably just
use Python to do the personalizing and let the rest of the bash script
do the rest, like it always has.  The Python program would pipe or send
the personalized messages to the rest of the bash program. Something in
that ballpark, anyway.


Today I'm going to be reading these. They each recommend using .csv input
files for names and addresses. My first search is learning whether I can
write a single .csv file such as:
"name1","address1"
"mane2","address2"
which I believe will work; and by inserting at the top of the message

block

Hi, {yourname}
the name in the .csv file will replace the bracketed place holder

If the file contents are going to be people's names and email addresses,
I would just tab separate them and split each line on the tab.  Names
aren't going to include tabs so that would be safe.  Email addresses
might theoretically include a tab inside a quoted name but that would be
extremely obscure and unlikely.  No need for CSV, it would just add
complexity.

data = f.readlines()
for d in data:
  name, addr = line.split('\t') if line.strip() else ('', '')


Still much to learn and the batch of downloaded PDF files should educate
me.

Regards,

Rich




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