Re: Python Packages Survey

2019-01-19 Thread Chris Warrick
On Sat, 19 Jan 2019 at 01:22, Cameron Davidson-Pilon
 wrote:
>
> Hello! I invite you to participate in the Python Packages Survey - it takes
> less than a minute to complete, and will help open source developers
> understand their users' better. Thanks for participating!
>
> https://python-packages-survey.com/

The site says:

> Completing the survey is as easy as running a Python script

No, thanks. A better way to get meaningful results is to just create a
good old web form, where you can ask people more detailed questions
than just mining the installed package list. Also, even if you promise
to filter out private packages, they *do* reach your server, and many
people would prefer that didn’t happen.

-- 
Chris Warrick 
PGP: 5EAAEA16
-- 
https://mail.python.org/mailman/listinfo/python-list


basic question on how "import" works

2019-01-19 Thread joseph pareti
[*u23885@c009 3_NeuralNetworks]$ cat foo.py*
from __future__ import print_function

# Import MNIST data
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("/tmp/data/", one_hot=True)

[u23885@c009 3_NeuralNetworks]$
when the above code is executed, equivalent of
*$ python foo.py*

the output is as follows:
...
Successfully downloaded train-images-idx3-ubyte.gz 9912422 bytes.
Extracting /tmp/data/train-images-idx3-ubyte.gz
Successfully downloaded train-labels-idx1-ubyte.gz 28881 bytes.
Extracting /tmp/data/train-labels-idx1-ubyte.gz
Successfully downloaded t10k-images-idx3-ubyte.gz 1648877 bytes.
Extracting /tmp/data/t10k-images-idx3-ubyte.gz
Successfully downloaded t10k-labels-idx1-ubyte.gz 4542 bytes.
Extracting /tmp/data/t10k-labels-idx1-ubyte.gz
...
My questions are:

   1. where are the write / print statements that display *Successfully
   downloaded, extracting ...*
   2. I don't see any such files in /tmp/data on my system, why?
   3. (this is part of a code for training a neuronal network which works
   as expected, it's just for my own understanding of how this works -- Thank
   you)



-- 
Regards,
Joseph Pareti - Artificial Intelligence consultant
cell +49 1520 1600 209
cell +39 339 797 0644
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python package management confusion

2019-01-19 Thread dcs3spp via Python-list
On Saturday, 19 January 2019 07:33:50 UTC, dieter  wrote:
> dcs3spp via Python-list  writes:
> > On Friday, 18 January 2019 07:39:00 UTC, dieter  wrote:
> > ...
> > My situation is similar to the following
> >
> > Assume the following two privately developed projects that I have written, 
> > each with their own setup.py:
> > 1. parent exists in folder $HOME/project/
> > 2. child exists in folder $HOME/a_different_project/
> > *child could be also be used by other projects in the future
> >
> > parent has a dependency requirement on child and so child is listed as an 
> > install dependency in parent setup.py
> >
> > if I try python setup.py develop from parent project it fails to find child 
> > dependency on build. 
> 
> Do you tell me to have a cyclic dependency structure?
> 
> If not, first install "child" in your virtualenv (by whatever
> means, maybe "python setup.py develop"), then "parent".

Thanks for your suggestion.No, no cyclic dependency structure. Child does not 
depend on parent. Child could be used by separate projects in the future. Child 
will not be cyclic, it will not import projects that import it.

Installing child first is what I tried yesterday, 
https://github.com/dcs3spp/setuptools_dependency_example/blob/master/README.md 
, when trying to understand the suggested approach of using python setup.py 
develop to pull dependencies.

The advantage of the devpi approach, adopted earlier, is that this additional 
complexity is hidden from developers. They do not need to be concerned about 
the order that they install dependencies, e.g. install child first and then 
install parent. Developers just run python setup.py develop and it 
automatically fetches the child dependency. 

However, the devpi approach requires a private repository to be setup and I am 
not sure whether it is possible to give access to it for usage in CI cloud 
technologies, such as gitlab.com. If I stuck with devpi then I would presumably 
have to follow the route of a bare metal environment for CI server (e.g. 
Jenkins). Hence, my thoughts on paying subscription to a private pypi cloud 
repository…..


My question is, can setuptools be configured to pull in child from a separate 
git repository when running python setup.py develop from parent folder? I have 
since found and tried this approach at 
https://stackoverflow.com/a/53706140/8325270 
It appears that later versions of setuptools can install via a PEP508 url. I 
currently trying to investigate this approach…..


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


How to access a folder in a zip file?

2019-01-19 Thread mignoncharly via Python-list
Hello!

I'm a newbie in python and I was trying to access a folder inside a zip file 
and I also have issues with relative and absolute path. Thks in advance.

In projects there a lot of urls (i'll read them later one by one and store them 
in a list/array so that I could work with it easily)

here is the path:  home/name/tutorial/prof/ks.zip/projects

should I use 

file_name = "ks.zip" 

or

file_location = os.path.dirname(os.path.abspath(__file__))
#print(file_location)  ?



# specifying the zip file name
file_name = "ks.zip"

 # opening the zip file in READ mode
with ZipFile(file_name, 'r') as zip:

   # printing all the contents of the zip file
   zip.printdir()

# extracting all the files
   print('Extracting all the files now...')
   zip.extractall()
   print('Done!')
-- 
https://mail.python.org/mailman/listinfo/python-list


How to access a folder inside a zip file

2019-01-19 Thread mignoncharly--- via Python-list
Hello!

I'm a newbie in python and I was trying to access a folder inside a zip file 
and I also have issues with relative and absolute path. Thks in advance.

In projects there a lot of urls (i'll read them later one by one and store them 
in a list/array so that I could work with it easily)

here is the path:  home/name/tutorial/prof/ks.zip/projects

should I use 

file_name = "ks.zip" 

or

file_location = os.path.dirname(os.path.abspath(__file__))
#print(file_location)  ?



# specifying the zip file name
file_name = "ks.zip"

 # opening the zip file in READ mode
with ZipFile(file_name, 'r') as zip:

   # printing all the contents of the zip file
   zip.printdir()

# extracting all the files
   print('Extracting all the files now...')
   zip.extractall()
   print('Done!')


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


Re: Python Packages Survey

2019-01-19 Thread Jason Friedman
On Fri, Jan 18, 2019 at 5:22 PM Cameron Davidson-Pilon <
[email protected]> wrote:

> Hello! I invite you to participate in the Python Packages Survey - it takes
> less than a minute to complete, and will help open source developers
> understand their users' better. Thanks for participating!
>
> https://python-packages-survey.com/
>
> I took the plunge.  Other than smoke coming out of my computer everything
seems to be normal.
-- 
https://mail.python.org/mailman/listinfo/python-list


checking protocols.

2019-01-19 Thread Avi Gross
Short question. Checking if a protocol is set up?

Many python improvements are changes to classes that implement a protocol.
There are things you can do to make your own classes work with the protocol
by setting various dunder variables like __iter__, __next__ and writing
appropriate ode including throwing the right error class when done.
Similarly the "with" statement works with objects that implement __enter__
and __exit__. There can be plenty of others like this and more can be
anticipated in the future.

So, several related questions. Tools that help a developer add appropriate
things to an object to implement the protocol or to test if it was done
right. Perhaps a function with a name like is_iterable() that tells if the
protocol can be applied. For the specific case of an iterable, I found
something that seems to work for at least some cases:

from collections import Iterable
item = [1, 2, 3, 4]

isinstance(item, Iterable)

Not sure if it would work on one I created that did the right things or what
it checks.

I am interested in a pointer to something that describes many of the known
protocols or extensions and maybe to modules designed sort of as I said
above. I am aware some protocols may be not-quite standard with parts of the
protocol embedded in different objects like wrappers or objects returned
upon a request to have a proxy and many other techniques that seem to abound
and allow multiple layers of indirection or seemingly almost magical as in
multiple inheritance drop-ins and so on. That is what may make these things
harder if someone uses something like __getattr__ or descriptors to
intercept calls and provide the functionality without any actual sign of the
dunder key normally expected.

And, yes, I am aware of a tried and true method called try ... except ... to
see if it seems to work.


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


ttk present but not found for import

2019-01-19 Thread Rich Shepard

I've started to learn tkinter as the GUI widget set I'll use from now on.
While ttk-8.6 is installed here (/usr/lib/tk8.6/ttk), I cannot import it:

$ python3
Python 3.6.7 (default, Dec  8 2018, 06:22:57) 
[GCC 5.5.0] on linux

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

import tkinter
import ttk

Traceback (most recent call last):
  File "", line 1, in 
ModuleNotFoundError: No module named 'ttk'




What have I done incorrectly?

TIA,

Rich

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


Re: ttk present but not found for import [RESOLVED]

2019-01-19 Thread Rich Shepard

On Sat, 19 Jan 2019, Rich Shepard wrote:


What have I done incorrectly?


  Got it:

from tkinter import ttk

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


Re: ttk present but not found for import

2019-01-19 Thread boB Stepp
On Sat, Jan 19, 2019 at 5:02 PM Rich Shepard  wrote:
>
> I've started to learn tkinter as the GUI widget set I'll use from now on.
> While ttk-8.6 is installed here (/usr/lib/tk8.6/ttk), I cannot import it:
>
> $ python3
> Python 3.6.7 (default, Dec  8 2018, 06:22:57)
> [GCC 5.5.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import tkinter
> >>> import ttk
> Traceback (most recent call last):
>File "", line 1, in 
> ModuleNotFoundError: No module named 'ttk'
> >>>
>
> What have I done incorrectly?

import tkinter.ttk


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