The Wayback Machine - http://web.archive.org/web/20170606181115/http://planetpython.org/

skip to navigation
skip to content

Planet Python

Last update: June 05, 2017 07:48 PM

June 05, 2017


Enthought

Press Release: SciPy 2017 Conference to Showcase Leading Edge Developments in Scientific Computing with Python

Renowned scientists, engineers and researchers from around the world to gather July 10-16, 2017 in Austin, TX to share and collaborate to advance scientific computing tool


AUSTIN, TX – June 6, 2017 –
Enthought, as Institutional Sponsor, today announced the SciPy 2017 Conference will be held July 10-16, 2017 in Austin, Texas. At this 16th annual installment of the conference, scientists, engineers, data scientists and researchers will participate in tutorials, talks and developer sprints designed to foster the continued rapid growth of the scientific Python ecosystem. This year’s attendees hail from over 25 countries and represent academia, government, national research laboratories, and industries such as aerospace, biotechnology, finance, oil and gas and more.

“Since 2001, the SciPy Conference has been a highly anticipated annual event for the scientific and analytic computing community,” states Dr. Eric Jones, CEO at Enthought and SciPy Conference co-founder. “Over the last 16 years we’ve witnessed Python emerge as the de facto open source programming language for science, engineering and analytics with widespread adoption in research and industry. The powerful tools and libraries the SciPy community has developed are used by millions of people to advance scientific inquest and innovation every day.”

Special topical themes for this year’s conference are “Artificial Intelligence and Machine Learning Applications” and the “Scientific Python (SciPy) Tool Stack.” Keynote speakers include:

In addition to the special conference themes, there will also be over 100 talk and poster paper speakers/presenters covering eight mini-symposia tracks including: Astronomy; Biology, Biophysics, and Biostatistics; Computational Science and Numerical Techniques; Data Science; Earth, Ocean, and Geo Sciences; Materials Science and Engineering; Neuroscience; and Open Data and Reproducibility.

New for 2017 is a sold-out “Teen Track,” a two-day curriculum designed to inspire the scientists of tomorrow.  From July 10-11, high school students will learn more about the Python language and how developers solve real world scientific problems using Python and its scientific libraries.

Conference and tutorial registration is open at https://scipy2017.scipy.org.

About the SciPy Conference

SciPy 2017, the sixteenth annual Scientific Computing with Python conference, will be held July 10-16, 2017 in Austin, Texas. SciPy is a community dedicated to the advancement of scientific computing through open source Python software for mathematics, science and engineering. The annual SciPy Conference allows participants from all types of organizations to showcase their latest projects, learn from skilled users and developers and collaborate on code development. For more information or to register, visit https://scipy2017.scipy.org.

About Enthought

Enthought is a global leader in scientific and analytic software, consulting and training solutions serving a customer base comprised of some of the most respected names in the oil and gas, manufacturing, financial services, aerospace, military, government, biotechnology, consumer products and technology industries. The company was founded in 2001 and is headquartered in Austin, Texas, with additional offices in Cambridge, United Kingdom and Pune, India. For more information visit www.enthought.com and connect with Enthought on Twitter, LinkedIn, Google+, Facebook and YouTube.

 

 

The post Press Release: SciPy 2017 Conference to Showcase Leading Edge Developments in Scientific Computing with Python appeared first on Enthought Blog.

June 05, 2017 06:18 PM


Nikola

Nikola v7.8.7 is out!

On behalf of the Nikola team, I am pleased to announce the immediate availability of Nikola v7.8.7. This is a part-emergency bugfix, part-world domination release.

What is Nikola?

Nikola is a static site and blog generator, written in Python. It can use Mako and Jinja2 templates, and input in many popular markup formats, such as reStructuredText and Markdown — and can even turn Jupyter (IPython) Notebooks into blog posts! It also supports image galleries, and is multilingual. Nikola is flexible, and page builds are extremely fast, courtesy of doit (which is rebuilding only what has been changed).

Find out more at the website: https://getnikola.com/

Downloads

Install using pip install Nikola or download tarballs on GitHub and PyPI.

Changes

In an effort to improve interoperability with other static site generators, make importing data easier, and help with world domination, Nikola v7.8.7 ships with support for the following metadata formats:

  • reST-style comments (.. name: value — default format)
  • Two-file format (reST-style comments or 7-line)
  • Jupyter Notebook metadata
  • YAML, between --- (Jekyll, Hugo)
  • TOML, between +++ (Hugo)
  • reST docinfo (Pelican)
  • Markdown metadata extension (Pelican)

In addition, Markdown is now enabled and required by default. More details: https://getnikola.com/handbook.html#metadata-formats

The release also fixes two important bugs, one that crashes when trying to detect locale in some edge cases, and another which made some themes quietly leak template files. If you’re using a Jinja2-based theme that does not have its own parent file, please force a rebuild (nikola build -a).

Features

  • Enable markdown by default (part of Issue #2809)
  • Allowing to register filters from plugins, and allowing to specify default filters as strings of the form filters.<name> (part of Issue #2475)
  • Support ignoring assets via ignore_assets theme meta field (Issue #2812)
  • Ignore unused Colorbox locales (Issue #2812)
  • Accept tag metadata as lists for YAML/TOML (Issue #2801)
  • Support for mapping metadata from other formats to Nikola names using the METADATA_MAPPING setting (Issue #2817)
  • Support for reStructured text docinfo metadata with USE_REST_DOCINFO_METADATA option, defaulting to False (Issue #1923)
  • New HIDE_REST_DOCINFO option, defaulting to False.
  • Support for Markdown Metadata for Pelican compatibility by adding 'markdown.extensions.meta' to MARKDOWN_EXTENSIONS (Issue #1923)
  • Support for YAML and TOML metadata (Issue #2801)

Bugfixes

  • Use inheritance tree when looking for theme engine (Issue #2816)
  • Fix unbound variable error in locale guessing (Issue #2806)

June 05, 2017 03:07 PM


Jean-Paul Calderone

Twisted Web in 60 Seconds: HTTP/2

Hello, hello. It's been a long time since the last entry in the "Twisted Web in 60 Seconds" series. If you're new to the series and you like this post, I recommend going back and reading the older posts as well.

In this entry, I'll show you how to enable HTTP/2 for your Twisted Web-based site. HTTP/2 is the latest entry in the HTTP family of protocols. It builds on work from Google and others to improve performance (and other) shortcomings of the older HTTP/1.x protocols in wide-spread use today.

Twisted implements HTTP/2 support by building on the general-purpose H2 Python library. In fact, all you have to do to have HTTP/2 for your Twisted Web-based site (starting in Twisted 16.3.0) is install the dependencies:

$ pip install twisted[http2]

Your TLS-based site is now available via HTTP/2! A future version of Twisted will likely extend this to non-TLS sites (which requires the Upgrade: h2c handshake) with no further effort on your part.

June 05, 2017 01:56 PM


Caktus Consulting Group

Decorators, Unwrapped: How Do They Work? (PyCon 2017 Must-See Talk 1/6)

Part one of six in the 2017 edition of our annual PyCon Must-See Series, highlighting the talks our staff especially loved at PyCon. While there were many great talks, this is our team's shortlist.

Back when I started coding in Python, I remember that decorators were one of the most difficult concepts for me to understand. At the time, I tried to watch a couple of videos about them to better understand them and ended up with no more clarification.

In her talk Decorators, unwrapped, Katie Silverio uses the example of a “timer” decorator which will log the time any function takes to stdout.

And then, Katie does something really great. She writes some code without any decorators which will act like a decorator. It was a really novel way to teach the audience about how decorators work. I’m looking forward to giving this talk a re-watch the next time I need to use a decorator in some code.

June 05, 2017 01:30 PM


Doug Hellmann

zipfile — ZIP Archive Access — PyMOTW 3

The zipfile module can be used to manipulate ZIP archive files, the format popularized by the PC program PKZIP. Read more… This post is part of the Python Module of the Week series for Python 3. See PyMOTW.com for more articles from the series.

June 05, 2017 01:00 PM


Mike Driscoll

PyDev of the Week: Andrew Godwin

This week we welcome Andrew Godwin (@andrewgodwin) as our PyDev of the Week! Andrew is a core developer of the popular Python web framework, Django. Andrew maintains a blog of his adventures but if you’re more interested in his code, then you’ll want to check out his Github profile. You can also check out some of his projects here. Let’s take a few moments to get to know Andrew better!

Can you tell us a little about yourself (hobbies, education, etc):

Well, I grew up in suburban South London, and initially started programming on my mum’s Palm IIIx in BASIC when I was bored during holidays and longer trips, along with trying out my hand at HTML at the local library. Eventually this turned into me doing Computer Science at Oxford (I almost went for physics, but changed my mind as I wanted an easier life), where I learnt a decent amount of theory that I almost never use in practice, and instead draw on my time writing open source software since I was about 15 and what it’s taught me about maintainability, software architecture and the importance of helping other people.

Hobby-wise, I probably have too many; the one I spend most time on apart from programming (both open-source and noodling away on the occasional game) is probably flying (as in, piloting light aircraft) and then traveling (as in, flying on other people’s aircraft). On the side, I also do electronics, 3D printing/making things, riding my motorbike, archery, photography, cinematography, baking, and when the season is right, snowsports. I’m also on a rough quest to visit every state and territory of the US as well as all 59 of the National Parks, so I have my work cut out.

Why did you start using Python?

I think it was about 2005 and I was looking for an alternative to PHP, having used it for a number of years and finding its organisational features and security features lacking (one of the open source projects I was working on back then, ByteHoard, had several security issues caused by some less-helpful features of the language not combining well with my own lack of experience). I searched around for what other web programming languages were around and stumbled upon a TurboGears tutorial, and liked the look of Python so I tried it out. I wrote in TurboGears for a year or two until I spent a summer working with Simon Willison, who taught me Django and then I’ve been working with Python pretty much ever since.

What other programming languages do you know and which is your favorite?

I only know a few other languages to what I call a “dangerous” level – Java, C#, Arduino C, JavaScript, PHP, and Go. Of the non-Python languages, I’d say C# is probably my favourite, because it’s the other end of the spectrum; strongly typed, interfaces and generics everywhere, but it does it quite a bit better than Java and has some built-in features like LINQ that remind me of Python’s best bits.

I’ve dabbled in a few more, and of those, VHDL maybe has to be the most confusing. It’s a Hardware Description Language – the language you use to program FPGAs, among other things – and because it translates into circuits, what looks like procedural code with if statements actually all executes perfectly in parallel, and assignments don’t take effect until the next clock cycle. It’s fun to make stuff in though, as the end result runs ridiculously fast.

What projects are you working on now?

My main project time goes into doing ongoing development and maintenance on Django Channels (http://channels.readthedocs.io), the project I run for doing message-passing asynchrony and WebSockets. I have a collection of other projects that involve Python in some way; right now, I’m working on my San Francisco version of my 3D LIDAR based map, which I previously did a London version of (http://www.aeracode.org/2016/5/16/hello-london-rising/), a tool for managing my possessions spread across two continents, and a long-term backup solution for all of my files and project code that will hopefully be able to persist things for multiple decades.

A python-adjacent project I’m also working on is starting on making videos about technology and similar subjects (http://www.youtube.com/c/andrewgodwin); I started out with an Arduino tutorial, but I have half a video filmed for my 3D mapping project, and I’m planning to then try to take some of the important parts of my talks and get them down in a more remote-watching-friendly format than a recording of a talk.

Which Python libraries are your favorite (core or 3rd party)?

Of the core libraries, I cannot get along without the collections library, deques especially. I’ve lost count of how many times I’ve turned to it for a sensible datastructure.

Of third-party libraries, I think my current favourites are Twisted, attrs, and of course, requests. Twisted is still my go-to library for networking; their collection of protocols especially makes it nice to throw things together quickly for almost anything on the internet, plus they’re still adding features (and changing as Python does) at an impressive pace for the maturity of the project. Attrs was only introduced to me in the last six months, but it provides what is basically a better version of namedtuples that extends to being able to build normal classes without repetitive constructors. Requests is just such an embedded part of using the Web from Python now that I find it hard to remember how to use urllib.

Where do you see Python going as a programming language?

If you had asked me ten years ago I wouldn’t have said it would end up as the second-most popular language in the world (according to some counts, anyway), but here we are. I think it’s still got a strong future; certainly it is not the young, popular language any more, but I think it hasn’t been that for some time and it’s still approachable and bringing new developers on board.

I also think the Python community, and especially the Django community, helps a lot in this regard. There’s plenty of languages out there, but there’s something to be said for a welcoming, supportive group of people, and we have that in spades with Python. It’s important that we don’t lose sight of the beginners, and the other parts of Python we don’t interact with much – for me, as a web/backend developer, I don’t appreciate the scientific Python community nearly as much as I should, for example.

What is your take on the current market for Python programmers?

I can’t really speak very well to this, as via a series of fortunate events I have not found myself on the open job market for many years now, but based on what I’ve seen of trying to hire, it still seems to very much be an employee’s market for Python programmers, both on the smaller company side and increasingly on the big/corporate company side.

Is there anything else you’d like to say?

Just because it’s not said enough, if there’s an open source project you like and use, take a moment to send a message to the maintainers and say how useful it’s been. About 99% of all the communication open source maintainers basically is about bugs and issues, so the small amount of happy stories we hear are really the thing that keeps us going. And if a project is asking for donations, just think about how long it would have taken you to do the same thing yourself, and if you have the money to spare, consider giving them some. 

Thanks so much for doing the interview!

June 05, 2017 12:30 PM


Kushal Das

Python 101 session this Sunday

This Sunday I took a Python 101 session in the reserved-bit, the local hackerspace in Pune. I was hoping that jetlag (from the PyCon trip) would be over, but it was not the case :( But, starting at 11 AM helped.

There were around 10 participants, and all of them wrote code before in various languages. A few had previous experiences with Python. Because of different Operating Systems, and also not being able to install things on a corporate laptop, my idea of using Microsoft Azure notebook service in this session helped. This also made sure that all of us were using the same version of Python (3.6) and the same environment.

Because of the nature of the participants, I decided to skip various basic examples, and tried to more longer code just after the lunch break. During our reading a file example we figured out that the notebooks are running in Ubuntu 16.04.2 LTS (Xenial Xerus) from the /etc/os-release file.

As a whole this was fun, debugging was easy on the notebooks. At the end when people asked what IDE to try, my default answer PyCharm came up :) Btw, in the image below, on the left-hand side, you can see a function call we wrote in the session to get the latest cricket match score using requests module :)

June 05, 2017 11:49 AM


Django Weekly

This week in Django - Issue No 41 - 1 June 2017

Worthy Read

In that post, we learned how to use the built in Token based authentication in DRF. In this post, we will learn more about JSON Web Tokens aka JWT and we will see if JWT can be a better authentication mechanism for securing our REST APIs.
json web token

One distinct advantage that the the Microsoft stack provides to an enterprise is single sign on (SSO) capabilities through active directory using Windows authentication. Users do not want to remember many passwords (and often times refuse to, storing them in an un-secure manner instead). SSO solves this problem nicely. However Django & Python have no built in mechanism or documentation to take advantage of this technology. So lets go through the steps to set it up.
windows
,
authentication

Know when and why code breaks
sponsor

Viewflow is the reusable workflow library for Django, that helps to implement people collaboration software. Viewflow takes best parts from two worlds. It is based on BPMN?—?business process modeling and notation standard. And plays well with modern web development toolchain.
workflow

This is a guide for setting up Memcached for Django locally and in a production environment. Memcached is an open source caching system that has support for Python bindings through python-memcached and can run as a daemon.
memcached

We help companies like Airbnb, Pfizer, and Artsy find great developers. Let us find your next great hire. Get started today.
sponsor

If you are into cryptocurrency check out Ethereumweekly.com started by a friend. It's a weekly newsletter on all things Ethereum, Blockchain. A good way to understand what the buzz on cryptocurrency is all about.
weekly

DRF

Tweet
humor

For those using Atom Editor.
editor


Projects

django-horizon - 23 Stars, 0 Fork
Simple database sharding (horizontal partitioning) library for Django applications.

django-slack-events-api - 7 Stars, 1 Fork
Slack Events API adapter as a Django app

django-call-prevention - 0 Stars, 0 Fork
Mocks automatically during testing time

June 05, 2017 09:58 AM


Armin Ronacher

Diversity in Technology and Open Source

It's a topic I generally do not talk much about but a recent Wired Article made me think about finally writing down my thoughts on this topic. The title of that article was “Diversity in Open Source Is Even Worse Than in Tech Overall” and that is undoubtedly true.

When you start an Open Source project today, in particular one which is further disconnected from frontend technologies there is a very high chance the organic community development will be everything but diverse. The highest form of diversity you can naturally expect to form is people from different countries but even there you might have a bias.

There are many arguments that can be had about this, but it's my personal opinion that at least in the longer run it's not healthy for a project or a community to lack diversity. I think it's natural for like-minded people to group together but the longer that process continues the more of an echo chamber it becomes. What's worse is the longer you wait to try to get people involved in the project that would naturally not try to join the harder it will be. When your team is 4 men, the first woman which joins will make a significant impact. When your team is already 20 men you need to get a lot more women on board to have the same impact. But it's not just gender that is making a difference, it's in particular cultural backgrounds. The reason Unicode is hard is not because Unicode is hard, but because a lot of projects start out with a lack of urgency since many of the original developers might live in ASCII constrained environments (It took emojis to become popular for people to develop a general understanding of why Unicode is useful in the western world).

A lot of the criticism that comes against the diversity movement is that it undermines the idea of “meritocracy” and that it does not mirror the realities in the real world by artificially balancing teams. Both of those arguments are weird in a way because they are very hard to defend if you look at larger parts of society. Tech for recent historical reasons is very male heavy but society is not. Meritocracy in many ways is just sourcing the best from the pool of naturally available people in your environment. Sure by some measurements you will get the best but is the best really what is lacking in an Open Source project? We don't need more of the best, we need more of what is actually missing and what is missing in many ways is not more strong alpha males but people that are good in de-escalating arguments in bug trackers and mailing lists, people that take care of documentations, people that make software work in new cultural contexts (localization, globalization, internationalization, etc.), people that care about user experience etc.

If you look at Open Source projects in comparison with commercial software you can quickly see where this lack of diversity is noticeable the most: consumer applications. While we're doing reasonably well with low level technology that never translated well to things that consumers care about. The most successful consumer products that came out of the Open Source community are probably things like The Gimp. A project that not only has a ridiculous name for a consumer product, but also one that is everything but user friendly. If you do a Google auto complete search for “Why is Gimp” it completes to “slow [on mac]”, “bad”, “complicated” and “unintuitive”. In many ways I think the answer is probably a reflection of the developer community lacking focus in some key areas. There is no reason that Open Source software has to be user unfriendly.

In particular some of the infamous Open Source communities like the Linux are (almost?) proud of their harsh culture. Often documentation is so bad that it became a rite of passage to decipher it or fill in the blanks by reading the code.

The only way to achieve the (in my mind) necessary change in Open Source and tech in general is to go out of ones way to involve people that do not come naturally.

So when someone cancels a conference because the speaker lineup after a blind selection was 100% male it just shows how bad the imbalance in the developer community is. It's not unfair to try to artificially bring balance a conference because the fact that the community is this imbalanced to that extend is a problem that needs fixing and will not fix itself naturally.

June 05, 2017 12:00 AM

June 04, 2017


Catalin George Festila

The SpeechRecognition python module - part 001.

First you need to install the SpeechRecognition python module for Windows 10:

C:\Python27>cd Scripts
C:\Python27\Scripts>pip install --upgrade --trusted-host pypi.python.org SpeechRecognition
Collecting SpeechRecognition
Downloading SpeechRecognition-3.6.5-py2.py3-none-any.whl (31.8MB)
100% |################################| 31.8MB 4.9MB/s
Installing collected packages: SpeechRecognition
Found existing installation: SpeechRecognition 3.5.0
Uninstalling SpeechRecognition-3.5.0:
Successfully uninstalled SpeechRecognition-3.5.0
Successfully installed SpeechRecognition-3.6.5
The next step is the PyAudio python module:
C:\Python27\Scripts>pip install --upgrade  --trusted-host  pypi.python.org  PyAudio
Collecting PyAudio
Downloading PyAudio-0.2.11-cp27-cp27m-win32.whl (49kB)
100% |################################| 51kB 258kB/s
Installing collected packages: PyAudio
Found existing installation: PyAudio 0.2.9
Uninstalling PyAudio-0.2.9:
Successfully uninstalled PyAudio-0.2.9
Successfully installed PyAudio-0.2.11
Also this python module can be install under python version 3.4.1:
C:\Python34\Scripts>pip install SpeechRecognition
Downloading/unpacking SpeechRecognition
Installing collected packages: SpeechRecognition
Successfully installed SpeechRecognition
Cleaning up...
The problem with Python 3.4.x version is PyAudio python module installation.
Anyway I used the python 2.7.13 version to test this module with a simple python script:
import speech_recognition as sr
import os
print "HELP: Set your microphone hardware on and try this script"
def active_listen():
r = sr.Recognizer()
with sr.Microphone() as src:
audio = r.listen(src)
msg = ''
try:
msg = r.recognize_google(audio)
print (msg.lower())
except sr.UnknownValueError:
print("Google Speech Recognition could not understand audio")
except sr.RequestError as e:
print("Could not request results from Google STT; {0}".format(e))
except:
print("Unknown exception occurred!")
finally:
return msg.lower()
active_listen()
Just start your microphone hardware on and run the script.
Working well for me this test.

June 04, 2017 09:32 AM

The development with python-instagram .

The python-instagram python module is a Python 2/3 client for the Instagram REST and Search APIs.
This python module requires: httplib2, simplejson and six.
Instagram API uses the OAuth2 protocol for authentication, see docs.

C:\Python27\Scripts>pip install --upgrade  --trusted-host  pypi.python.org  
python-instagram
Collecting python-instagram
  Downloading python-instagram-1.3.2.tar.gz
Collecting simplejson (from python-instagram)
  Downloading simplejson-3.10.0-cp27-cp27m-win32.whl (66kB)
    100% |################################| 71kB 1.1MB/s
Requirement already up-to-date: httplib2 in c:\python27\lib\site-packages
(from python-instagram)
Requirement already up-to-date: six in c:\python27\lib\site-packages
(from python-instagram)
Building wheels for collected packages: python-instagram
  Running setup.py bdist_wheel for python-instagram ... done
 ...
Installing collected packages: simplejson, python-instagram
Successfully installed python-instagram-1.3.2 simplejson-3.10.0
Now about this python module:
C:\Python27>python.exe
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from instagram.client import InstagramAPI
>>> dir(InstagramAPI)
['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__',
'__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__',
'__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_make_relationship_shortcut',
'_make_subscription_action', 'access_token_field', 'access_token_url', 'api_name',
'approve_user_request', 'authorize_url', 'base_path', 'block_user', 'change_user_relationship',
'create_media_comment', 'create_subscription', 'delete_comment', 'delete_subscriptions',
'exchange_code_for_access_token', 'exchange_user_id_for_access_token',
'exchange_xauth_login_for_access_token', 'follow_user', 'geography_recent_media',
'get_authorize_login_url', 'get_authorize_url', 'host', 'ignore_user_request', 'like_media',
'list_subscriptions', 'location', 'location_recent_media', 'location_search', 'media',
'media_comments', 'media_likes', 'media_popular', 'media_search', 'media_shortcode', 'protocol',
'redirect_uri', 'tag', 'tag_recent_media', 'tag_search', 'unblock_user', 'unfollow_user',
'unlike_media', 'user', 'user_followed_by', 'user_follows', 'user_incoming_requests',
'user_liked_media', 'user_media_feed', 'user_recent_media', 'user_relationship', 'user_search',
'x_ratelimit', 'x_ratelimit_remaining']
If you have a instagram account then just log in into instagram developer website.
Then fill the issue about your website the phone mumber and what do you want to build for your application check your agreement with Instagram.
Now you need to use Register Your Application and finally on Register a New Client.
About Register Your Application you need to fill the with data for your application ( basic info: Description, Company Name, Website URL, Contact email).
Select the tab Security and disable the Disable implicit OAuth.

About the token authorizations:

Is given to you with this words:

basic – to read a user’s profile info and media

or needs additional permission:

public_content – to read any public profile info and media on a user’s behalf
follower_list – to read the list of followers and followed-by users
comments – to post and delete comments on a user’s behalf
relationships – to follow and unfollow accounts on a user’s behalf
likes – to like and unlike media on a user’s behalf
The next step is to get access token then you need to add http://localhost link into Security tag from Manage Client.
Use this url to get the access token by paste it into your web browser.
https://instagram.com/oauth/authorize/?client_id=[CLIENT_ID_HERE]&redirect_uri=http://localhost&response_type=token&scope=public_content
Into the browser you will see one page with one button for Authorizing access.
Press this button and into your browser address bar you will get the access token like:
http://localhost/#access_token=################
A simple python script to test it.
from time import sleep
from instagram.client import InstagramAPI

client_id="zzzzz"
client_secret="sssssssssssss"
redirect_uri= "http://xxxxx"
access_token="eeeee"

api = InstagramAPI(client_id=client_id, client_secret=client_secret)
print dir(api)
print api.api_name
To deal with python and instagram is not very easy for me.
The main reason come from errors and the instagram api development way.
Some simple tasks are very hard to do.

June 04, 2017 08:42 AM

June 03, 2017


François Dion

Readings in Technology

"Ex-Libris" part III


I've made available part 3 of my "ex-libris" of a Data Scientist. This one is on Technology, from some historical perspective (ie. Turing, Shannon, Von Neuman) all the way to the most recent trends (ie. Ansible, Docker, Cloud, Continuous Integration, Performance etc) and can be found on LinkedIn:

"ex-libris" of a Data Scientist - Part III

My CES Industries EdLab model #804, in the History section


See also


Part I was on "data and databases": "ex-libris" of a Data Scientist - Part i

Part II, was on "models": "ex-libris" of a Data Scientist - Part II

Part IV is right around the corner, and will have a significant Python section.



Francois Dion
@f_dion

June 03, 2017 10:08 PM


Weekly Python StackOverflow Report

(lxxvi) stackoverflow python report

These are the ten most rated questions at Stack Overflow last week.
Between brackets: [question score / answers count]
Build date: 2017-06-03 20:06:40 GMT


  1. Why are arbitrary target expressions allowed in for-loops? - [35/4]
  2. iter() not working with datetime.now() - [29/2]
  3. itertools does not recognize numpy ints as valid inputs on Python 3.6 - [13/4]
  4. Python, I'm repeating myself a lot when it comes to for loops and there must be a better way - [9/4]
  5. Show group on every record in groupby - [8/2]
  6. correct way to add custom (deep) copying logic to a python class - [8/0]
  7. Python type hinting with exceptions - [7/2]
  8. How to find top n values in row of dataframe - [7/2]
  9. Python/R: generate dataframe from XML when not all nodes contain all variables? - [6/4]
  10. Why is processing a random list so much faster than processing an ordered list? - [6/2]

June 03, 2017 08:34 PM


qutebrowser development blog

Getting started again

As you all probably know already, the crowdfunding for qutebrowser ended up being more than fully funded - thanks to everyone again!

The funds arrived on my bank account yesterday, minus some 10% fees for Kickstarter and payment processing. Yesterday also was the last day with lectures before my summer holidays!

Since Monday is a public holiday, I decided to spend some time today on sending out the stickers to everyone who doesn't have a t-shirt, and then continue next Tuesday with day 2.

Over the last few days, I also spent some time on getting QtWebEngine more ready:

For people who have t-shirts in their pledges, a survey will follow soon - I still need to sort out some things about available colors and sizes first.

If you're reading this via the Python or Qt planet, note that I won't post future minor updates there - if you want updates about what I'm doing currently (a few times per week), check the qutebrowser development blog!

June 03, 2017 07:32 PM


Davy Wybiral

Rainbow-powered Raspberry Pi

Some shots of my current RPi3 cluster...



June 03, 2017 10:58 AM


BangPypers

How BangPypers meetup is run

What is BangPypers?


BangPypers is a twelve year old group started by Anand B Pillai. For Half a decade meetup group is the anchor for organizing Python meetups in Bangalore. During the period, co-organizer has devised working for the team.

Event Types?

In last five years, the team organized Sixty-four meetups. Few early volunteers left the team. Moved to different city, nation, and continent. Kudos to everyone!

The events are half-day or whole day event. There are three main events; Talks, Workshops and Dev Sprints.

Talks are half a day event with minimum three speakers. Sometimes with six speakers. On an average, each session lasts for thirty to forty minutes. The team calls this as full-length talks. Another version of the talks is short talks or Flash talks of duration ten minutes.

Next format is the workshop. Workshops are a complete hands-on event for a half day or full day. The one or two speakers come together and handle a session.

The last format is Dev Sprint. Dev Sprint is a half a day or full day event. The developers visit the premise and work on the FOSS projects. Sometimes maintainers of the projects attend the event and help participants contribute.

All three event formats take different effort to organize. For example, talks and dev sprint require a higher degree of co-ordination to find speakers and mentors.

What are the task involved?

Venue

Finding the place for the meetup was hard in the beginning. Running a meetup in the same location, again and again, projects a company runs the meetup. Initial days were hard to find the venue. Friends and group members helped a lot. Later, attendees and business outreach team got in touch with us. Ninety participants attended the last meetup. Now the challenge is to find a bigger venue. When a company contacts us in meetup page or email to host us, we ask a handful of questions. Following are few

In the past, we have forgotten to ask these questions and had issues. Some companies require participants to carry a Government issued Identification Card. Other companies ask for participants names in advance. We don’t share members contact information. One day before the event, the host coordinator receive the attendees name list. In one or two days, after the event, a volunteer sends out venue specific feedback to the hosts with a ‘Thank you’ note.

Speakers

The speakers and topic attract the audience for the meetup. The compelling content pulls the audience to step out of the house on the weekend. For a workshop, one speaker is sufficient and with few folks to help. Finding speakers for talks is the real challenge. Call for speakers happens three weeks before the event. A volunteer sends out an email to meetup group and mailing list. Then an announcement hits Twitter and FaceBook with Meetup link. The interested audience reply in email or comment on the meetup page. Sometimes talk slots are taken in a day, and sometimes there is one free slot. A follow-up is sent in next week when a talking slot is empty.

RSVP

The team's biggest challenge is knowing how many will attend the meetup. Till date, all the events were free of cost. So interested participants RSVP. Not everyone who showed interest show up for the event. During initial days, only 20% of participants who showed interest attended the meetup. Now the ratio is above 50%. RSVP opens six days before the event with 2X venue capacity with the open waitlist. Three days before a volunteer sends out an email to all participants who showed interest to un-RSVP in the case of any change in plans.

Managing meetup page

The meetup page contains details of every meetup. RSVP is accepted only on the meetup page. The members can message organizer for queries about participation, hiring, a chance for a speaking slot, hosting the meetup. The Volunteers answer the questions in the event comment section. The comment section is used differently before and after the meetup.

On the day

A volunteer reaches the venue half an hour before the start time and oversees the setup. During the meetup, volunteers introduce speakers, keep track of talk timings, share feedback link and answer individual queries. The volunteer also takes few pictures.

Blog

From the beginning, BangPypers event reports are available on the blog. Every event has a separate blog post about attendees count, how was the event, photos, and other details. The blog post goes on to social networks, meetup group, and mailing list.

Feedback form

Feedback is the fruit of the event. Feedback gives us the sense of participants thoughts, a chance for speakers to improve, where did the organizing team slip and what do members expect from future meetups. Our feedback form is Google forms and shared at the end of the meetup. The feedback form has multiple choice questions and one optional text question.

Planning

The team uses Email and Whatsapp for internal communication to discuss labor sharing, whom to contact for the venue, what topics to discuss and who will be available during the meetup, how can we and post-mortem. During any month, the volunteers start planning for next two meetups. Whether the next meetups are workshop or talks, where to host etc. You can see the team members in the meetup group co-organization section.

Video

In last three meetups, a volunteer record talks using an iPhone and uploads to YouTube channel. The video coverage is still at the experimental stage.

The organizing team spends a significant amount of time doing all the work. On an average, the team, not an individual spends somewhere between twelve to fifteen hours monthly to run the meetup.

It has taken years for us to reach this place. If you have read this far and manage a meetup group, take a couple of hours and write up how you organize the meetup. All of us can learn from each other.

Next blog post is about lessons from organizing the meetup. Stay tuned.

June 03, 2017 08:18 AM


Programming Ideas With Jake

Another Look at Instance-Level Properties in Python

I revisit an old idea of making properties be instance-specific and re-implement it in a much cleaner and more elegant way.

June 03, 2017 05:00 AM


Sandipan Dey

Some NLP: Probabilistic Context Free Grammar (PCFG) and CKY Parsing in Python

This problem appeared as an assignment in the coursera course Natural Language Processing (by Stanford) in 2012. The following description of the problem is taken directly from the assignment description. In this article, a probabilistic parser will be built by implementing the CKY parser. The Manually Annotated Sub-Corpus (MASC) from the American National Corpus (ANC): … Continue reading Some NLP: Probabilistic Context Free Grammar (PCFG) and CKY Parsing in Python

June 03, 2017 12:39 AM

June 02, 2017


François Dion

Raspberry Pi 3 Canakit

It's been a long time...


I don't even remember when was the last time I talked about Raspberry Pi hardware on my blog. I do remember the first time, however, some 5 years ago. Meanwhile, the price of Raspberry Pis have both gone down (Zero) and up (Raspberry Pi 3) due to economies of scale, Moore's law and removal / addition of components from the various versions.

Raspberry Pi 3


So, I realize that I've covered everything from the original Raspberry Pi model B with 256MB of ram, all the way to the Raspberry Pi 2 and Zero, but nothing on the Raspberry Pi 3. I typically don't buy kits, but I picked one up to see how that would work for people who had never used a Raspberry Pi before. The reason there is that I suggested to my fellow data scientists (and those interested by data science, and whoever else who reads my posts) to also be technologists, to get better acquainted with technology and hardware. And to get one (or four - I'll follow up on that) Raspberry Pi 3. I wanted to make sure it would be smooth sailing.

The Canakit



I ordered a Canakit with a Raspberry Pi board and two heatsinks, a case, a 2.5A power supply and a guide. It is convenient to get a single ready to go package quickly, particularly with free 2nd day shipping (you know who).

I say ready to go, but not quite. Of course you'll need a monitor, keyboard and mouse if you don't enable ssh (distro dependent ways, some have ssh enabled by default). But you'll also need an SD card.

No SD card?


The kit I ordered basically got you the case, heatsinks and power supply for $15 above the price of the Raspberry Pi 3. But no microSD card. The step above kit includes a microSD card with the OS already pre-installed, but when I looked at it, the price difference was too much for just that and a plain HDMI cable.

Oh, but it's so hard to prepare an SD card! Don't panic. Use Etcher. Later, when you get your command line skills up, you'll be able to do it with dd.

If you get stuck, leave a comment or contact me on twitter

Francois Dion
@f_dion

June 02, 2017 09:03 PM


Python Data

Visualizing data – overlaying charts in python

Visualizing data is vital to analyzing data.  If you can’t see your data – and see it in multiple ways – you’ll have a hard time analyzing that data.  There are quite a few ways to visualize data and, thankfully, with pandas, matplotlib and/or seaborn, you can make some pretty powerful visualizations during analysis.

One of the things I like to do when I get a new dataset is try to visualize data points against each other to see if there’s anything that jumps out at me.   To do this, I like to overlay charts against each other to find any patterns in the data / charts. With matplotlib, this is pretty easy to do but working with dual-axis can be a bit confusing at first.


Want  to learn more about data visualization and/or matplotlib? Here are a few books / websites with good info on the topic.


One chart that I like to look at for data that I know has a relationship – like sales revenue and number of widgets sold – is the dual overlay of revenue vs quantity.  An example of one of my go-to approaches for visualizing data is in Figure 1 below.

Visualizing data - revenue vs number of itemsFigure 1: Visualizing data — Revenue vs Quantity chart overlay

In this chart, we have Monthly Sales Revenue (blue line) chart overlay-ed against the Number of Items Sold chart (multi-colored bar chart). This type of chart lets me quickly see if there are any easy patterns in the revenue vs # of items.

I’ve not found a quick/easy way to build the multi-colored bar chart without hacking the data and building each colored section manually…so if you know a better way that what I share below, let me know.

An example

Here’s my code for building this chart using this data.

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

%matplotlib inline # needed for jupyter notebooks

plt.rcParams['figure.figsize']=(20,10) # set the figure size
plt.style.use('fivethirtyeight') # using the fivethirtyeight matplotlib theme

sales = pd.read_csv('examples/sales.csv') # Read the data in
sales.Date = pd.to_datetime(sales.Date) #set the date column to datetime
sales.set_index('Date', inplace=True) #set the index to the date column

# now the hack for the multi-colored bar chart: 
# create fiscal year dataframes covering the timeframes you are looking for. In this case,
# the fiscal year covered October - September.
# --------------------------------------------------------------------------------
# Note: This should be set up as a function, but for this small amount of data,
# I just manually built each fiscal year. This is not very pythonic and would
# suck to do if you have many years of data, but it isn't bad for a few years of data. 
# --------------------------------------------------------------------------------

fy10_all = sales[(sales.index >= '2009-10-01') & (sales.index < '2010-10-01')]
fy11_all = sales[(sales.index >= '2010-10-01') & (sales.index < '2011-10-01')]
fy12_all = sales[(sales.index >= '2011-10-01') & (sales.index < '2012-10-01')]
fy13_all = sales[(sales.index >= '2012-10-01') & (sales.index < '2013-10-01')]
fy14_all = sales[(sales.index >= '2013-10-01') & (sales.index < '2014-10-01')]
fy15_all = sales[(sales.index >= '2014-10-01') & (sales.index < '2015-10-01')]

# Let's build our plot

fig, ax1 = plt.subplots()
ax2 = ax1.twinx()  # set up the 2nd axis
ax1.plot(sales.Sales_Dollars) #plot the Revenue on axis #1

# the next few lines plot the fiscal year data as bar plots and changes the color for each.
ax2.bar(fy10_all.index, fy10_all.Quantity,width=20, alpha=0.2, color='orange')
ax2.bar(fy11_all.index, fy11_all.Quantity,width=20, alpha=0.2, color='gray')
ax2.bar(fy12_all.index, fy12_all.Quantity,width=20, alpha=0.2, color='orange')
ax2.bar(fy13_all.index, fy13_all.Quantity,width=20, alpha=0.2, color='gray')
ax2.bar(fy14_all.index, fy14_all.Quantity,width=20, alpha=0.2, color='orange')
ax2.bar(fy15_all.index, fy15_all.Quantity,width=20, alpha=0.2, color='gray')

ax2.grid(b=False) # turn off grid #2

ax1.set_title('Monthly Sales Revenue vs Number of Items Sold Per Month')
ax1.set_ylabel('Monthly Sales Revenue')
ax2.set_ylabel('Number of Items Sold')

# Set the x-axis labels to be more meaningful than just some random dates.
labels = ['FY 2010', 'FY 2011','FY 2012', 'FY 2013','FY 2014', 'FY 2015']
ax1.axes.set_xticklabels(labels)

This is just one way of visualizing data with python. Hopefully its a good example of a different approach that you may not have thought about.

The post Visualizing data – overlaying charts in python appeared first on Python Data.

June 02, 2017 07:54 PM


Frank Wierzbicki

Jython 2.7.1 release candidate 2 released!

On behalf of the Jython development team, I'm pleased to announce that the second release candidate of Jython 2.7.1 is available! This is a bugfix release. Bug fixes include improvements in ssl and pip support.

Please see the NEWS file for detailed release notes. This release of Jython requires JDK 7 or above.

This release is being hosted at maven central. There are three main distributions. In order of popularity:

To see all of the files available including checksums, go to the maven query for org.python+Jython and navigate to the appropriate distribution and version.

June 02, 2017 07:45 PM


PyBites

Flask Sessions

In this quick post I discuss Flask Sessions and provide a few use cases.

June 02, 2017 01:44 PM


Import Python

ImportPython Issue 127 - Python Functions aren't what you think, API checklist and more

Worthy Read

Python functions cannot have names. In this world view, every function is a nameless, anonymous object. Code like "def to_percent(numbers)" creates a nameless function object, then stores it in a variable called "to_percent".
core-python
,
functions

Useful checklist for build good Python libraries APIs. Based on "How to make a good library API" PyCon 2017 talk.
checklist

Know when and why code breaks
sponsor

This is a presentation I gave at a local python user group in Nashville, PyNash. The topic of the night was to pick a lesser-known or up and coming library that many folks may not be aware of yet and give a 10 minute overview.
video

easyrbac has a very simple API to interact around and create Roles and Users
role

If you are into cryptocurrency check out Ethereumweekly.com started by a friend. It's a weekly newsletter on all things Ethereum, Blockchain. A good way to understand what the buzz on cryptocurrency is all about.
newsletter

I recently began investing and was wondering how good analysts are at predicting the future of a company.
pandas

In this post, we will be trying to make a text classifier that will make use of the 20 news groups dataset originally developed by Ken Lang to classify documents into different categories based on their content.
machine learning

YAML stands for "YAML Ain't Markup Language" and is mostly used in configuration files. YAML, in contrary to JSON, is made to be very readable and is not designed to be used for api's or other communication protocols. This is because the parsing of a YAML file requires the computer a little bit more effort than parsing a JSON file.
YAML

We help companies like Airbnb, Pfizer, and Artsy find great developers. Let us find your next great hire. Get started today.
sponsor

Web app to convert syntax.
curl

Solution to Oliver Roeder puzzle in in FiveThirtyEight called “The Riddler”.
numpy
,
pandas
,
quiz
,
puzzle

codesnippet

Bokeh is a powerful open source Python library that allows developers to generate JavaScript data visualizations for their web applications without writing any JavaScript. While learning a JavaScript-based data visualization library like d3.js can be useful, it's often far easier to knock out a few lines of Python code to get the job done.
chart

core-python
,
dict

oops


Projects

pmbootstrap - 312 Stars, 15 Fork
Sophisticated chroot/build/flash tool to develop and install postmarketOS

gitsuggest - 193 Stars, 6 Fork
A tool to suggest github repositories based on the repositories you have shown interest in.

python-QuickUI - 90 Stars, 2 Fork
Scientific One-Liner Interactive GUI Library

asgiworker - 10 Stars, 1 Fork
An ASGI Gunicorn worker class.

paragraph2vec - 10 Stars, 2 Fork
Paragraph Vector Implementation

news-audit - 3 Stars, 0 Fork
Fake news detection, Google Summer of Code 2017

June 02, 2017 10:15 AM


Python Bytes

#28 The meaning of _ in Python

<p><strong>Brian #1:</strong> <a href="http://pep8.org/"><strong>pep8.org : PEP 8 — the Style Guide for Python Code</strong></a></p> <ul> <li>"This stylized presentation of the well-established PEP 8 was created by Kenneth Reitz (for humans)."</li> <li>From PEP 8: "This document gives coding conventions for the Python code comprising the standard library in the main Python distribution."</li> <li>PEP8 is not only used for the standard library. Many if not most open source Python packages adhere to at least most of the PEP8 recommendations</li> <li>testing plugins can help you make sure your code meets the guidelines (for good or bad).</li> <li>The pep8.org presentation is easy to read, with a left side clickable table of contents.</li> <li>Nice color coded examples. Green for good, Red for bad.</li> <li>links to specific items make it easy to share with others something specific.</li> <li>Good advice, but don't be a pep8-bully.</li> </ul> <p><strong>Michael #2:</strong> <a href="https://pypi.python.org/pypi/tokio"><strong>Tokio: Asyncio event loop written in Rust language</strong></a></p> <ul> <li>Asyncio event loop written in Rust language</li> <li>It is still in alpha stage. </li> <li>It provides most of asyncio event loop apis, except udp. </li> <li>TCP api is more or less stable</li> <li>Aiohttp tests pass with tokio loop (~1800 tests)</li> <li>Mostly interesting as an example of Rust + Python</li> <li>Project is still in early stage of development</li> </ul> <p><strong>Brian #3:</strong> <a href="https://www.python-boilerplate.com"><strong>Python Boilerplate</strong></a></p> <ul> <li>Interactive online tool for creating script and small project boilerplate code.</li> <li>Just starting, with "how to help" link.</li> <li>Select <ul> <li>Python 2 or 3</li> <li>executable script or not</li> <li>argparse</li> <li>logging</li> <li>.gitignore</li> <li>Flask</li> <li>unittest or pytest</li> <li>tox</li> </ul></li> <li>fills in main.py, plus other files like test_sample.py, requirements.txt, tox.ini, etc.</li> </ul> <p><strong>Michael #4:</strong> <a href="https://www.youtube.com/watch?v=66XoCk79kjM"><strong>Instagram switching to Python 3 on one branch</strong></a></p> <ul> <li>Ancient Django but still productive</li> <li>Ran out of 32-bit user IDs before they ran out of Django power. </li> <li>Added sharing support to Django Orem</li> <li>Turned off GC for perf</li> <li>Upgraded entirely to 3.6 in a few months</li> <li>Why? <ul> <li>Type hints</li> <li>Scaling server perf</li> <li>asyncio</li> </ul></li> <li>Python 3 is where the future community work is happening </li> <li>Strategies <ul> <li>No user impact</li> <li>Still shipping</li> <li>Testing process was interesting</li> </ul></li> <li>This is a concrete roadmap for every large company</li> </ul> <p><strong>Brian #5:</strong> <a href="https://dbader.org/blog/meaning-of-underscores-in-python"><strong>The Meaning of Underscores in Python</strong></a> </p> <ul> <li>single and double underscore meanings</li> <li>dunder is "double underscore" <ul> <li>Single Leading Underscore: <code>_var</code></li> </ul></li> <li>method or variable for internal use</li> <li>convention only</li> <li>doesn't apply to <code>collection.namedtuple</code> <ul> <li>Single Trailing Underscore: <code>var_</code></li> </ul></li> <li>used to avoid name collision with keywords <ul> <li>Double Leading Underscore: <code>__var</code></li> </ul></li> <li>internal use by a single class level.</li> <li>Python will name mangle this so that subclasses don't have to avoid parent class double leading underscore names <ul> <li>Double Leading and Trailing Underscore: <code>__var__</code></li> </ul></li> <li>no name mangling</li> <li>special names. dunder methods</li> <li><code>__call__</code> and <code>__init__</code>, etc. <ul> <li>Single Underscore: <code>_</code></li> </ul></li> <li>in code : temp variable, don't care variable</li> <li>won't get a warning if you don't reference it again</li> <li>in REPL: last value</li> </ul> <p><strong>Michael #6:</strong> <a href="https://medium.com/@trstringer/the-future-is-looking-bright-for-python-95a748a4ef3e"><strong>The future is looking bright for Python</strong></a></p> <ul> <li>Stack Overflow recently released a cool new tool called <a href="https://insights.stackoverflow.com/trends">Trends</a> (previously covered)</li> <li>Check out the <a href="https://insights.stackoverflow.com/trends?utm_source=so-owned&amp;utm_medium=blog&amp;utm_campaign=trends&amp;utm_content=blog-link&amp;tags=java%2Cc%2Cc%2B%2B%2Cpython%2Cc%23%2Cvb.net%2Cjavascript%2Cassembly%2Cphp%2Cperl%2Cruby%2Cswift%2Cr%2Cobjective-c">Most Popular Languages</a> trend chart</li> <li>Python has, by a very large margin, the greatest positive slope (future?)</li> <li>And <a href="https://insights.stackoverflow.com/trends?tags=python-2.7%2Cpython-3.x">Py3 vs Py2</a></li> </ul>

June 02, 2017 08:00 AM


Kushal Das

My lightning talk in Django Girls PyCon

In the weekend before PyCon US, we had a Django Girls PyCon workshop in Portland on 12th-13th May. On 12th there were a few lightning talks, and installation before the actual workshop started on 13th.

I gave a lightning talk about PyCon US, mostly focusing the volunteer nature of the conference, and why attending the sprints is a good idea. Anwesha and /me stayed back for few more talks and later moved out to have dinner with a friend. Later, during the conference, and sprints I met many from the workshop. I want to thank Terian, and other organizers for doing the amazing work behind the workshop.

June 02, 2017 05:53 AM