Re: sharing data across Examples docstrings

2022-01-14 Thread Martin Di Paola

Hello,

I understand that you want to share data across examples (docstrings) 
because you are running doctest to validate them (and test).


The doctest implementation evaluates each docstring separately without 
sharing the context so the short answer is "no".


This is a limitation of doctest but it is not the only testing engine 
that you can use.


You could use "byexample" ( https://byexamples.github.io ) which it 
shares the context by default.


byexample has more features and fixes other caveats of doctests, but 
don't take me too serious, I have a natural bias because I'm its author.


If you want to go with byexample, you may want to try its "doctest 
compatibility mode" first so you don't have to rewrite any test.

( https://byexamples.github.io/byexample/recipes/python-doctest )

Let me know if it is useful for you.

Thanks,
Martin.

On Tue, Jan 11, 2022 at 04:09:57PM -0600, Sebastian Luque wrote:

Hello,

I am searching for a mechanism for sharing data across Examples sections
in docstrings within a class.  For instance:

class Foo:

   def foo(self):
   """Method foo title

   The example generating data below may be much more laborious.

   Examples
   
   >>> x = list("abc")  # may be very long and tedious to generate

   """
   pass

   def bar(self):
   """Method bar title

   Examples
   
   >>> # do something else with x from foo Example

   """
   pass


Thanks,
--
Seb
--
https://mail.python.org/mailman/listinfo/python-list

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


Re: keep getting a syntax error on the very first program I am running

2022-01-14 Thread Jon Ribbens via Python-list
On 2022-01-15, Bob Griffin  wrote:
>I am running this program and keep getting this error.  Is this normal?
>
>Invalid syntax.  Perhaps you forgot a comma?
>
>Also the t in tags is highlighted.
>
>I even tried different versions of Python also.
>
>Python 3.10.1 (tags/v3.10.1:2cd268a, Dec  6 2021, 19:10:37) [MSC v.1929 64
>bit (AMD64)] on win32
>
>Type "help", "copyright", "credits" or "license()" for more information.
>
>print("Hello World")
>
>Hello World
>
>input("\n\nPress the enter key to exit.")

You're only supposed to enter the lines:

print("Hello World")

and

input("\n\nPress the enter key to exit.")

The other lines are showing you the output you should see.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: keep getting a syntax error on the very first program I am running

2022-01-14 Thread MRAB

On 2022-01-15 01:12, Bob Griffin wrote:

I am running this program and keep getting this error.  Is this normal?



Invalid syntax.  Perhaps you forgot a comma?



Also the t in tags is highlighted.



I even tried different versions of Python also.



Python 3.10.1 (tags/v3.10.1:2cd268a, Dec  6 2021, 19:10:37) [MSC v.1929 64
bit (AMD64)] on win32

Type "help", "copyright", "credits" or "license()" for more information.

print("Hello World")

Hello World

input("\n\nPress the enter key to exit.")

I get an error only if I use the entirety of it as a program. Is that 
what you're doing, perhaps?


It's not actually a program, but the output from an interactive session.

You start IDLE (I'm assuming that what you're using) and it prints:

Python 3.10.1 (tags/v3.10.1:2cd268a, Dec  6 2021, 19:10:37) [MSC 
v.1929 64

bit (AMD64)] on win32

and then shows a prompt.

At the prompt you type:

print("Hello World")

and it print the response:

Hello World

and so on.
--
https://mail.python.org/mailman/listinfo/python-list


keep getting a syntax error on the very first program I am running

2022-01-14 Thread Bob Griffin
   I am running this program and keep getting this error.  Is this normal?



   Invalid syntax.  Perhaps you forgot a comma?



   Also the t in tags is highlighted.



   I even tried different versions of Python also.



   Python 3.10.1 (tags/v3.10.1:2cd268a, Dec  6 2021, 19:10:37) [MSC v.1929 64
   bit (AMD64)] on win32

   Type "help", "copyright", "credits" or "license()" for more information.

   print("Hello World")

   Hello World

   input("\n\nPress the enter key to exit.")







   Sent from [1]Mail for Windows



References

   Visible links
   1. https://go.microsoft.com/fwlink/?LinkId=550986
-- 
https://mail.python.org/mailman/listinfo/python-list


[RELEASE] Python 3.10.2, 3.9.10, and 3.11.0a4 are now available

2022-01-14 Thread Łukasz Langa
Hi there,
before we begin the usual round of release notes, please do note that the three 
new versions of Python released today do not contain Windows installers yet. 
This is temporary, due to a more complex than expected code signing certificate 
renewal.
We’ve held the releases all week while the situation is getting resolved but 
the urgency of 3.10.2 in particular made us release without the Windows 
installers after all. We apologize for the inconvenience and are doing 
everything we can to put the Windows installer in place as soon as possible.

We’re rooting for both Ee Durbin and Steve Dower who are helping us resolve 
this. Thanks for your hard work! Hopefully, by this time next week, this will 
only be a footnote in release management history.

The releases you’re looking at were all cursed in some way. What a way to start 
2022! Besides the certificate hold up, Python 3.10.2 is an expedited release 
(you’ll want to upgrade, read below!), Python 3.11.0a4 had almost 20 (sic, 
twenty!) release blockers before being finally green, and Python 3.9.10 was 
made from a new M1 Mac on macOS Monterey which made the usually boring process 
quite a ride. We’re hoping 2022 won’t be this intense all year!


 
Python
 3.10.2

Get it here: https://www.python.org/downloads/release/python-3102/ 
  

This is a special bugfix release ahead of schedule to address a memory leak 
that was happening on certain function calls when using Cython 
. The memory leak consisted of a small 
constant amount of bytes in certain function calls from Cython code. Although 
in most cases this was not very noticeable, it was very impactful for 
long-running applications and certain usage patterns. Check bpo-46347 
 for more information.

Upgrading existing Python 3.10 installations is highly recommended. Even though 
this is an expedited release, it still contains over 100 other bug fixes. See 
the change log  
for details.

The next Python 3.10 maintenance release will be 3.10.3, currently scheduled 
for 2022-04-04.


 
Python
 3.9.10

Get it here: https://www.python.org/downloads/release/python-3910/  

Python 3.9.10 is the ninth maintenance release of the legacy 3.9 series. Note: 
Python 3.10 is now the latest feature release series of Python 3.

Python 3.9 micro-releases enter double digits! There’s been 130 commits since 
3.9.9 which is a higher number of fixes for this stage of the life cycle 
compared to 3.8. See the changelog 
 for details on 
what changed.

As a reminder, on macOS, the default installer is now the new universal2 
variant. It’s compatible with Mac OS X 10.9 and newer, including macOS 11 Big 
Sur and macOS 12 Monterey. Python installed with this variant will work 
natively on Apple Silicon processors.

The next Python 3.9 maintenance release will be 3.9.11, currently scheduled for 
Pi Day '22 (2022-03-14).


 
Python
 3.11.0a4

Get it here: https://www.python.org/downloads/release/python-3110a4/  

Python 3.11 is still in development. This release, 3.11.0a4, is the fourth of 
seven planned alpha releases.

Alpha releases are intended to make it easier to test the current state of new 
features and bug fixes by the community, as well as to test the release process.

During the alpha phase, features may be added up until the start of the beta 
phase (2022-05-06) and, if necessary, may be modified or deleted up until the 
release candidate phase (2022-08-01). Please keep in mind that this is a 
preview release and its use is not recommended for production environments.

Many new features for Python 3.11 are still being planned and written. Among 
the new major new features and changes so far:

PEP 657  – Include Fine-Grained 
Error Locations in Tracebacks
PEP 654  – Exception Groups and 
except*
The Faster CPython Project  is already 
yielding some exciting results: this version of CPython 3.11 is ~ 19% faster on 
the geometric mean of the PyPerformance benchmarks <>, compared to 3.10.0.
(Hey, fellow core developer, if a feature you find important is missing from 
this list, let Pablo know .)
The next pre-release of Python 3.11 will be 3.11.0a5, currently scheduled for 
Wednesday, 2022-02-02.


 


Re: Using PIP in Python 3.10 on Windows 10

2022-01-14 Thread Eryk Sun
On 1/14/22, Mats Wichmann  wrote:
> On 1/14/22 10:40, Jonathan Gossage wrote:
>
> By this do you mean the python.org installer or the Microsoft Store
> installer - they're similar but have some differences.

Jonathan is not using the store app. The store app is installed to the
system in "%ProgramFiles%\WindowsApps" and "%ProgramData%\Packages",
and in each user's "%LocalAppData%\Packages". The user's enabled app
aliases are created in "%LocalAppData%\Microsoft\WindowsApps".

>> It looks as if the launcher is expecting to find Python installed at
>> c:\Program Files\Python3.10 whereas it has actually been installed at
>> D:\Users\jgoss\AppData\local\python\python3.10.
>
> earlier you said "non-standard location" but that's not non-standard at
> all, that's actually the standard place for the python.org installer to
> put it if you requested a single user install (as opposed to a
> system-wide one).

Jonathan did not install to a standard location. The standard location
for a per-user installation is
"%LocalAppData%\Programs\Python\PythonXY[-32]". If "%LocalAppdata%" is
"D:\Users\jgoss\AppData\local", then the standard location for 64-bit
3.10 would be "D:\Users\jgoss\AppData\local\Programs\Python\Python310".

> If you can find Python, whether it's called "python" or "py" in your
> case, then you should be able to reach pip with "python -m pip" or "py
> -m pip".  If you're using the python.org version, you probably want to
> use "py" to launch Python.

Upgrading pip in Windows always requires running the module with `-m
pip`. By default the py launcher is installed, in which case pip 3.10
can be upgraded with the following command:

py -3.10 -m pip install --upgrade pip

If Python is installed for all users, the above command may require
elevating to get administrator access. Afterwards you can use the
"pip.exe" launcher, but first check `where.exe pip` to make sure the
first one found is the right one. If not, modify your per-user and/or
system PATH to fix it.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Using PIP in Python 3.10 on Windows 10

2022-01-14 Thread MRAB

On 2022-01-14 17:40, Jonathan Gossage wrote:

I have installed Python 3.10.1 on Windows 10 using the recommended Windows
Installer. When I try to access PIP from the command line, I get the
following result, even though Python itself is accessible.


C:\Users\jgoss>python
Python 3.10.1 (tags/v3.10.1:2cd268a, Dec  6 2021, 19:10:37) [MSC v.1929 64
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

quit()


C:\Users\jgoss>pip install pip --upgrade
Fatal error in launcher: Unable to create process using '"C:\Program
Files\Python310\python.exe"  "C:\Program Files\Python310\Scripts\pip.exe"
install pip --upgrade': The system cannot find the file specified.
During the installation, I chose to install Python in a non-default
location and to set the Environment variables.
  The result of this attempt is shown below:


C:\Users\jgoss>python
Python 3.10.1 (tags/v3.10.1:2cd268a, Dec  6 2021, 19:10:37) [MSC v.1929 64
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

quit()


C:\Users\jgoss>pip install pip --upgrade
Fatal error in launcher: Unable to create process using '"C:\Program
Files\Python310\python.exe"  "C:\Program Files\Python310\Scripts\pip.exe"
install pip --upgrade': The system cannot find the file specified.

It looks as if the launcher is expecting to find Python installed at
c:\Program Files\Python3.10 whereas it has actually been installed at
D:\Users\jgoss\AppData\local\python\python3.10. It seems that the launcher
has not been updated to the latest installation location for python and
that it also needs to handle a non-default install location. The same
problem occurs if I take the install option to install to the default
location.
Is there any workaround as PIP is essential to my environment?

These days it's recommended that you use the Python Launcher and the pip 
module:


py -m pip install pip --upgrade
--
https://mail.python.org/mailman/listinfo/python-list


Re: Using PIP in Python 3.10 on Windows 10

2022-01-14 Thread Mats Wichmann


On 1/14/22 10:40, Jonathan Gossage wrote:
> I have installed Python 3.10.1 on Windows 10 using the recommended Windows
> Installer. When I try to access PIP from the command line, I get the
> following result, even though Python itself is accessible.

By this do you mean the python.org installer or the Microsoft Store
installer - they're similar but have some differences.

> 
> 
> C:\Users\jgoss>python
> Python 3.10.1 (tags/v3.10.1:2cd268a, Dec  6 2021, 19:10:37) [MSC v.1929 64
> bit (AMD64)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
 quit()
> 
> C:\Users\jgoss>pip install pip --upgrade
> Fatal error in launcher: Unable to create process using '"C:\Program
> Files\Python310\python.exe"  "C:\Program Files\Python310\Scripts\pip.exe"
> install pip --upgrade': The system cannot find the file specified.
> During the installation, I chose to install Python in a non-default
> location and to set the Environment variables.
>  The result of this attempt is shown below:
> 
> 
> C:\Users\jgoss>python
> Python 3.10.1 (tags/v3.10.1:2cd268a, Dec  6 2021, 19:10:37) [MSC v.1929 64
> bit (AMD64)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
 quit()
> 
> C:\Users\jgoss>pip install pip --upgrade
> Fatal error in launcher: Unable to create process using '"C:\Program
> Files\Python310\python.exe"  "C:\Program Files\Python310\Scripts\pip.exe"
> install pip --upgrade': The system cannot find the file specified.
> 
> It looks as if the launcher is expecting to find Python installed at
> c:\Program Files\Python3.10 whereas it has actually been installed at
> D:\Users\jgoss\AppData\local\python\python3.10.

earlier you said "non-standard location" but that's not non-standard at
all, that's actually the standard place for the python.org installer to
put it if you requested a single user install (as opposed to a
system-wide one).

>  It seems that the launcher
> has not been updated to the latest installation location for python and
> that it also needs to handle a non-default install location. The same
> problem occurs if I take the install option to install to the default
> location.
> Is there any workaround as PIP is essential to my environment?
> 

If you can find Python, whether it's called "python" or "py" in your
case, then you should be able to reach pip with "python -m pip" or "py
-m pip".  If you're using the python.org version, you probably want to
use "py" to launch Python.

It looks like you're stumbling over the little stub Microsoft leaves
around which isn't Python, but rather, if you call it, issues a prompt
to install from the Microsoft Store.  That might be why the sequnce
being issued doesn't work. That part of the issue might be solvable by
fiddling the order of your PATH environment vars.
-- 
https://mail.python.org/mailman/listinfo/python-list


Using PIP in Python 3.10 on Windows 10

2022-01-14 Thread Jonathan Gossage
I have installed Python 3.10.1 on Windows 10 using the recommended Windows
Installer. When I try to access PIP from the command line, I get the
following result, even though Python itself is accessible.


C:\Users\jgoss>python
Python 3.10.1 (tags/v3.10.1:2cd268a, Dec  6 2021, 19:10:37) [MSC v.1929 64
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()

C:\Users\jgoss>pip install pip --upgrade
Fatal error in launcher: Unable to create process using '"C:\Program
Files\Python310\python.exe"  "C:\Program Files\Python310\Scripts\pip.exe"
install pip --upgrade': The system cannot find the file specified.
During the installation, I chose to install Python in a non-default
location and to set the Environment variables.
 The result of this attempt is shown below:


C:\Users\jgoss>python
Python 3.10.1 (tags/v3.10.1:2cd268a, Dec  6 2021, 19:10:37) [MSC v.1929 64
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()

C:\Users\jgoss>pip install pip --upgrade
Fatal error in launcher: Unable to create process using '"C:\Program
Files\Python310\python.exe"  "C:\Program Files\Python310\Scripts\pip.exe"
install pip --upgrade': The system cannot find the file specified.

It looks as if the launcher is expecting to find Python installed at
c:\Program Files\Python3.10 whereas it has actually been installed at
D:\Users\jgoss\AppData\local\python\python3.10. It seems that the launcher
has not been updated to the latest installation location for python and
that it also needs to handle a non-default install location. The same
problem occurs if I take the install option to install to the default
location.
Is there any workaround as PIP is essential to my environment?

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


Re: What to write or search on github to get the code for what is written below:

2022-01-14 Thread Dennis Lee Bieber
On Thu, 13 Jan 2022 23:08:19 + (UTC), Avi Gross 
declaimed the following:

>So the suggestions to copy the data ONCE into something else (a CSV, database, 
>whatever) that can be used externally are reasonable but seem to be resisted. 
>I would guess some of the "missing" functionality others wonder about such as 
>making reports, may still be available within other sheets or parts of the 
>EXCEL .xlsx or other format file.

Ignoring the data store itself, the OP has also stated (if poorly) that
this application is supposed to be hosted on Heroku (I suspect this is an
assumption they made, as that minimal "Hello World" Flask tutorial they are
using gives instructions for a limited free/hobbyist Heroku instance). If
this application is really for some client (the book repository staff) one
would think they'd have specified the web hosting system in advance.

That (web hosting) compounds the problem of the lack of reporting...
The defined application is essentially "write-only" -- in that the only
operation available is to reserve/check-out book(s) based upon availability
count. There is no means provided by which these reservations are passed on
to whoever is responsible for physically handing out books, nor to track
who has received their copy. Are any/all "repository" employees supposed to
access the spreadsheet? How? Do they all have the account/password to the
Heroku (or other web hosting service) in order to FTP the data down for
local usage (how many such copies will there be, and how are they
synchronized).

Or is the CONOPS that only the repository employees access the
application, on behalf of the person making the reservation/check-out
request -- and hence the application is merely recording information of who
has physically received a book (in which case the overhead of tracking
availability seems superfluous, as the staff would see that the table(s) of
books does not have the title, so it is unavailable for handing over).



-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list