Tag: python

Full Stack Python Guide to Deployments, book review

full_stack_python_guide_to_deployments-Book_Cover

Published on: 01.10.2017

Number of pages: 262 with code example, 185 without
Written by: Matthew Makai
Publish by: Self-publish

Conclusion
Useful to read, if you want to learn/see how to deploy python web application.

Review
Topic of book is described in its subject, full stack python deployments.

In appendix C of book is full source code of Flask application that you are deploying.

Topic of book is not source code from Flask application, but just how to deploy that code.

Deployment is done on virtual server on Linode (Ubuntu).

Deployment process is automated with Fabric and Ansible.

I liked this automation because you can use it for your own project also.

Other technologies used are: Nginx, Git, PostgreSQL, Redis, Green Unicorn, Celery and Jenkins

Make standalone executable from Python code with PyInstaller

Published on: 01.09.2017

I wanted to create single file that person could run on Windows machine, from my Pythone code.

After some investigation I found PyInstaller and 1 hour later I had my EXE file from Python code.

Process for generating EXE files from Python code with PyInstaller was quite easy, at least from my experience.

I have used it on Windows 7 64-bit and had no problems.

My program was one file script with 300 line and dependencies to docopt and pyautogui.

Steps for generating exe file with PyInstaller

This will install PyInstaller
pip install pyinstaller

This will generate script.exe in dist directory
pyinstaller --onefile script.py

After this you have your EXE program.

How PyInstaller is working

Here I have used --onefile option for PyInstaller what will make one file EXE program.

If you just use pyinstaller script.py, with out --onefile option, than in dist folder you will get folder script with EXE file and all additional files for your EXE file to work.

If you use --onefile option, then your one file EXE program need every time to uncompresses all files every time when it starts.

Uncompression is described in details in official documentation, temporary directory for uncompression in Windows is %TEMP%.

Some other solutions:
http://nsis.sourceforge.net/Main_Page
http://nuitka.net/
https://pypi.python.org/pypi/pynsist
https://cx-freeze.readthedocs.io/en/latest/
http://www.py2exe.org/

Comparison of some others solutions.

Grokking Algorithms, book review

Grokking_Algorithms-Book_Cover

Published on: 01.07.2017

Number of pages: 256
Written by: Aditya Bhargava
Publish by: Manning

Conclusion
Interesting book, visualizations are very helpful.

Review
When I saw this book first time I was not interested.
Book cover was too childish for me.

But after listening podcast about it, I changed my mind.

Illustrations in book are used to explain concepts, and they are very useful.
All code is in python, that was bonus point for me.

Here is video example of illustration:

I do recommend this book for reading, you can understand Big O notation from it and algorithms.

Learning Selenium Testing Tools with Python, book review

Learning_Selenium_Testing_Tools_with_Python-Book_Cover

Published on: 01.03.2017

Number of pages: 216
Written by: Unmesh Gundecha
Publish by: Packt Publishing

Conclusion
Book about Selenium with Python examples.

Review
Only book about Selenium with Python examples that I have found so far.
I found much more books with Java examples, alto it is not difficult to translate syntax from Java to Python, because Selenium API is similar, I prefer to read code in Python.

Usually I read programing books for two reasons:
– when I do not know anything about topic, so that I get basic understanding
– when I have already used technology, even did some project, but want to see what I do not know about it

With Selenium is second reason.

Book is good, it have lot of code examples how to use Selenium API.
Good to have as reference.

Automate the Boring Stuff with Python, book review

automate-the-boring-stuff-with-python-Book_Cover

Published on: 01.02.2017

Number of pages: 504
Written by: Al Sweigart
Publish by: No Starch Press

Conclusion
Best book for learning programming.

Review
I am very impress with this book.
I am recommending it to anybody who want to learn programming.

Book is available for free online.
Book is also available as video tutorial and first 15 videos are on YouTube for free.

This book is going to teach you how to use programming knowledge to automate tasks on computer.
Some examples are: send emails, automate web page interaction, automate GUI interaction.
All other books on programing for beginners just teach you basic programming, but after that people have no idea how to use it in everyday life.
This book is different because it will show you real examples how to use it in everyday life.

Effective Python, book review

Effective_Python-Book_Cover

Published on: 02.09.2016

Number of pages: 256
Written by: Brett Slatkin
Publish by: Addison-Wesley

Conclusion
Collection of 59 good ideas on how to write better Python code.

Review
Book contains 59 items on how to written better Python code.

Items are grouped in 8 chapters: pythonic thinking, functions, classes and inheritance, metaclasses and attributes, concurrency and parallelism, built-in modules, collaboration, production.

Useful to read.

“Getting Started with Beautiful Soup”, book review

Published on: 01.04.2015

Getting_Started_with_Beautiful_Soup-Book_Cover

Number of pages: 130
Written by: Vineeth G. Nair
Publish by: PACKT Publishing

I have been using Beautiful Soup at least for last 3 years for web scraping.
I learned it by practice and reading documentation.

As far as I know this is first book about Beautiful Soup, so I was really excite to read it.
I prefer learning from book, tutorial as second choice, last choice is from documentation.

Form somebody who is starting to use Beautiful Soup I would recommend this book, even somebody who had used Beautiful Soup (like myself) can find value in it.

What I have learned from “Getting Started with Beautiful Soup” book:

  • Beautiful Soup can be used to change the content of an HTML/XML document.
  • how to set input encoding for Beautiful Soup document
  • default output encoding for .prettif() and .encode() is UTF-8, but it can be changed also.
  • different formatters (minimal, html , None , function) can be passed as parameters to prettify(), encode(), and decode()
  • get_text() return all text from page (including JavaScript)