Re: [Tutor] Questions about the deprecation of standard library modules

2019-03-30 Thread Mats Wichmann
On March 30, 2019 9:13:16 PM MDT, boB Stepp  wrote:
>While reading in chapter 3 of "Learning Python, 5th ed." by Mark Lutz,
>I was playing around with reload() in the imp module.  In the
>interpreter I did a "from imp import reload" and then help(reload).
>This had a warning that it was deprecated.  After a search online I
>found that the entire imp library was deprecated since Python 3.4.
>The aforementioned book covers through Python 3.3.  This got me to
>wondering when the imp module would be removed from Python 3, which
>led me to finding PEP 4.  In it it says:
>
>Module name:   imp
>Rationale: Replaced by the importlib module.
>Date:  2013-02-10
>Documentation: Deprecated as of Python 3.4.
>
>There is no mention as to _when_ the module might be removed.  PEP 4
>says that a deprecated module may be removed as early as the next
>Python release after it becomes deprecated.  Also the PEP states that
>if a module exists in both Python 2.7 and Python 3.5, it will not be
>removed until Python 2.7 is no longer supported, which, I suppose,
>means next year.
>
>So my main question is how does one know in which Python version a
>deprecated module will be removed?  I'm not too concerned about the
>imp module, but _do_ want to know how the removal process works for
>deprecated standard library modules that I might be interested in.

bob, there's no real answer. if you look at tempfile, it says tempfile.mktemp() 
is deprecated since 2.3 (2003) and tempfile.template since 2.0 (2000). both 
still exist and work...  3.7 and much more so 3.8 become a lot more aggressive 
in warning about deprecated behavior, and the warnings alone can be an issue (a 
project I work on has its test suite break completely with 3.8 alpha because it 
tests stdout/stderr being as expected, and the warnings leak into stderr for 
the tests. yes imp is one of those).   So fix when you have to, I guess, but 
preferably be proactive and fix earlier... dont count on having X releases.
-- 
Sent from a mobile device with K-9 Mail. Please excuse my brevity.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Questions about the deprecation of standard library modules

2019-03-30 Thread boB Stepp
While reading in chapter 3 of "Learning Python, 5th ed." by Mark Lutz,
I was playing around with reload() in the imp module.  In the
interpreter I did a "from imp import reload" and then help(reload).
This had a warning that it was deprecated.  After a search online I
found that the entire imp library was deprecated since Python 3.4.
The aforementioned book covers through Python 3.3.  This got me to
wondering when the imp module would be removed from Python 3, which
led me to finding PEP 4.  In it it says:

Module name:   imp
Rationale: Replaced by the importlib module.
Date:  2013-02-10
Documentation: Deprecated as of Python 3.4.

There is no mention as to _when_ the module might be removed.  PEP 4
says that a deprecated module may be removed as early as the next
Python release after it becomes deprecated.  Also the PEP states that
if a module exists in both Python 2.7 and Python 3.5, it will not be
removed until Python 2.7 is no longer supported, which, I suppose,
means next year.

So my main question is how does one know in which Python version a
deprecated module will be removed?  I'm not too concerned about the
imp module, but _do_ want to know how the removal process works for
deprecated standard library modules that I might be interested in.

-- 
boB
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Encrypting shipped sqlite db in app directory

2019-03-30 Thread Peter Otten
Ali M wrote:

> I want to encrypt my sqlite databases which are shipped with the app in
> it's directory, so that the user can't modify or use it elsewhere, and
> they will only be accessible for the app to read from, how can i do that?

Assuming you had an encrypted database, where would you put the password?
You cannot give it to the user because then he can decrypt the database, and 
if you put it into the app you are effectively giving it to the user.

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Encrypting shipped sqlite db in app directory

2019-03-30 Thread Alan Gauld via Tutor
On 30/03/2019 07:22, Alan Gauld via Tutor wrote:
> On 29/03/2019 18:01, Ali M wrote:
>> I want to encrypt my sqlite databases which are shipped with the app in
>> it's directory, so that the user can't modify or use it elsewhere, and they
>> will only be accessible for the app to read from, how can i do that?

> You should also consider things like file ownership and
> user accounts for your app, complete with separate
> logins etc. 

I meant to add that you could incorporate a checksum too
so that you can detect if anyone has tampered with the
file.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Encrypting shipped sqlite db in app directory

2019-03-30 Thread Alan Gauld via Tutor
On 29/03/2019 18:01, Ali M wrote:
> I want to encrypt my sqlite databases which are shipped with the app in
> it's directory, so that the user can't modify or use it elsewhere, and they
> will only be accessible for the app to read from, how can i do that?

It all depends on how rigorous you want to be. If you only
want to make the database difficult to use by an ordinary
user then you can do things like make it a hidden file and
apply very basic encryption using a Caesar type algorithm
or a rot 13 shift.

But if you actually want to encrypt the data in a secure
way that will deter hackers then that will require industrial
strength tools which are much more complex both in operation
and use.

You should also consider things like file ownership and
user accounts for your app, complete with separate
logins etc. It all depends on how much security you
want to achieve.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor