Python Bytes Episode 77, You Don't Have To Be A Workaholic To Win

preview_player
Показать описание
Recording of the last 18 minutes of the Live PyCon 2018 episode of the Python Bytes podcast.

Brian #1: Why Senior Devs Write Dumb Code

“Any fool can write code that a computer can understand. Good programmers write code that humans can understand.” - Kent Beck

Code that is clean, straightforward, obvious, and easy to read actually takes practice to achieve.

Follow principles like YAGNI, Singe Responsibility, DRY, etc.

Avoid clever one-liners, weird abstractions.

Esoteric language features.

Code needs to be readable and easily understood while under time and stress pressure.

Michael #2: GeoAlchemy 2

GeoAlchemy 2 provides extensions to SQLAlchemy for working with spatial databases.

GeoAlchemy 2 focuses on PostGIS. Aims to be simpler than its predecessor, GeoAlchemy.

Using it:

Connect (e.g. Postgres)

Declare a Mapping

class Lake(Base): __tablename__ = 'lake' id = Column(Integer, primary_key=True) name = Column(String) geom = Column(Geometry('POLYGON'))

Create a table (via the engine)

Create an Instance of the Mapped Class

Inserts like standard SQLAlchmey

Spatial Query

Brian #3: QtPyConvert

QtPyConvert supports the following bindings out of the box:

PyQt4

PySide

PyQt5

PySide2

Conversions leave code comments in place, with the help of RedBaron

Minimal Python 2 & 3 shim around all Qt bindings - PySide, PySide2, PyQt4 and PyQt5

Michael #4: You Don't Have To Be a Workaholic To Win: 13 Alternative Ways To Stand Out

Do we have to kill ourselves to get ahead?

Don’t busy-brag

Max Q analogy

The tips

Creativity

Stubbornness

Curiosity

Kindness

Planning

Improvisation

Enthusiasm

Communication

Presence

Collaboration

Willingness

Patience

Institutional Knowledge

Brian #5: RedBaron

RedBaron is a python library to make the process of writing code that modify source code as easy and as simple as possible.

writing custom refactoring, generic refactoring, tools,

Used by QtPyConvert to achieve the conversion while leaving code comments in place

Uses the full syntax tree, FST. Like an AST, but keeps all information, including comments and formatting.

possible uses:

rename a variable in a source file... without clashing with things that are not a variable (example: stuff inside a string)

inline a function/method

extract a function/method from a series of line of code

split a class into several classes

split a file into several modules

convert your whole code base from one ORM to another

do custom refactoring operation not implemented by IDE

Michael #6: Project Beeware AppStore

Project BeeWare has just released its first iPhone app made in Python using its Briefcase tool.

Simple travel app for currency and tip calculations

Briefcase: A distutils extension to assist in packaging Python projects as standalone applications. Briefcase is a tool for converting a Python project into a standalone native application. You can package projects for:

Mac

Windows

Linux

iPhone/iPad

Android

AppleTV

tvOS

While there are other Python GUI toolkits aiming to enable Python developers to build and deploy iOS apps, like for instance the very nice Pythonista app, the BeeWare project is a bit different because it aims at cross-platform compatibility and native widgets with a set of different tools, like Briefcase and Toga.

Extras:

Рекомендации по теме