Pretty-Print JSON and Move It to the Command Line

Building a Pretty Print Program
In Python, pretty-printing is very straight forward. It only needs the use of the built-in JSON library and the use of the dumps method. Given any data, the following code can format and sort the keys of JSON and print it to the console.
import json
json.dumps(json_data, indent=4, sort_keys=True)
Creating Work-Flow
To this single line, we need to add the argsparse code so that it can take input parameters and add a help function as well.

Link: https://dzone.com/articles/pretty-print-json-and-move-it-to-command-line?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

Another Look at Instance-Level Properties in Python

A while back, I did a post on making instance-level properties in Python where the implementation of it required inheritance as well as messing with __getattribute__() and __setattr__(), which are a little dangerous to mess with. Then I had another idea last night (as of the time of writing this): Use normal descriptors to delegate to “Delegated Properties” (name taken from Kotlin, the original inspiration). These Delegated Properties can be designed very simply in a way that they only have to worry about the value of one instance, instead of figuring out how to store the value per instance.
A note before we begin: this was going to be my first article where I put type annotations on all of my Python code in order to help make it more readable. While typing up all the code to make sure this idea was viable, I did actually add type annotations everywhere but seeing that this idea is super generic with very few actually helpful type annotations, I decided to forgo them in this article. You can be sure that the next time I write a Python article, the code will be annotated.

Link: https://dzone.com/articles/another-look-at-instance-level-properties-in-pytho?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

PyDev of the Week: Harrison Kinsley

This week’s PyDev of the Week is Harrison Kinsley. Harrison is the creator of a popular Python Youtube tutorial channel. He also maintains a website that is kind of a text version of his video tutorials. Let’s take a few moments to get to know Harrison better!
Can you tell us a little about yourself (hobbies, education, etc):

Link: https://dzone.com/articles/pydev-of-the-week-harrison-kinsley?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

New & Upcoming Course Highlights: Python & Java Practice Sessions

Every week, new courses and workshops are published to the growing Treehouse Library! Here’s a short list of what we’ve added recently, upcoming course highlights, and our weekly video update of What’s New at Treehouse. Start learning to code today…
The post New & Upcoming Course Highlights: Python & Java Practice Sessions appeared first on Treehouse Blog.

Link: http://blog.teamtreehouse.com/new-upcoming-course-highlights-python-java-practice-sessions

PyDev of the Week: Anand Balachandran Pillai

This week we welcome Anand Balachandran Pillai as our PyDev of the Week! Anand is the author of a new book called Software Architecture with Python from Packt Publishing. He is the founder of the Bangalore Python Users Group (BangPypers) and a member of the Python Software Foundation. Let’s take a few moments to get to know Anand better!
Can You Tell Us a Little About Yourself (Hobbies, Education, etc):
I finished my engineering degree in 1998 – in Mechanical Engineering from the Indian Institute of Technology at Chennai. However, I have never been a mechanical engineer, even for a day, in my life, as immediately after graduation, I took up my first job in computer software.

Link: https://dzone.com/articles/pydev-of-the-week-anand-balachandran-pillai?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

Get Python Requirements Package Hashes

Python’s (pip’s) requirements.txt file is the equivalent to package.json in the JavaScript / Node.js world.  This requirements.txt file isn’t as pretty as package.json but it not only defines a version but goes a step further, providing a sha hash to compare against to ensure package integrity: Flask==0.12.1 \ –hash=sha256:6c3130c8927109a08225993e4e503de4ac4f2678678ae211b33b519c622a7242 Jinja2==2.9.6 \ –hash=sha256:2231bace0dfd8d2bf1e5d7e41239c06c9e0ded46e70cc1094a0aa64b0afeb054 MarkupSafe==1.0 \ –hash=sha256:a6be69091dac236ea9c6bc7d012beab42010fa914c459791d627dad4910eb665 …. Coming from the JavaScript / package.json world, you […]
The post Get Python Requirements Package Hashes appeared first on David Walsh Blog.

Link: https://davidwalsh.name/hashin

PyDev of the Week: Jessica McKellar

This week we welcome Jessica McKellar (@jessicamckellar) as our PyDev of the Week! Jessica is a former Director of the Python Software Foundation and a successful entrepreneur. She is also an author for O’Reilly and has been a core developer for the Twisted framework. You can check out her website or her Github profile to get an idea of what she’s up to. Let’s spend some time getting to know her better!
Can You Tell Us a Little About Yourself (Hobbies, Education, etc):
I’m an entrepreneur, software engineer, and open-source developer currently living in San Francisco. I’m a former Director of the Python Software Foundation, a former organizer for the Boston Python User Group, and PyCon North America’s Diversity Outreach Chair.

Link: https://dzone.com/articles/pydev-of-the-week-jessica-mckellar?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

Python: Flask – Generating a Static HTML Page

Whenever I need to quickly spin up a web application, Python’s Flask library is my go to tool. Recently, however, I found myself wanting to generate a static HTML page to upload to S3 and wondered if I could use it for that as well.
It’s actually not too tricky. If we’re in the scope of the app context then we have access to the template rendering that we’d normally use when serving the response to a web request.

Link: https://dzone.com/articles/python-flask-generating-a-static-html-page?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev