Re: Benchmarking Django on PyPy with unittest?

2018-02-08 Thread Etienne Robillard


Hi Dan,

Thank you for your reply.

I never used the requests module, but it looks like a very good pick to 
test the Django wsgi handler. :-)


Currently my tests/benchmarks folder looks like this:

tests/benchmarks/lib

tests/benchmarks/lib/django_sqlite # Django 1.11 specific project directory

tests/benchmarks/lib/django_sqlite/myapp # Test app for benchmarking 
templates, views, and core django api


tests/benchmarks/lib/django_sqlite/polls # Tutorial app for benchmarking 
django orm/sqlite on pypy and cpython


tests/benchmarks/uwsgi # Testsuite for uWSGI

tests/benchmarks/django1 # Testsuite for Django 1.11

tests/benchmarks/django2 # Testsuite for Django 2

To run the benchmarks testsuite on pypy:


$ cd tests
$ source ./djangorc
$ pypy ./run.py -C benchmarks/uwsgi # Run testsuite for the uwsgi handler
$ pypy ./run.py -C benchmarks/django1 # Run testsuite for the django 
1.11 api
$ pypy ./run.py -C benchmarks/django2 # Run testsuite for the django 2.0 
api


Ideally, i would like to compile benchmarks data, but I have not yet 
understood how to do this. :-)



Cheers,

Etienne


2018-02-07 à 19:10, Dan Stromberg a écrit :

You could probably use the "requests" module to time how long various
operations take in your Django website.

On Wed, Feb 7, 2018 at 2:26 AM, Etienne Robillard  wrote:

Also, i need to isolate and measure the speed of gevent loop engine
(gevent.monkey), epoll, and python-specific asyncio coroutines. :-)

Etienne



Le 2018-02-07 à 04:39, Etienne Robillard a écrit :

Hi,

is it possible to benchmark a django application  with unittest module in
order to compare and measure the speed/latency of the django orm with
sqlite3 against ZODB databases?
i'm interested in comparing raw sqlite3 performance versus ZODB (schevo).
i would like to make specific testsuite(s) for benchmarking django 1.11.7,
django 2.0, pypy, etc.

What do you think?

Etienne


--
Etienne Robillard
tkad...@yandex.com
https://www.isotopesoftware.ca/

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


--
Etienne Robillard
tkad...@yandex.com
https://www.isotopesoftware.ca/

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


Re: How to work on a package

2018-02-08 Thread Grant Edwards
On 2018-02-07, Rob Gaddi  wrote:
> On 02/07/2018 03:17 PM, Grant Edwards wrote:
>
>> How do you work on a package that must remain installed and usable the
>> whole time you're working on it?
>> 
>> IOW, only specific test apps or apps run in a specific directory
>> should get the "in-progress" foo module when they do an "import foo".
>
> Achievable with a virtualenv, but now the process is even that much more 
> complicated.

Ouch.  I was afraid that was the answer.

There is nothing that corresponds to LD_LIBRARY_PATH?

-- 
Grant Edwards   grant.b.edwardsYow! Now, let's SEND OUT
  at   for QUICHE!!
  gmail.com

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


EuroPython 2018: Getting ready

2018-02-08 Thread M.-A. Lemburg
We are excited to announce the launch of the EuroPython 2018 website:


  * https://ep2018.europython.eu/ *


The EuroPython conference will take place in sunny Edinburgh,
Scotland, this year, from July 23-29 2018.

It’s a great time of year to visit Edinburgh with 16 hours of
daylight, and the festival season in full flow, so come and join
us. This is just one week before the famous Edinburgh Fringe Festival
and the Turing Festival, so you can extend your stay a little longer
in Edinburgh, or head for the Highlands to enjoy the amazing mountains
and lochs.

EuroPython 2018 - The European Python Conference


Here’s an overview of what you can expect in Edinburgh:

 - We will start with Workshops and Training Sessions on Monday and
   Tuesday.

 - The main 3 conference days follow, packed with keynotes, talks,
   exhibition, help desks, interactive sessions, panels and poster
   sessions.

 - The two weekend days after the conference, July 28 and 29, are
   reserved for sprints (hackathons).

Overall, we will again have 7 days worth of great Python content,
arranged in over 120 sessions, waiting for you.

The venue is the Edinburgh International Conference Centre, in central
Edinburgh, just on the edge of the historic Old Town.

In short:

 - Monday, Tuesday, July 23-24: Workshops and Training
 - Wednesday - Friday, July 25-27: Conference talks, keynotes, training
 - Saturday, Sunday, July 28-29: Sprints

Our Sponsors


All this would not be possible without the generous help of our launch
sponsors. If your company would be interested in sponsoring the 17th
EuroPython please contact sponsor...@europython.eu.

Sponsoring EuroPython guarantees you highly targeted visibility and
the opportunity to present yourself and your company in a professional
and innovative environment. You’ll have an unique opportunity to meet
many Python-enthusiastic developers, users and professionals. As a
sponsor of EuroPython 2018, you will directly help to promote the work
of a great open-source community and help further its development.

EuroPython 2018 is the 17th EuroPython conference. The conference
tours throughout Europe. It so far has had stops in Belgium, Sweden,
Lithuania, United Kingdom, Italy, Germany and Basque Country/Spain,
growing from initially 240 attendees to well over 1200.

In the coming days, we will announce the start of the Call for
Proposals and Early Bird Ticket sales. Please watch our EuroPython
blog for updates.

https://ep2018.europython.eu/

Enjoy,
--
EuroPython 2018 Team
https://ep2018.europython.eu/
https://www.europython-society.org/


PS: Please forward or retweet to help us reach all interested parties:
https://twitter.com/europython/status/961616731482488833
Thanks.

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


Re: [Python-Dev] How to set/update value in a xml file using requests in python

2018-02-08 Thread Dan Stromberg
This is more relevant to python-list than python-dev. I've added
python-list to the To header.

Gmail doesn't appear to allow setting a reply-to for a single message,
so I've not set that; please, when replying, drop python-dev from the
to: header.

You'll likely want to set up some kind of REST endpoint to allow
updating your xml file.  Imagine if anyone could change anyone else's
xml files - it'd be pretty chaotic.

Perhaps flask would be appropriate?
http://flask.pocoo.org/docs/0.12/quickstart/

You likely will want a PUT or a POST HTTP verb:
https://stackoverflow.com/questions/107390/whats-the-difference-between-a-post-and-a-put-http-request

HTH.

On Thu, Feb 8, 2018 at 12:38 AM, Sum J  wrote:
> My xml file is located in local network:
>
> http://192.168.43.109/DevMgmt/NetAppsDyn.xml
>
> Below is a part content of above xml I want to update :
>
> 
>
> 
> 
> 
> off
> 
>
> 
>
> I want to set the value for 'ResourceUI' and 'Port' field in above xml.
>
> I have used below code :
>
>  import requests
>  data = {
>   'ResourceURI':'web-proxy.xxx.yy.com',
>   'Port':8080
> }
>
> URL = 'http://192.168.75.165/DevMgmt/NetAppsDyn.xml'
>
> # content type
> head = {'Content-type': 'text/xml'}
> # sending get request
> gr= requests.get(url=URL)
> print gr
>
> # sending put request
> r = requests.put(url=URL, data=data,headers=head)
> print r.status_code
> # extracting response text
> output_xml = r.text
> print("The op xml is:%s" % output_xml)
>
> Issue : The fields are not getting updated in xml using put request. I am
> able to see the response for get (request) , but for put request it is
> throwing errror code : 301 , resource has been moved permanently.
>
>
>
> ___
> Python-Dev mailing list
> python-...@python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> https://mail.python.org/mailman/options/python-dev/drsalists%40gmail.com
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: This newsgroup (comp.lang.python) may soon be blocked by Google Gro

2018-02-08 Thread Larry Martell
On Thu, Feb 8, 2018 at 12:36 PM, Gilmeh Serda
 wrote:
> On Sat, 03 Feb 2018 04:33:36 +1200, breamoreboy wrote:
>
>>> When trying to access comp.lang.idl-pvwave, a message is now displayed,
>> stating that the group owner needs to remove the spam, and can then
>> apply to Google in order to have access reinstated.
>
> Just as I have always suspected: Google are run by idiots!

Very, very rich idiots.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: This newsgroup (comp.lang.python) may soon be blocked by Google Gro

2018-02-08 Thread mm0fmf

On 08/02/2018 17:36, Gilmeh Serda wrote:

On Sat, 03 Feb 2018 04:33:36 +1200, breamoreboy wrote:


When trying to access comp.lang.idl-pvwave, a message is now displayed,

stating that the group owner needs to remove the spam, and can then
apply to Google in order to have access reinstated.


Just as I have always suspected: Google are run by idiots!


But very, very, very rich idiots.
--
https://mail.python.org/mailman/listinfo/python-list


$srcdir and $datadir

2018-02-08 Thread Victor Porton
In GNU software written in C $srcdir and $datadir are accessible to C code 
through generated config.h file.

What is the right way to config directories for a Python program?

-- 
Victor Porton - http://portonvictor.org
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: $srcdir and $datadir

2018-02-08 Thread Ben Finney
Victor Porton  writes:

> In GNU software written in C $srcdir and $datadir are accessible to C
> code through generated config.h file.

For what purpose?

Given that the source may not be at that location after the program is
compiled – especially, after the program is moved to a different machine
– what meaning does ‘$srcdir’ have when the program is running?

What “data directory” is specified by ‘$datadir’, and why is it assumed
there is exactly one?

> What is the right way to config directories for a Python program?

We'll need to know what those concepts mean, to be able to discuss the
equivalent (if any) in a Python environment.

-- 
 \  “Shepherds … look after their sheep so they can, first, fleece |
  `\   them and second, turn them into meat. That's much more like the |
_o__)  priesthood as I know it.” —Christopher Hitchens, 2008-10-29 |
Ben Finney

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


Re: This newsgroup (comp.lang.python) may soon be blocked by Google Gro

2018-02-08 Thread breamoreboy
On Sunday, February 4, 2018 at 12:15:16 AM UTC, pyotr filipivich wrote:

> Those of us who do not use google-groups may not notice the loss
> of the google groupies.
> --
> pyotr filipivich
> Next month's Panel: Graft - Boon or blessing?

This topic has been hidden because you reported it for abuse. (+39 more)
Re: This newsgroup (comp.lang.python) may soon be blocked by Google Gro (2)
By pyotr filipivich
4 posts 14 views
5:48 PM
How to set/update value in a xml file using requests in python (5)
By Sum J
5 posts 21 views
4:45 PM
EuroPython 2018: Getting ready (1)
By M.-A. Lemburg
1 post 3 views
3:40 PM
How to work on a package (11)
By Roel Schroeven
11 posts 34 views
3:19 PM
This topic has been hidden because you reported it for abuse. (+25 more)
Benchmarking Django on PyPy with unittest? (1)
By Etienne Robillard
6 posts 18 views
9:33 AM
This topic has been hidden because you reported it for abuse. (+18 more)
Does anyone know ni? (6)
By Roel Schroeven
6 posts 17 views
12:15 AM
This topic has been hidden because you reported it for abuse. +1 more 

The above is taken from my small laptop screen showing just how useless google 
groups is, so it might as well be blown away completely, or is it impossible 
for the PSF to take on google?

The most that I've ever whacked in one hit was +55 more, all of it the Case 
Solutions/Test Bank crap.

Just saying.

--
Kindest regards.

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


Re: This newsgroup (comp.lang.python) may soon be blocked by Google Gro

2018-02-08 Thread Chris Angelico
On Fri, Feb 9, 2018 at 9:35 AM,   wrote:
> On Sunday, February 4, 2018 at 12:15:16 AM UTC, pyotr filipivich wrote:
>
>> Those of us who do not use google-groups may not notice the loss
>> of the google groupies.
>> --
>> pyotr filipivich
>> Next month's Panel: Graft - Boon or blessing?
>
> This topic has been hidden because you reported it for abuse. (+39 more)
> Re: This newsgroup (comp.lang.python) may soon be blocked by Google Gro (2)
> By pyotr filipivich
> 4 posts 14 views
> 5:48 PM
> How to set/update value in a xml file using requests in python (5)
> By Sum J
> 5 posts 21 views
> 4:45 PM
> EuroPython 2018: Getting ready (1)
> By M.-A. Lemburg
> 1 post 3 views
> 3:40 PM
> How to work on a package (11)
> By Roel Schroeven
> 11 posts 34 views
> 3:19 PM
> This topic has been hidden because you reported it for abuse. (+25 more)
> Benchmarking Django on PyPy with unittest? (1)
> By Etienne Robillard
> 6 posts 18 views
> 9:33 AM
> This topic has been hidden because you reported it for abuse. (+18 more)
> Does anyone know ni? (6)
> By Roel Schroeven
> 6 posts 17 views
> 12:15 AM
> This topic has been hidden because you reported it for abuse. +1 more
>
> The above is taken from my small laptop screen showing just how useless 
> google groups is, so it might as well be blown away completely, or is it 
> impossible for the PSF to take on google?
>
> The most that I've ever whacked in one hit was +55 more, all of it the Case 
> Solutions/Test Bank crap.

The PSF doesn't *need* to take on Google, because there are other
newsgroup hosting sites that have less spam. Switch to one of those,
and voila, less spam in your inbox.

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


Re: This newsgroup (comp.lang.python) may soon be blocked by Google Gro

2018-02-08 Thread Mark Lawrence

On 08/02/18 23:33, Chris Angelico wrote:


The PSF doesn't *need* to take on Google, because there are other
newsgroup hosting sites that have less spam. Switch to one of those,
and voila, less spam in your inbox.

ChrisA



I don't see any spam in my inbox as I read on gmane, I'm pointing out 
the disgraceful state of gg and why it should be dropped as it's less 
than useless.


--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


Re: virtualenvwrapper under OpenBSD's ksh & FreeBSD's /bin/sh

2018-02-08 Thread Tim Chase
Giving a nudge here.  I've tried the below process with both
OpenBSD's stock ksh and FreeBSD's stock /bin/sh as my shell and both
seem to have similar errors (the FreeBSD error is less precise about
the line location or the actual error:

/home/tim/.local/bin/virtualenvwrapper.sh: ${}: Bad substitution

but I suspect it's the same).

Is there a way to get `pip install --user virtualenvwrapper` to pull
in a version that supports either ksh or traditional /bin/sh instead
of being yoked to bash/zsh?  Based on that bitbucket.org/dhellmann
link, it sounds like it should at least support ksh.

Thanks,

-tkc


On 2018-02-02 13:10, Tim Chase wrote:
> Under a new user account with ksh (the default) as the shell I
> issued the following:
> 
>   $ pip3 install --user virtualenvwrapper
>   Successfully installed pbr-3.1.1 six-1.11.0 stevedore-1.28.0
> virtualenv-clone-0.2.6 virtualenvwrapper-4.8.2 $ export
> WORKON_HOME=~/code/virtualenvs $ mkdir -p $WORKON_HOME
> 
> Good so far.  Based on
> 
>   https://bitbucket.org/dhellmann/virtualenvwrapper-hg
> 
> it sounds like ksh should be supported.  However when I try to
> enable it, I get:
> 
>   $ . ~/.local/bin/virtualenvwrapper.sh
>   ksh: /home/tim/.local/bin/virtualenvwrapper.sh[97]: ${.sh.file}":
> bad substitution
> 
> The line in question reads
> 
>   virtualenvwrapper.sh: export
> VIRTUALENVWRAPPER_SCRIPT="${.sh.file}"  
> 
> though it's not present in the latest tip version of the source.  I
> tried pulling in that one virtualenvwrapper.sh file from the tip to
> see if that would remedy the issue but it complains
> 
>   $ . ~/tmp/virtualenvwrapper.sh
>   ksh: /home/tim/tmp/virtualenvwrapper.sh[247]: syntax error: `('
> unexpected
> 
> on this line
> 
>  COMPREPLY=( $(compgen -W "`virtualenvwrapper_show_workon_options`"
> -- ${cur}) )
> 
> Is there something I'm missing or need to do to get pip (pip3.6) to
> pull in a working version of virtualenvwrapper for ksh?
> 
> Thanks,
> 
> -tkc
> 
> 
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: This newsgroup (comp.lang.python) may soon be blocked by Google Gro

2018-02-08 Thread Steven D'Aprano
On Thu, 08 Feb 2018 23:40:57 +, Mark Lawrence wrote:

> I don't see any spam in my inbox as I read on gmane, I'm pointing out
> the disgraceful state of gg and why it should be dropped as it's less
> than useless.

Who is it that you think should "drop" Google Groups?

If you mean individual people, it is their choice to use GG or not. I 
understand why some people might choose to use GG in general: it gives a 
reasonably discoverable web interface to Usenet.

Many people don't have access to Usenet, or even know it exists, so using 
GG is an obvious (if sub-par) alternative. (My own ISP appears to have 
dropped Usenet access, *yet again*. Each time they do so, there are 
enough complaints that they bring it back, but they simply don't stop 
trying.)

If you mean that the PSF should drop GG, that's not the PSF's choice to 
make. They don't send data specifically to GG and they can't shut off the 
pipe except by shutting it down for *everyone*. Google simply collects 
the data and mirrors it. The only one who can stop that is Google 
themselves.



-- 
Steve

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


Extracting data from ython dictionary object

2018-02-08 Thread Stanley Denman
I am new to Python. I am trying to extract text from the bookmarks in a PDF 
file that would provide the data for a Word template merge. I have gotten down 
to a string of text pulled out of the list object that I got from using PyPDF2 
module.  I am stuck on now to get the data out of the string that I need.  I am 
calling it a string, but Python is recognizing as a dictionary object.  

Here is the string: 

{'/Title': '1F:  Progress Notes  Src.:  MILANI, JOHN C Tmt. Dt.:  05/12/2014 - 
05/28/2014 (9 pages)', '/Page': IndirectObject(465, 0), '/Type': '/FitB'}

What a want is the following to end up as fields on my Word template merge:
MedSourceFirstName: "John"
MedSourceLastName: "Milani"
MedSourceLastTreatment: "05/28/2014"

If I use keys() on the dictionary I get this:
['/Title', '/Page', '/Type']I was hoping "Src" and Tmt Dt." would be treated as 
keys.  Seems like the key/value pair of a dictionary would translate nicely to 
fieldname and fielddata for a Word document merge.  Here is my  code so far. 

[python]import PyPDF2
pdfFileObj=open('x.pdf','rb')
pdfReader=PyPDF2.PdfFileReader(pdfFileObj)
MyList=pdfReader.getOutlines()
MyDict=(MyList[-1][0])
print(isinstance(MyDict,dict))
print(MyDict)
print(list(MyDict.keys()))[/python] 

I get this output in Sublime Text:
True
{'/Title': '1F:  Progress Notes  Src.:  MILANI, JOHN C Tmt. Dt.:  05/12/2014 - 
05/28/2014 (9 pages)', '/Page': IndirectObject(465, 0), '/Type': '/FitB'}
['/Title', '/Page', '/Type']
[Finished in 0.4s]

Thank you in advance for any suggestions.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Extracting data from ython dictionary object

2018-02-08 Thread dieter
Stanley Denman  writes:

> I am new to Python. I am trying to extract text from the bookmarks in a PDF 
> file that would provide the data for a Word template merge. I have gotten 
> down to a string of text pulled out of the list object that I got from using 
> PyPDF2 module.  I am stuck on now to get the data out of the string that I 
> need.  I am calling it a string, but Python is recognizing as a dictionary 
> object.  
>
> Here is the string: 
>
> {'/Title': '1F:  Progress Notes  Src.:  MILANI, JOHN C Tmt. Dt.:  05/12/2014 
> - 05/28/2014 (9 pages)', '/Page': IndirectObject(465, 0), '/Type': '/FitB'}
>
> What a want is the following to end up as fields on my Word template merge:
> MedSourceFirstName: "John"
> MedSourceLastName: "Milani"
> MedSourceLastTreatment: "05/28/2014"
>
> If I use keys() on the dictionary I get this:
> ['/Title', '/Page', '/Type']I was hoping "Src" and Tmt Dt." would be treated 
> as keys.  Seems like the key/value pair of a dictionary would translate 
> nicely to fieldname and fielddata for a Word document merge.  Here is my  
> code so far. 

A Python "dict" is a mapping of keys to values. Its "keys" method
gives you the keys (as you have used above).
The subscription syntax ("[]"; e.g.
"pdf_info['/Title']") allows you to access the value associated with
"".

In your case, relevant information is coded inside the values themselves.
You will need to extract this information yourself. Python's "re" module
might be of help (see the "library reference", for details).

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