Archive

Archive for the ‘python’ Category

Designing Well-Structured REST APIs with Flask-RestPlus: Part 1

December 11, 2018 Leave a comment

This is the first part of a two-part series. In this post, I will introduce Flask-RestPlus and demonstrate how to start organising APIs around its simple REST-based conventions. Next time, I will address the topic of request/response marshalling (serialisation) and validation.

https://preslav.me/2018/12/02/designing-well-structured-rest-apis-with-flask-restplus-part-1/

Advertisements
Categories: python Tags:

pip – ImportError: cannot import name main

December 7, 2018 Leave a comment

Problem:
Getting above error when running pip

ubuntu@ubuntu-xenial:~$ pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 646kB/s 
Installing collected packages: pip
Successfully installed pip-8.1.1
You are using pip version 8.1.1, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.


ubuntu@ubuntu-xenial:~$ pip install --upgrade pip
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    from pip import main
ImportError: cannot import name main

Solution:

ubuntu@ubuntu-xenial:~$ python -m pip install -U pip
Requirement already up-to-date: pip in ./.local/lib/python2.7/site-packages (18.1)

Source:
https://stackoverflow.com/questions/28210269/importerror-cannot-import-name-main-when-running-pip-version-command-in-windo

Categories: python

Brett Slatkin – How to Be More Effective with Functions – PyCon 2015

November 8, 2018 Leave a comment

Functions improve readability, encourage reuse, and facilitate refactoring. Python has many unique features that make functions significantly more powerful. This talk will show you the best ways to use functions in Python: when *args is helpful and when it’ll crash your programs; how to use generators for arguments and return values; the value of keyword vs. keyword-only arguments; and more!

Categories: Interesting, python

Kenneth Reitz – Pipenv: The Future of Python Dependency Management – PyCon 2018

October 22, 2018 Leave a comment

Speaker: Kenneth Reitz

This talk is about the history of Python packaging, the tools that have been historically available for application deployment, the problems/constraints presented by them, and presents a holistic solution to many of these problems: Pipenv.

A live demo of the tool will be presented, as well as a Q&A session.

Slides can be found at: https://speakerdeck.com/pycon2018 and https://github.com/PyCon/2018-slides

Categories: Interesting, python Tags:

How to Add User Authentication to Flask Apps with Okta

October 18, 2018 Leave a comment

User authentication is a basic feature in web applications so people can create and access their own accounts. Unfortunately, authentication is not always easy to set up and there are many ways to incorrectly implement login and logout features.

This tutorial walks through how to use the secure identity authentication service called Okta, which is free for up to 1,000 active user accounts, to easily handle user data in Flask applications.

https://www.fullstackpython.com/blog/add-user-authentication-flask-apps-okta.html

Categories: Interesting, python

Ned Batchelder – Big-O: How Code Slows as Data Grows – PyCon 2018

October 4, 2018 Leave a comment

Speaker: Ned Batchelder

Big-O is a computer science technique for analyzing how code performs as data gets larger. It’s a very handy tool for the working programmer, but it’s often shrouded in off-putting mathematics.

In this talk, I’ll teach you what you need to know about Big-O, and how to use it to keep your programs running well. Big-O helps you choose the data structures and algorithms that will let your code work efficiently even on large data sets.

You can understand Big-O even if you aren’t a theoretical computer science math nerd. Big-O isn’t as mystical as it appears. It’s wrapped in mathematical trappings, but doesn’t have to be more than a common-sense assessment of how your code will behave.

Slides can be found at: https://speakerdeck.com/pycon2018 and https://github.com/PyCon/2018-slides

Source:
https://realpython.com/must-watch-pycon-talks/#10-refactoring-python-why-and-how-to-restructure-your-code

Categories: python Tags:

James Powell – So you want to be a Python expert?

October 2, 2018 Leave a comment

PyData
Published on Jul 24, 2017

http://www.pydata.org

PyData is an educational program of NumFOCUS, a 501(c)3 non-profit organization in the United States. PyData provides a forum for the international community of users and developers of data analysis tools to share ideas and learn from each other. The global PyData network promotes discussion of best practices, new approaches, and emerging technologies for data management, processing, analytics, and visualization. PyData communities approach data science using many languages, including (but not limited to) Python, Julia, and R.

PyData conferences aim to be accessible and community-driven, with novice to advanced level presentations. PyData tutorials and talks bring attendees the latest project features along with cutting-edge use cases.

Categories: Interesting, python