Skip to content

Instantly share code, notes, and snippets.

@franTarkenton
Last active January 25, 2018 21:22
Show Gist options
  • Save franTarkenton/3aeab9493b934750328617848ed6743f to your computer and use it in GitHub Desktop.
Save franTarkenton/3aeab9493b934750328617848ed6743f to your computer and use it in GitHub Desktop.

Pycascades

image

Where's waldo, i mean Kevin Netherton!

One of the outcomes of the past pycon 2017 was to work on organizing more "regional" level conferences to fill the gap between the huge pycon conferences and the various local level conferences. PyCascades is the first of these regional conferences that attempts to fill this gap. The idea is to build relationships at a regional level, in this case BC south to the bay area.

Conference Highlights

In the sections that follow are a few words on the specific talks that I found particularly interesting and what it was about them that was of interest. See the agenda link, the slide deck link or the youtube video feed for more information on talks not covered in this list or if you want to find out more information. Please also feel free to contact me if you have questions. kevin.netherton@gov.bc.ca

Meeting Guido

The highlight for me has to have been meeting Guido, and having a chance to chit chat with him. I'm still kinda glowing from that experience. We talked about Vancouver, the Cascades Region, travel, and finally got into talking about what Guido's currently working on.... which is mypy. Mypy is the new static typing system for python. Don't freak out, its optional, but I see a lot of good reasons for using it when developing libraries. There was a whole talk on mypi at the converence also

Software Licenses

Can you legally cut and paste code from stackexchange? Actually you can't, unless licensing is specifically defined. That said I still do. Was an interesting talk that went over the popular open source licensing options and the licenses that are 'viral' vs those that can be easily mixed and matched. Take away is to remember to include a license when you post your code to github, otherwise, in essence there is no license for your software and it is very difficult for others to use it from a legal perspective.

link to slides

Web App in 4 Frameworks

This is a link to the presentation Demonstrates how easy it is to build database driven web apps using python.

VisiData

Looked like this had a lot of potential for a quick and dirty data review tool. Could probably be extended to consume all the various data formats that we load to the bcgw. He nicknames it the 'chainsaw' of data analysis. Looked very cool, but also looked like it came with a learning curve. visidata

Its a kinda Magic

This got a bit complex, but the important take away is to remember that magic methods that exist for python, and the extending them in your own classes can simplify things and help organize where logic bits should lie. Also provides a standardized python interface for how your code should accomplish common operations. Example why define a .equals() method and use it as obj.equals(someotherObj), when you could just say obj == someotherObject. Probably the most common use of magic methods is for creating your own iterators.

Teaching

There were a few talks that discussed the topic of teaching and passing on information. This particular topic is near and dear to my heart. Some of the takeaways that I got from this include:

  • Different approaches are required depending on the audience. Best way to teach someone is to try to understand their perspective. Example teaching Java programmers Python, Good idea is to learn Java so you can help identify similiarities and differenences between the two.
  • Work on real problems. Find a real problem and use it as a teaching opportunity. Spreadsheets were one example that was passed around.
  • Those who care teach Some very good ideas on teaching. Some really good tips on common pitfalls that alienate students. I know Ive been guilty of most of them.

Got me thinking about doing some more teaching / show and tell. Some topics I've been brainstorming:

  • No more print statements, using pythons builtin logging
  • Objectify - My learnings with OO and python.
  • Managing Dependencies, using pip and virtualenv
  • Linting - is my code any good?
  • In's and outs of Eclipse/pydev ide and why you should use it
  • Writing code that's safe to share, separation of secrets/config from code
  • Managing code in Git

Ping me if any of this would be of interest to you

Setting Expectations for Open Source

When things don't work its easy for use to become pushy. Real take home was there are people who are create the code we all use. Be courteous and kind when working with these people. Further to that keep in mind that when asking someone for something in the opensource world that its a favor you are asking. Supporting open source projects is a lot of work, and the people behind those projects have to deal with angry and disrespectful comments. There was a quote from the guy that maintains urllib3, requests, and few other well used libs: "Here's a bit of real talk for people: I think working in OSS has made me bitter and short-tempered"

That's not good. Slide deck

On a side note the guy behind this talk is behind the "Visual Studio for Code" editor. My understanding is its a forked version of atom that addresses some of the performance issues that Atom suffers. I was surprised to find out its available for all platforms as well. Apparently the python plugin is the most highly used plugin for the platform.

Micropython and the Internet of Things

Brings configuring microcontrollers to monitor our world. to the realm of the mere mortal. Walked away from this talk realizing I could get started with this any time now without a huge amount of research. Demo'd how you can get a $3 (yes only 3 bucks) micro controller and configure it to monitor for temperature and humidity that reports back to a web app.

Slide Deck Code

Taming the Hydra: How we Learned to Love Testing a Giant Python Codebase

I've used the python unittest module for my testing. This is something that I'm relatively new to. Got some excellent ideas from this on using the mock module to help mock up test cases. Something that my prior research missed! The takeaway message was use pytest

New years resolution is to try to work towards test driven development using pytest, or at least start to build more pytests to verify my code.

Character Encoding and You

If you use python 2, you have likely been to unicode hell. I've definitely been there. I managed to crawl out of it gaining some understanding of the character encoding problem. This talk filled in all the holes in my knowledge. A fantastic job covering why character encoding can be a problem and some best practices to help deal with them.

Link to slides

Takeaway:

  • Use python 3 if you can. Resolves a lot of problems by using unicode by default. Python 2 uses ascii by default. You can fix this by appending 'u' to the front of all your strings.
  • Use UTF-8 ... its great!
  • Verify the character encoding of your inputs (look at them if you can)

Typing for python

After talking to Guido about the mypi module, was super interesting to get this presentation shortly after that conversation. It goes into implementation details associated with typing your application using mypi. In a nutshell you can define arguement and return values types with a type annotation. The linter will then be able to identify methods that are sending the wrong type of data. I can see this helping to prevent some bugs before you get to runtime. Many people do this already using docstrings. Typically with doc strings as the api evolves they become incorrect. With type annotations it forces you to maintain what types are sent and recieved. Finally no python is not going the way of Java, of becoming a static types language. The implementation is very pythonic. Use it and sprinkle around your code as you deem necessary.

Links to slides

Misc / Summary

  • If not using python 3 already, develop a plan to migrate.
  • New to python 3.6 f strings. Amazing, much better to previous solution of .format(). Also safe for use with loggers.
  • Use pytest
@ll911
Copy link

ll911 commented Jan 25, 2018

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment