Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PyConZA 2014: "Python in the context of a Start-up: The Good, The Bad and the Ugly" by Adam Jorgensen

Pycon ZA
October 06, 2014

PyConZA 2014: "Python in the context of a Start-up: The Good, The Bad and the Ugly" by Adam Jorgensen

Python is great language for developing software that works well in a short time-span. The ability to produce code quickly that is of a reasonable quality is very important in a work environment where productivity is of extreme importance. It would thus seem to be very well suited for usage in a start-up environment. Is this really the case though?

Here at Springlab we've been using Python to develop our product, an online platform for locating and booking with medical practitioners, since day one. Along the way we've written a lot of code, used a variety of frameworks, libraries and toolkits while experimenting with various approaches to solving the problems we've encountered. Of key importance to us has been balancing the need to produce code that works now against the desire to develop something that we won't become a serious time-sink in the future.

From our position it is thus possible to go into a bit of detail about the pros, cons and extremely sharp corners encountered using Python in the context of a small start-up environment where time is of the essence and there is a lot of pressure to produce a quality product as quickly AND as well as possibly.

My aim with this talk is to give the listener an idea of what kind of experience to expect when using Python in an environment like ours and also to hopefully share some tips that will help others avoid some of the problems we've run into. I hope to cover issues on the subjects of back-end development involving Django + Tastypie, front-end development with Flask, client-side development involving JavaScript as well as touching on the subject of integrating with other tools and pieces of software.

Pycon ZA

October 06, 2014
Tweet

More Decks by Pycon ZA

Other Decks in Programming

Transcript

  1. The Introduction • is a Cape Town based incubator building

    lean start-ups • Our current main venture is • A web-based search and booking engine for Medical Practitioners • Built primarily in Python 2 with some familiar extras
  2. The Start-up Environment • What is it like working at

    a start-up? • Depends on the start-up but the following are probably true. • Development team is likely to be very small! (In our case, 1-2 people over the last year and a half) • Writing new code rather than maintaining old code :-) • Work environment is pretty relaxed. • .BUT results are very important! • The perfect place to use Python?
  3. Why pick Python? • Easy to write • Important for

    being productive as an individual • Easy to read • Important for being productive in a team, even a small one • Easy to teach • Important if you have to cross-train team members • Strong community • Important for getting help • Batteries included! • Core language is not artificially limited • Strong standard library allow you to get more done without trawling the Internet for libraries that do XYZ
  4. Why pick Python? • Even more batteries available. • Plenty

    of frameworks, toolkit, libraries and code snippets to help you perform just about any task without reinventing the wheel • Alternate Python implementations with different goals give you even more chances to use Python • Python is Mature. • Stable language targets (Python 2 and Python 3) • Known performance characteristics • .Yet Still Evolving • Python Enhancement Proposals (PEPs) • Python Implementations (PyPy, Jython, IronPython, Stackless, etc) • Python 3
  5. The Good • Writing new code rather than maintaining old

    code means. • You can use the latest, greatest frameworks, etc • Use Python 3 rather than Python 2 (If possible) • Python is definitely a productivity booster! • Working code can be produced quickly • Proto-typing new ideas is a snap • Testing 3rd party integrations is also easy • Advanced Python features can boost productivity even more. • First-class Functions, Decorators, Context Managers, Generators, etc • Assist in implementing complex requirements with minimal boiler-plate or excessive amounts of abstraction and code wrangling
  6. The Good • REPL environments are extremely useful  IPython,

    BPython, DreamPie • Debugging tools make analyzing issues with code very easy • Pdb is useful for quick debugging • Pydevd makes extended debugging much more pleasant
  7. The Good • Source availability is extremely useful • Allows

    you to dig into the frameworks and libraries you are using • Reading other peoples code can help you improve your own code • Combined with debugging (Especially Pydevd) it's very easy to track code execution into the frameworks and libraries you're working with in order to work out exactly what's going on.
  8. The Good • Great frameworks, libraries and tools that make

    life easier: • Fabric is awesome for handling remote execution tasks • Celery is extremely useful for performing asynchronous and scheduled tasks • Requests provides an easy way to interact with RESTful APIs • Flask is a great web framework that makes writing clean web applications a pleasure • Django is useful primarily because the Admin app provides a mature way for non-developers to interact with your data • PyPy is awesome and definitely worth targeting. Performance gains vary depending on task but are evident especially for CPU intensive tasks and debugging. • PyCharm/IntelliJ Ultimate is a great development environment
  9. The Bad • Writing new code in a short space

    of time means. • Poor design decisions can have time-consuming knock-on effects down the line • More likely to reinvent the wheel by dint of the fact that you are writing new code rather than maintaining old code
  10. The Bad • Small Team + Large Workload means that

    some code is written quickly rather than properly • On the plus side, you often get to go back if write it properly later. • Using the latest (and hopefully greatest) tools, frameworks and libraries can sometimes lead to problems. • .but this does provide the opportunity to feed bug reports and fixes back into the community so it's not that bad :-)
  11. The Bad • Problematic frameworks/tools: • Jinja2. To be fair,

    Jinja2 isn't really bad in itself, but excessive use of template inheritance gets ugly fast. • South. Again, South itself is not bad (It's actually great) but migrations + multiple VCS branches + multiple team members mean you need to tread carefully when merging changes. • Django-Tastypie. It's not as bad as you may have heard but it's certainly not awesome either. • Abandoned/forked libraries/frameworks still on PyPi • PIL vs Pillow, etc • Unfortunately these are more common than you'd think. Be sure to check the project homepage/VCS repo for recent activity before committing to usage.
  12. And The Ugly • Nothing really! • Well, almost. •

    It's quite hard to find exceptional Python developers in South Africa because the overall extent of Python usage is quite small (Especially compared to Java and PHP) • .especially with Amazon Cape Town gobbling up developers left, right and center ;-)