├── .gitignore
├── LICENSE
├── README.md
├── challenges
├── Readme.md
├── context_managers.py
├── decorators.py
├── generators.py
├── life.md
└── magic_methods.py
├── coaches-briefing.md
├── conference.md
├── introduction.md
├── prep.md
├── presentations
├── getting-the-best-out-of-the-conference.odp
├── intro-and-python-history.odp
├── python-ecosystem.odp
└── virtual-envs.odp
├── recommended-talks.md
├── resources-and-jargon-definitions.md
├── todos.md
└── tutorials
├── download_urls.txt
├── python-beginners.zip
└── tutorials-and-challenges.md
/.gitignore:
--------------------------------------------------------------------------------
1 | __pycache__
2 |
3 | *~
4 | *.~lock*
5 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | CC0 1.0 Universal
2 |
3 | Statement of Purpose
4 |
5 | The laws of most jurisdictions throughout the world automatically confer
6 | exclusive Copyright and Related Rights (defined below) upon the creator and
7 | subsequent owner(s) (each and all, an "owner") of an original work of
8 | authorship and/or a database (each, a "Work").
9 |
10 | Certain owners wish to permanently relinquish those rights to a Work for the
11 | purpose of contributing to a commons of creative, cultural and scientific
12 | works ("Commons") that the public can reliably and without fear of later
13 | claims of infringement build upon, modify, incorporate in other works, reuse
14 | and redistribute as freely as possible in any form whatsoever and for any
15 | purposes, including without limitation commercial purposes. These owners may
16 | contribute to the Commons to promote the ideal of a free culture and the
17 | further production of creative, cultural and scientific works, or to gain
18 | reputation or greater distribution for their Work in part through the use and
19 | efforts of others.
20 |
21 | For these and/or other purposes and motivations, and without any expectation
22 | of additional consideration or compensation, the person associating CC0 with a
23 | Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
24 | and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
25 | and publicly distribute the Work under its terms, with knowledge of his or her
26 | Copyright and Related Rights in the Work and the meaning and intended legal
27 | effect of CC0 on those rights.
28 |
29 | 1. Copyright and Related Rights. A Work made available under CC0 may be
30 | protected by copyright and related or neighboring rights ("Copyright and
31 | Related Rights"). Copyright and Related Rights include, but are not limited
32 | to, the following:
33 |
34 | i. the right to reproduce, adapt, distribute, perform, display, communicate,
35 | and translate a Work;
36 |
37 | ii. moral rights retained by the original author(s) and/or performer(s);
38 |
39 | iii. publicity and privacy rights pertaining to a person's image or likeness
40 | depicted in a Work;
41 |
42 | iv. rights protecting against unfair competition in regards to a Work,
43 | subject to the limitations in paragraph 4(a), below;
44 |
45 | v. rights protecting the extraction, dissemination, use and reuse of data in
46 | a Work;
47 |
48 | vi. database rights (such as those arising under Directive 96/9/EC of the
49 | European Parliament and of the Council of 11 March 1996 on the legal
50 | protection of databases, and under any national implementation thereof,
51 | including any amended or successor version of such directive); and
52 |
53 | vii. other similar, equivalent or corresponding rights throughout the world
54 | based on applicable law or treaty, and any national implementations thereof.
55 |
56 | 2. Waiver. To the greatest extent permitted by, but not in contravention of,
57 | applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
58 | unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
59 | and Related Rights and associated claims and causes of action, whether now
60 | known or unknown (including existing as well as future claims and causes of
61 | action), in the Work (i) in all territories worldwide, (ii) for the maximum
62 | duration provided by applicable law or treaty (including future time
63 | extensions), (iii) in any current or future medium and for any number of
64 | copies, and (iv) for any purpose whatsoever, including without limitation
65 | commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
66 | the Waiver for the benefit of each member of the public at large and to the
67 | detriment of Affirmer's heirs and successors, fully intending that such Waiver
68 | shall not be subject to revocation, rescission, cancellation, termination, or
69 | any other legal or equitable action to disrupt the quiet enjoyment of the Work
70 | by the public as contemplated by Affirmer's express Statement of Purpose.
71 |
72 | 3. Public License Fallback. Should any part of the Waiver for any reason be
73 | judged legally invalid or ineffective under applicable law, then the Waiver
74 | shall be preserved to the maximum extent permitted taking into account
75 | Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
76 | is so judged Affirmer hereby grants to each affected person a royalty-free,
77 | non transferable, non sublicensable, non exclusive, irrevocable and
78 | unconditional license to exercise Affirmer's Copyright and Related Rights in
79 | the Work (i) in all territories worldwide, (ii) for the maximum duration
80 | provided by applicable law or treaty (including future time extensions), (iii)
81 | in any current or future medium and for any number of copies, and (iv) for any
82 | purpose whatsoever, including without limitation commercial, advertising or
83 | promotional purposes (the "License"). The License shall be deemed effective as
84 | of the date CC0 was applied by Affirmer to the Work. Should any part of the
85 | License for any reason be judged legally invalid or ineffective under
86 | applicable law, such partial invalidity or ineffectiveness shall not
87 | invalidate the remainder of the License, and in such case Affirmer hereby
88 | affirms that he or she will not (i) exercise any of his or her remaining
89 | Copyright and Related Rights in the Work or (ii) assert any associated claims
90 | and causes of action with respect to the Work, in either case contrary to
91 | Affirmer's express Statement of Purpose.
92 |
93 | 4. Limitations and Disclaimers.
94 |
95 | a. No trademark or patent rights held by Affirmer are waived, abandoned,
96 | surrendered, licensed or otherwise affected by this document.
97 |
98 | b. Affirmer offers the Work as-is and makes no representations or warranties
99 | of any kind concerning the Work, express, implied, statutory or otherwise,
100 | including without limitation warranties of title, merchantability, fitness
101 | for a particular purpose, non infringement, or the absence of latent or
102 | other defects, accuracy, or the present or absence of errors, whether or not
103 | discoverable, all to the greatest extent permissible under applicable law.
104 |
105 | c. Affirmer disclaims responsibility for clearing rights of other persons
106 | that may apply to the Work or any use thereof, including without limitation
107 | any person's Copyright and Related Rights in the Work. Further, Affirmer
108 | disclaims responsibility for obtaining any necessary consents, permissions
109 | or other rights required for any use of the Work.
110 |
111 | d. Affirmer understands and acknowledges that Creative Commons is not a
112 | party to this document and has no duty or obligation with respect to this
113 | CC0 or use of the Work.
114 |
115 | For more information, please see
116 |
117 |
118 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Python conference Beginners' Day
2 |
3 | Some docs to support the organising of a "beginners' day" at Python
4 | conferences. Prepared for EuroPython 2015. Updated for Pycon 2016.
5 |
6 | http://blog.europython.eu/post/122336430342/europython-2015-beginners-day
7 |
8 | https://ep2015.europython.eu/conference/talks/python-for-beginners
9 |
10 | https://us.pycon.org/2016/schedule/presentation/2258/
11 |
12 |
13 | # Day outline
14 |
15 | ## Intro lecture.
16 |
17 | See [introduction.md](introduction.md)
18 |
19 | ## Self-directed learning sessions
20 |
21 | See [tutorials-and-challenges.md](tutorials/tutorials-and-challenges.md)
22 |
23 | ## Afternoon lecture: The Python Ecosystem
24 |
25 | See [python-ecosystem.md](python-ecosystem.md)
26 |
27 | ## End of day lecture: How to get the best out of the conference
28 |
29 | See [conference.md](conference.md) and [recommended talks](recommended-talks.md).
30 |
31 |
--------------------------------------------------------------------------------
/challenges/Readme.md:
--------------------------------------------------------------------------------
1 | # Python Challenges
2 |
3 | These challenges are aimed at people who've already learned the basics of
4 | Python. They're meant to encourage you to use some of the more interesting
5 | features of Python, and help you to write more "Pythonic" code...
6 |
7 |
8 | # Python challenges in this repo
9 |
10 | [magic methods and duck typing](magic_methods.py) - learn how to make your classes Pythonic using magic methods like `__len__` and more
11 |
12 | [decorators](decorators.py) - decorators, a pretty way of transforming functions using other functions. functional programming! functions.
13 |
14 | [context managers](context_managers.py) - aka the `with` statement. What's it for, and how does it help to make your code look nicer?
15 |
16 | [generators](generators.py) - more efficient iterators with python and the `yield` statement.
17 |
18 | [The Game of Life](life.md) - a programming classic. Try it out using OO and functional paradigms in Python.
19 |
20 |
21 |
22 | # Beyond Python - learning to use third party libraries
23 |
24 | Check out the great tutorials at [newcoder.io](http://newcoder.io/) and learn how to use:
25 |
26 | * Matplotlib to plot charts
27 | * GEOJson to parse geographical data
28 | * requests to get data off the internet
29 | * scrapy for web scraping
30 | * postgres as a database
31 | * Tk for graphics and GUI stuff
32 |
33 | and lots more...
34 |
35 |
36 | # Other resources
37 |
38 | * If you fancy something mathematical, try out Project Euler or the Matasano Crypto Challenges
39 | * If you fancy learning TDD and good web development practices, check out www.obeythetestinggoat.com
40 | * Python Epiphanies! http://swilliams.ca/Python-Epiphanies.pdf
41 | * an excellent intermediate book: Fluent Python http://shop.oreilly.com/product/0636920032519.do (use code AUTHD)
42 | * head on back to the tutorials page for some [science resources](../tutorials-and-challenges.md#for-sciencey-people)
43 |
44 |
--------------------------------------------------------------------------------
/challenges/context_managers.py:
--------------------------------------------------------------------------------
1 | '''
2 | Challenge: context managers
3 |
4 | Let's take our decorators challenge from earlier, and say
5 | we want to implement a lock. Say we're running lots
6 | of my_programs in parallel, and you want to restrict
7 | some functions to only being called once at a time.
8 |
9 | Let's say we use a tempfile to hold the lock:
10 | '''
11 |
12 | def hold_lock():
13 | filename = tempfile.NamedTemporaryFile(delete=False).name
14 | with open(filename, 'w') as f:
15 | f.write('locked')
16 | return filename
17 |
18 |
19 | def release_lock(lock_name):
20 | os.remove(lock_name)
21 |
22 | '''
23 | Incidentally, you've seen in the Python docs that you're meant
24 | to use "with open" -- that's actually already a context manager.
25 | Building our own might take away some of the air of mystery from it...
26 |
27 | So we want to run "hold_lock" before each function starts, and
28 | "release_lock" at the end.
29 |
30 | So you could use a decorator, but what if the function
31 | raises an exception? now you have to have a try/except
32 | and it gets yucky...
33 |
34 | You might want to try this to get a feel for the ugliness.
35 |
36 | But a context manager would be much nicer!
37 |
38 | Find out how to write a context manager that calls hold_lock
39 | before a function runs, and calls release_lock at the end,
40 | even if the function raises an exception.
41 |
42 | For bonus points: make it so that the user can also write
43 | to the lock file, for debugging purposes, when they're
44 | "inside" the context manager...
45 | '''
46 |
47 |
48 |
49 | from datetime import datetime
50 |
51 | def my_program():
52 | main_screen_turn_on()
53 | if somebody_set_us_up_the_bomb():
54 | take_off_every_zig()
55 |
56 | def main_screen_turn_on():
57 | print('\n'.join(['*' * 80] * 25))
58 |
59 |
60 |
61 | def somebody_set_us_up_the_bomb():
62 | if datetime.now().microsecond % 7 == 0:
63 | return True
64 | return False
65 |
66 |
67 | def take_off_every_zig():
68 | for i in range(1, 10001):
69 | if datetime.now().microsecond % 42 == 0:
70 | raise Exception('all your base!')
71 | print('Go {}! '.format(i), end='')
72 |
73 |
--------------------------------------------------------------------------------
/challenges/decorators.py:
--------------------------------------------------------------------------------
1 | """
2 | Challenge: use decorators to trace time taken for function calls
3 |
4 | Check out my_program, which relies on 3 different functions. But
5 | which one takes the most time?
6 |
7 | We could add a start_time = time.time() to the beginning of each one,
8 | and a print(time.time() - start_time) at the end, but that would be
9 | very repetitive. Figure out how to use a decorator to apply this
10 | print pattern to all the functions, without duplicating code.
11 |
12 | For bonus points: the little time printout should include the name
13 | of the function
14 |
15 | """
16 |
17 | from datetime import datetime
18 |
19 | def my_program():
20 | main_screen_turn_on()
21 | if somebody_set_us_up_the_bomb():
22 | take_off_every_zig()
23 |
24 | def main_screen_turn_on():
25 | print('\n'.join(['*' * 80] * 25))
26 |
27 |
28 |
29 | def somebody_set_us_up_the_bomb():
30 | if datetime.now().microsecond % 7 == 0:
31 | return True
32 | return False
33 |
34 |
35 | def take_off_every_zig():
36 | for i in range(1, 10001):
37 | print('Go {}! '.format(i), end='')
38 |
39 | """
40 |
41 | Your decorator might end up looking something like this:
42 |
43 | @time_this_function
44 | def main_screen_turn_on():
45 | ...
46 |
47 | You'll need to find out what a decorator is and how to
48 | create it in PYthon! Google for a guide, or try this
49 | one: http://thecodeship.com/patterns/guide-to-python-function-decorators/
50 |
51 | """
52 |
53 | """
54 | For bonus bonus points:
55 |
56 | - now make a new decorator that will retry a function up to n times, until
57 | it gets a certain value:
58 |
59 | @repeat(times=5, until_value=True)
60 | def somebody_set_us_up_the_bomb():
61 | ...
62 |
63 | If you like, please take a look at the functools module in the standard
64 | library; in particular at functools.wraps function, which is a very useful
65 | decorator to help you building your own decorators.
66 | """
67 |
68 |
--------------------------------------------------------------------------------
/challenges/generators.py:
--------------------------------------------------------------------------------
1 | """
2 | Imagine you wanted to reimplement "head" and "grep" in python. Here's a first cut:
3 | """
4 |
5 | def head(max_lines, filenames):
6 | for fn in filenames:
7 | with open(fn) as f:
8 | for ix, line in enumerate(f):
9 | if ix >= max_lines:
10 | return
11 | print(line, end='')
12 |
13 |
14 | def grep(needle, filenames):
15 | for fn in filenames:
16 | with open(fn) as f:
17 | for line in f:
18 | if needle in line:
19 | print(line, end='')
20 |
21 | """
22 | There's a lot of duplicated code there! Now we could build a helper function like this:
23 | """
24 |
25 | def getlines(filenames):
26 | for fn in filenames:
27 | with open(fn) as f:
28 | return f.readlines()
29 |
30 | """
31 | but then head would be inefficient, because getlines always reads every single line in the file.
32 |
33 | Find out how to use a generator to make a version of getlines that is "lazy"
34 |
35 | More info here: http://anandology.com/python-practice-book/iterators.html
36 | """
37 |
38 |
--------------------------------------------------------------------------------
/challenges/life.md:
--------------------------------------------------------------------------------
1 | # Conway's Game of Life Challenge
2 |
3 | https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life
4 |
5 | # Rules
6 |
7 | > Any live cell with fewer than two live neighbours dies, as if caused by under-population.
8 | > Any live cell with two or three live neighbours lives on to the next generation.
9 | > Any live cell with more than three live neighbours dies, as if by overcrowding.
10 | > Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.
11 |
12 |
13 | # Hints: (spoilers?)
14 |
15 | * Start by thinking of a way to represent the state of the world, or grid. What kind of data structure will be simple and easy to work with?
16 |
17 | * Next, make a way to print out the board, so you can see it
18 |
19 | * Then think about how to do a "step", a transition from one moment in time to another. You'll need to look at each cell, figure out where the neighbouring cells are, whether they're live or dead, and decide one whether it will be alive or dead in the new board.
20 |
21 |
22 | # Challenges
23 |
24 | The first challenge is obviously to get it working. But then:
25 |
26 | * If you used a class-based, Object-Oriented approach, try again with a pure-functional approach, with simple data structures
27 | * Or, vice versa!
28 | * If you're printing out board states to the terminal, are you starting with a random board state? or a fixed one?
29 | * How about using a gui instead? Look into Tk or Pygame?
30 | * Or even a web app?
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/challenges/magic_methods.py:
--------------------------------------------------------------------------------
1 | # coding=utf8
2 |
3 | """
4 | Challenge: the Pythonic card deck class
5 |
6 | The class CardDeck below represents a pack
7 | of cards.
8 |
9 | Find out how to use magic methods so that the
10 | following three standard functions work:
11 |
12 | >>> import random
13 | >>> deck = CardDeck()
14 | >>> len(deck)
15 | 52
16 | >>> print(deck[0])
17 | 2♠
18 | >>> print(deck[-1])
19 | A♣
20 | >>> random.choice(deck) in list(deck)
21 | True
22 | >>> random.shuffle(deck)
23 |
24 | Tip:
25 | If you have lines in the docstring (this string) that look like interactive
26 | Python sessions, you can use the doctest module to run and test this code.
27 |
28 | Try: python3 -m doctest -v magic_methods.py
29 |
30 | See: https://docs.python.org/3/library/doctest.html
31 |
32 |
33 | Credit to Luciano Ramalho and his excellent book Fluent Python, from which
34 | I stole this example.
35 | """
36 |
37 |
38 |
39 | class CardDeck:
40 | ranks = [str(n) for n in range(2, 11)] + ['J', 'Q', 'K', 'A']
41 | suits = '♠♡♢♣'
42 |
43 | def __init__(self):
44 | self._cards = [
45 | rank + suit
46 | for suit in self.suits
47 | for rank in self.ranks
48 | ]
49 |
50 |
51 |
52 | """
53 | Bonus exercise: Polynomial class
54 |
55 | Create a class that represents polynomials. You may need to stretch your memory back to high school maths!
56 |
57 | A polynomial loks like
58 |
59 | 2(xx) - x + 7
60 |
61 | And its essential features are the coefficients of each power of x
62 |
63 | in this example, power-2=2, power-1=-1, power-0=7
64 |
65 | Credit to Moshe Goldstein
66 | """
67 |
68 | class Polynomial:
69 | def __init__(self, coefficients):
70 | pass # TODO
71 |
72 | def __str__(self):
73 | pass # TODO
74 |
75 | def __add__(self, poly):
76 | '''returns the result of adding poly from self'''
77 | pass # TODO
78 |
79 | def __sub__(self, poly):
80 | '''returns the result of subtracting poly from self'''
81 | pass # TODO
82 |
83 | def __mul__(self, poly):
84 | '''multiply two polynomials'''
85 | pass # TODO
86 |
87 | def value(self, x):
88 | '''returns the value of the polynomial at point x'''
89 | pass # TODO
90 |
91 | def derivative(self):
92 | '''returns the derivate of the polynomial'''
93 | pass # TODO
94 |
95 |
--------------------------------------------------------------------------------
/coaches-briefing.md:
--------------------------------------------------------------------------------
1 | This doc applies both to coaches for the beginners' day, and to
2 | beginner-mentors for the week ahead. It's designed to support a briefing on
3 | the first day of the conference.
4 |
5 |
6 | # Beginner mentors
7 |
8 | The idea of "beginner mentors" is to provide designated people that beginners
9 | can approach at any point during the conference, and ask questions, say what
10 | they're confused about, and seek advice about what talks to go to next, what
11 | technology to start learning, or whatever it may be. It's just about marking
12 | out a few friendly people in what may otherwise be a very intimidating crowd.
13 |
14 | (it's hoped that people who are coaches for the beginners' day will also
15 | volunteer to be mentors for the rest of the conference. Other volunteers
16 | might do it as well though!)
17 |
18 | # How to be a good beginner-mentor
19 |
20 | So, a good beginner mentor should, first off, actually be prepared to drop
21 | everything and answer questions from a beginner. This might not be as easy
22 | as it sounds -- conferences are times when we all look forward to catching
23 | up with our conference friends that we only see once a year, and we enjoying
24 | geeking out to the absolute max and talking about all the tech stuff we've
25 | been learning, the more obscure the better. That's a scary conversation for a
26 | beginner to interrupt. But it's also a conversation that's very difficult
27 | to abandon half-way through to answer some really basic questions; and, not
28 | all beginners are charming and polite!
29 |
30 | But it's worth it -- programming is joy, especially in Python, and if we
31 | can help make more happy programmers in the world, then that's the sum total
32 | of human happiness increased.
33 |
34 |
35 | # Read this (for both coaches and mentors)
36 |
37 | We're all here because we want to help beginners, so that's pre-qualified us
38 | already. Here's a few tips from some amazing coaches and people who've been
39 | out there doing coaching for a while.
40 |
41 | Just read this -- it's excellent.
42 |
43 | [coach.djangogirls.org/tips/index.html](http://coach.djangogirls.org/tips/index.html)
44 |
45 | (follow the links through to Hacker School and the Dilbert strip ;)
46 |
47 |
48 | # The beginner mentor's oath
49 |
50 | And now well all say the oath together:
51 |
52 |
53 | *The crowd at the registration desk gathers, and now my watch begins. It shall not end until the end of the sprints. I shall speak no jargon, feign no surprise, well no actuallys, and avoid all subtle isms. I will remember what it was like to be a beginner. I shall wear no crowns and seek no glory in geeking out with all my conference mates, and instead will drop anything at a moment's notice to help any beginner with sympathy, patience and a smile. I am the mentor in the darkness. I am the friendly coach in the halls. I am the dunderinit for new happy programmers. I pledge my life and honor to the Beginners Watch, for this day, and all the scheduled conference days to come.*
54 |
55 | (based on [this](http://gameofthrones.wikia.com/wiki/Night%27s_Watch), for any
56 | non-GoT fans ;-)
57 |
--------------------------------------------------------------------------------
/conference.md:
--------------------------------------------------------------------------------
1 | # Getting the best out of the conference
2 |
3 | “Getting the best out of the conference” session (30 mins) -- suggested talks, don’t be afraid to ask stupid questions, what is an open space, what is a birds-of-a-feather session, etc
4 |
5 | - suggested talks.
6 | - don't worry about missing them! the "hallway track"
7 | - asking questions (don't be afraid to interrupt a conversation and ask for a few basic explanations)
8 | - lunch: don't be scared to rock up to a table and introduce yourself and ask what everyone's talking about
9 | - same for saying hi to anyone that's standing around on their own. (if they really wanted to be alone to do work or something, they'd be sitting down)
10 | - stop by the poster session and chat with other Pythonistas about their work
11 | in a low key setting
12 |
--------------------------------------------------------------------------------
/introduction.md:
--------------------------------------------------------------------------------
1 | # Welcome
2 |
3 | * What are we going to do today?
4 |
5 | * Intros of each coach
6 |
7 | * Intros of each participant
8 |
9 | * Run-through of each tutorial option
10 | - beginners + DG
11 | - Dive into Python (http://www.diveinto.org/python3/) aka DiP
12 | - challenges
13 |
14 | https://github.com/hjwp/python-conference-beginners-day/
15 |
16 | * Split out into tables
17 | - beginners (incl DiP)
18 | - intermediates
19 | - aim to have at least one coach per table
20 |
21 |
22 | # Some tips:
23 |
24 | * terminal stuff demos
25 | - up arrow
26 | - tab-completion
27 | - ctrl+r
28 | (Use Git-Bash on Windows)
29 |
30 | * Python console:
31 | - use IPython!
32 | - same bits re tab-completion etc
33 |
34 |
35 | ## Installing Python (and pip)
36 |
37 |
38 | * On Windows, just download the Python 3 installer from python.org. Make sure you tick the option that says **add python.exe to Path**
39 | ** If you can't install software on your laptop (maybe it's a work laptop), you can try http://winpython.github.io/
40 |
41 | * On Mac, again, download the Python 3 installer from python.org
42 |
43 | * On Linux, use your package manager. On Ubuntu, if you don't have pip, use
44 |
45 | apt-get install python3-pip
46 |
47 |
48 | ## Install Git-Bash (for Windows)
49 |
50 | Although Python does have excellent Windows support, there's a lot of stuff out there on the web that tends to assume you're on Linux or a Mac. Git-Bash gives you a command-line that's more Unixey, so more likely to be similar to what online tutorials assume you have.
51 |
52 | Download and install Git from https://git-scm.com/download/win
53 | Make sure you choose **Run Git and included Unix tools from the Windows command prompt**.
54 | Then use "Git Bash" for all your command-line stuff. You can now use ls, grep, and all that sort of unixey goodness!
55 |
56 | * Copy + paste:
57 | - The first time you open it, right click its title bar, edit the defaults, and set "edit mode" to be the default. That'll let you use the mouse to do copy and paste. When you have a selection, hit enter for it to be copied
58 | - Use Alt-Space, E, P for paste (sigh)
59 |
60 |
61 | ## Terminal shortcut tips
62 |
63 | A few things I wish someone had told me much earlier on in my unixey adventures!
64 |
65 | **Up arrow** in a terminal, lets you re-run the previous command. Up, then press enter. Or you can modify it. UP again goes further back in time, and down if you overshoot.
66 |
67 | **Tab completion** press tab once to see if the terminal can autocomplete the current command, whether it's an executable, or the path to a file, or even (sometimes) the arguments to a program. Press tab twice to see a list of options
68 |
69 | **Ctrl+R** enters history-search mode. Type part of a previous command to try and find it and re-run it.
70 |
71 | **Ctrl+D** is a shortcut to exit a program (actually, it sends the "end of file, EOF" character). It can exit Python, but it can also exit your main command-line terminal, so careful! If you're on windows and it doesn't work, try Ctrl+Z.
72 |
73 | **Ctrl+C** interrupts stuff, in Python or Bash. Good for stopping sprawling screens of text!
74 |
75 |
76 | ## Installing IPython
77 |
78 | IPython is an alternative to the regular Python command-line interpreter. It gives you much better tab-completion and a slighty better way of dealing with history and indentation. You can install it with
79 |
80 | pip install ipython
81 | # or, on mac/linux
82 | sudo pip3 install ipython
83 |
84 | Try the %paste command instead of the normal Ctrl+V for pasting mutli-line stuff into Ipython.
85 |
86 | IPython is very popular, particularly with the science crowd, but if you fancy being a bit different, try **bpython** instead.
87 |
88 |
89 |
--------------------------------------------------------------------------------
/prep.md:
--------------------------------------------------------------------------------
1 | # Beginners' day prep notes
2 |
3 | A few thoughs for organisers on what to do in advance.
4 |
5 | # USB keys
6 |
7 | To get around the issues with dodgy conference wifi, prep some usb keys with:
8 |
9 | * Python3.5 installers (for windows + osx)
10 | * pdf copies of each tutorial
11 | * an up-to-date copy of the repo
12 |
13 |
14 |
--------------------------------------------------------------------------------
/presentations/getting-the-best-out-of-the-conference.odp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hjwp/python-conference-beginners-day/5275efd544b5a5cd55a159a2825904954a625080/presentations/getting-the-best-out-of-the-conference.odp
--------------------------------------------------------------------------------
/presentations/intro-and-python-history.odp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hjwp/python-conference-beginners-day/5275efd544b5a5cd55a159a2825904954a625080/presentations/intro-and-python-history.odp
--------------------------------------------------------------------------------
/presentations/python-ecosystem.odp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hjwp/python-conference-beginners-day/5275efd544b5a5cd55a159a2825904954a625080/presentations/python-ecosystem.odp
--------------------------------------------------------------------------------
/presentations/virtual-envs.odp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hjwp/python-conference-beginners-day/5275efd544b5a5cd55a159a2825904954a625080/presentations/virtual-envs.odp
--------------------------------------------------------------------------------
/recommended-talks.md:
--------------------------------------------------------------------------------
1 | # Pycon 2016 recommended talks
2 |
3 | https://us.pycon.org/2016/schedule/presentation/1658/
4 |
5 | https://us.pycon.org/2016/schedule/presentation/2075/
6 |
7 | https://us.pycon.org/2016/schedule/presentation/2274/
8 |
9 | https://us.pycon.org/2016/schedule/presentation/1986/
10 |
11 | https://us.pycon.org/2016/schedule/presentation/2171/
12 |
13 | https://us.pycon.org/2016/schedule/presentation/2136/
14 |
15 | https://us.pycon.org/2016/schedule/presentation/2089/
16 |
17 | https://us.pycon.org/2016/schedule/presentation/1952/
18 |
19 | https://us.pycon.org/2016/schedule/presentation/2093/
20 |
21 | https://us.pycon.org/2016/schedule/presentation/2049/
22 |
23 | https://us.pycon.org/2016/schedule/presentation/2104/
24 |
25 | https://us.pycon.org/2016/schedule/presentation/1842/
26 |
27 | https://us.pycon.org/2016/schedule/presentation/1965/
28 |
29 | https://us.pycon.org/2016/schedule/presentation/2101/
30 |
31 |
--------------------------------------------------------------------------------
/resources-and-jargon-definitions.md:
--------------------------------------------------------------------------------
1 | # Resources and Further reading
2 |
3 | History and Free software:
4 | * "In the Beginning was the Command Line" by Neal Stephenson: http://www.cryptonomicon.com/beginning.html
5 | * "Hackers" by Steve Levy: http://www.stevenlevy.com/index.php/books/hackers
6 | * The GNU Philosophy articles: https://www.gnu.org/philosophy/philosophy.html
7 | * The Cathedral and the Bazaar: http://www.catb.org/esr/writings/cathedral-bazaar/
8 |
9 | Programming languages and Python:
10 | * Paul Graham on the advantages that a good language can bring: http://www.paulgraham.com/avg.html
11 | * Guido himself on the history and philosopy of Python: https://www.python.org/doc/essays/foreword/
12 | * The Python docs: https://docs.python.org/
13 |
14 | Science stuff:
15 | * High Performance Python (book): http://shop.oreilly.com/product/0636920028963.do
16 | * Jake Vanderplaas: https://jakevdp.github.io/
17 |
18 | Web Dev
19 | * the DjangoGirls tutorial - an excellent guide for total beginners, from "how the internet works" up to getting a blog site live on the Internet. http://tutorial.djangogirls.org/
20 | * http://www.obeythetestinggoat.com -- a good guide for after you've written your first proper Python project. TDD, Git, deployments. Focused on web development. More disclosure: this was written by the first author of this doc.
21 |
22 | Git et al
23 | * "Just enough Git to be (less) Dangerous" - http://eev.ee/blog/2015/04/24/just-enough-git-to-be-less-dangerous/
24 |
25 |
26 | # Some definitions and notes to read in your own time (handout)
27 |
28 | ## Python
29 |
30 | **Monty Python** an English sketch show from the 70s, famous for its absurdist sketches, which Guido named his programming language after. Google for: "The Cheese Shop", "Dead Parrot", "Bicycle Repair Man", "The Philosophers' Drinking Song", "The Philosophers football", "The Life of Brian", amongst so many others. The whole snake thing is wrong really, but it's cute, so we like it...
31 |
32 | **Python 2 vs Python 3** it's been a slow process, but it's just starting to feel like Python 2 really is the legacy version. People use Python 3 for new projects.
33 |
34 | **Guido van Rossum (the BDFL)** Guido is Python's inventor, and today we call him the BDFL - Benevolent Dictator For Life
35 |
36 | **PEP** A Python Enhancement Proposal, a public discussion document describing a proposed improvement to Python
37 |
38 | **dunder** short for "double-underscore", so you might pronounce `__init__` as "dunder-init". You don't have to say this if you don't want to though ;)
39 |
40 | **duck typing** - some programming languages are strict about objects belonging to particular types, and what types are allowed as arguments to functions, and so on. Python prefers a "duck typing" approach ("if it walks like a duck, and sounds like a duck, then it is a duck") whereby any object that implements the right methods can "pretend" to be of the right type, so it can be used by a function...
41 |
42 | **the REPL** - another word for the interactive interpreter. It stands for Read-Evaluate-Print-Loop, which is what interpeters do...
43 |
44 | **syntactic sugar** - this is a programming term not specific to Python, but it does come up. It describes a nice piece of syntax in a language that's not strictly necessary, in the sense that you can achieve the same effect without it, but the "syntactic sugar" version is shorter, more expressive, and makes your code look nicer. Python's @decorators are an example.
45 |
46 | **the GIL** - the "Global Interpreter Lock", an unfortunate feature of the cPython interpreter that means only one thread can do work at any given time -- which is why Python isn't usually very good at multithreading (this is a subtle topic, and things like PyPy are making changes here".
47 |
48 | **type hinting** a terrible idea.
49 |
50 |
51 | ## Packages:
52 |
53 | **package**: is the word for a bundle of Python files that you can use as a tool. A "library". Sometimes called a "module", although that's probably a less precise use of the term.
54 |
55 | **PyPI**: the Python Package Index. Used to be known as the Cheese Shop (because http://www.youtube.com/watch?v=PPN3KTtrnZM). A public directory of python packages, including links to their source code. Anything on PyPI can be pip installed. Anyone can upload a package to Pypi, all you need is to read the docs and create a special installation file called *setup.py*. (not to be confused
56 |
57 | **pip**: the standard Python command-line package installer. "pip install package-name" is the basic command. There used to be one called `easy_install`, essentially the same, now is less used. You can also manually download the source code for a package and install it by running the setup.py file, `python setup.py install`.
58 |
59 | **vitural environments** or [virtualenvs](http://docs.python-guide.org/en/latest/dev/virtualenvs/) constitute a very useful python tool to keeps dependencies in separate places and avoid conflicts. Packages can be installed globally or inside a virtualenv.
60 |
61 |
62 | ## Web dev:
63 |
64 | **HTML** Hypertext Markup Language is the code for web pages. What you see when you click "view source" in your browser. You know, `` and all that stuff.
65 |
66 | **JavaScript** a hideous car crash of a language that everyone looks down on, partially for good reasons, and partially because they're jealous that it's so popular, because it's the only language you can use in a browser. It's not that bad, really.
67 |
68 | **REST** "Representational State Transfer" is a standard for structuring URLs and how to do HTTP requests for data structures over the Internet. Used for APIs. A common pattern these days is to have a basic HTML site which does most of its interaction with your database via javascript and a REST API, instead of doing "normal" browser form interactions...
69 |
70 | **WSGI** the Web Server Gateway Interface is the standard protocol or API for request/response (traditional HTTP, ie not websockets/webrtc etc) web apps. Django, Flask etc all use WSGI. You could write your own web app that complies with the WSGI standard without using any of them, but it would be a little pointless.
71 |
72 | **websockets** are an alternative to the traditional request/response protocol for the web. They let you open a 2-way, "real-time" conduit between your web page and the server, so you can do real-time updates without needing to refresh the browser or use javascript. Think chat apps, notifications, etc. lots of websockets in twitter and facebook...
73 |
74 | **Django** is probably the most popular framework. It comes with lots of built-in tools like the "admin", a web ui for admin users to create database entries, a templating language for generating HTML, an "ORM" to make it easy to work with the database, and so on.
75 |
76 | **Flask** is a more "lightweight" alternative -- it doesn't include an ORM or a templating language, and its way of dealing with URLs is simpler, and you can use other ORMs (sqlalchemy is popular) and templating languages (jinja2 usually), but after a while, if your project is going to be complex, the third-party tools start to have inter-dependencies that do end up constraining your choices. Best for smaller projects, microservices etc.
77 |
78 | **bottle** is a micro-micro-micro framework. It's a single file!
79 |
80 | **web2py** is super beginner-friendly, but scorned by more experienced programmers, perhaps unfairly.
81 |
82 | **Pyramid** is very flexible and based on components you can choose to use or not. The slightly intimidating, harcore user's choice. Also, they have the coolest t-shirts.
83 |
84 | **Tornado** is the first non-wsgi web app framework in our list. It's often used to do websockets, but it can also do traditional request/response stuff.
85 |
86 | **Twisted** is the second, it's been around for ages, it actually does all sorts of network stuff, from serial port connections all the way up to being its own web server. Requires a slightly "twisted" way of thinking about programming (callbacks, "deferred" objects...).
87 |
88 | **Virtual Machine providers** - people who will host virtual servers for you. **Amazon Web Services (AWS)** is the biggest; Amazon rents out virtual machines and server services -- VMs, but also storage (S3), load balancing, databases... They have lots of competitors, like **Rackspace**, **Linode**, **Digital Ocean** and more (with varying level of capabilities)
89 |
90 | **PaaS (Platform-as-a-Service) providers** - people who want to rent you a service rather than a virtual machine. Usually you trade off convenience (eg, not having to worry about sysadmin, OS updates, load balancing) against flexibility (you may not be able to do everything you could do on your own server). The biggest is **Heroku**, see also **PythonAnywhere** for a Python-focused one [1]
91 |
92 | * [1] disclosure: original author works for PythonAnywhere.
93 |
94 | **Docker** is the trendy technology of the month. It's a lightweight alternatives to a VM - instead of one physical server running lots of virtual servers, you have one physical or virtual server running lots of "containers", which are little sandboxes that pretend to the process that runs inside them that they are all alone on a server, when in fact they are not. You can start a VM in 20-60s, but you can start a container in less than a second.
95 |
96 |
97 |
98 | ## (Data) Science stuff:
99 |
100 | **numpy & scipy** are two of the most popular scientific python libraries. Numpy has lots of tools for doing maths on big arrays of numbers, and scipy has lots of stats and analysis functions. scipy depends on numpy. If you're on windows, they may not "pip install" cleanly, so go to the scipy website and download installers, or look into Conda.
101 |
102 | **IPyton and the IPython Notebook** (now [Jupyter project](http://jupyter.org/)) is an HTML notebook environment based on iPython shell. As we saw earlier, Ipython is an enhanced Python interpreter. The Ipython Notebook allows to combine code execution, text and plots and has become the go-to coding environment for the scientific Python world.
103 |
104 | **pandas** is popular data analysis library that reproduces a lot of functionalities found in R and contains plotting functionalities. It is used a lot for dealing with tables of data (CSV, Excel) but also handles other formats like text files, HTML, json, SQL...
105 |
106 | **scikit-learn** is machine learning library built on top of SciPy/Numpy. It integrates a wide range of classification, clustering and regression algorithms.
107 |
108 | **nltk** is a natural language processing library. It provides tools for the classification, tokenization, stemming, tagging, parsing... of human language data.
109 |
110 | **matplotlib** is a well-revered plotting library for Python.
111 |
112 | **seaborn** is a data visualisation library based on matplotlib (but much nicer visually).
113 |
114 | **bokeh** is an interactive data visualisation tool in the browser (like D3.js).
115 |
116 |
117 |
118 | ## Open source, version control
119 |
120 | **Version control system (VCS)** - a system for managing snapshots of your source code. Popular ones these days are git and mercurial. In the bad old days you had subversion and CVS.
121 |
122 | **Git** - probably the most popular version control system (it was built by Linus and the other kernel developers to manage the Linux source code). It's also probably the least user-friendly!
123 | (link to that git-emailing-patches guide?)
124 |
125 | **Mercurial (hg)** - is a slightly friendlier version of git, written in Python. It's used to manage the Python source code.
126 |
127 | **GitHub** is the world's most popular code sharing site, and centralised git hosting tool. You can also put mercurial repos on there. There used to be **Google code**, but that's been retired, and there's sourceforge, which almost everyone has downloaded something off at some point. GitHub is like sourceforge but more focused on nerds, and with less random adware all over everything.
128 |
129 | **Bitbucket** is the plucky underdog to GitHub's thousand-pound gorilla
130 |
131 | **GitLab** lets you host your own github
132 |
133 | **Maintainer** is a person who decides what commits to accept into an open source project. They may not do the bulk of the work, or be a single person...
134 |
135 | **Patches** are a syntax showing changes to a file. Also (more or less) called a **diff**. The `patch` command can apply a patch to a file. Git is essentially a big complicated system for managing patches.
136 |
137 | **Fork** refers to the idea of taking a copy of an open source project, and maybe taking it off in a new direction -- either permanently (MariaDB is a fork of the Oracle version of MySQL, LibreOffice is a fork of OpenOffice), or maybe just in the very short term, while a developer tries out a new idea, before submitting patches to merge back into the main project
138 |
139 | **Pull Request** is Github's way of managing contributions from random developers to open source projects. Developer forks the main repo, makes a few commits, then does a "pull request" to ask the owner of the main repo to merge her changes.
140 |
141 | **Sprints** are focused periods of contributions to an open-source project, usually where people get together physically in a single room, and new contributors can get advice directly in person from the maintainer(s). There are usually sprints at the end of a conference! They're usually very welcoming to beginners...
142 |
143 |
144 | ## Development methodologies
145 |
146 | **Agile software development** Traditionally, software was developed in the "waterfall" model: requirements gathering first, then design, then build, then test. In the 90s, people started to try a different mode, with much shorter development cycles (weeks rather than months), aiming to get new features out in front of users as fast as possible, in smaller chunks. **Extreme Programming (XP)** was the first, and **Scrum** is now quite popular with corporations. **Kanban** has something to do with this too.
147 |
148 | **Lean Startup** is a counterpart to the agile model, where rather than taking months or years to build a fully-featured product and then trying to sell it to consumers, you instead try to build a **Minimum Viable Product**, the simplest, smallest thing that could possibly be useful, show it to users asap, and then iterate on it
149 |
150 | **Automated Testing** is a practice that grew out of XP, which is the idea that you can have automated tests for your software. **unit tests** are small tests for individual little bits of your code, although you can also write end-to-end tests for the whole programming. **TDD** (Test-Driven-Development) is the crazy idea that you can actually write tests *before* you write the actual code...
151 |
152 |
--------------------------------------------------------------------------------
/todos.md:
--------------------------------------------------------------------------------
1 | * Add links to docs/guides for each challenge
2 | * Look into problems with IDLE, think about different beginners' tutorial?
3 | * Push djangogirls more?
4 |
5 |
--------------------------------------------------------------------------------
/tutorials/download_urls.txt:
--------------------------------------------------------------------------------
1 | https://github.com/hjwp/python-conference-beginners-day/blob/master/tutorials/python-beginners.zip?raw=true
2 | http://inventwithpython.com/inventwithpython_3rd.pdf
3 | https://github.com/downloads/diveintomark/diveintopython3/dive-into-python3.pdf
4 | https://codeload.github.com/diveintomark/diveintopython3/legacy.zip/master
5 | https://www.python.org/ftp/python/3.5.2/python-3.5.2-macosx10.6.pkg
6 | https://www.python.org/ftp/python/3.5.2/python-3.5.2.exe
7 | https://www.python.org/ftp/python/3.5.2/python-3.5.2-amd64.exe
8 | https://github.com/hjwp/python-conference-beginners-day/archive/master.zip
9 | http://repo.continuum.io/archive/Anaconda3-4.1.1-MacOSX-x86_64.pkg
10 | http://repo.continuum.io/archive/Anaconda3-4.1.1-Windows-x86_64.exe
11 |
--------------------------------------------------------------------------------
/tutorials/python-beginners.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hjwp/python-conference-beginners-day/5275efd544b5a5cd55a159a2825904954a625080/tutorials/python-beginners.zip
--------------------------------------------------------------------------------
/tutorials/tutorials-and-challenges.md:
--------------------------------------------------------------------------------
1 | # Tutorials
2 |
3 | ## For absolute beginners
4 |
5 | * [Invent with Python](http://inventwithpython.com/) -- focused on Python itself, with all the examples being games :)
6 |
7 | * [DjangoGirls](http://tutorial.djangogirls.com/) -- more focused on web development, so HTML and CSS and server deployments as well as just Python.
8 |
9 |
10 | ## For programmers who already know another language
11 |
12 | * [Dive into Python 3](http://www.diveintopython3.net/)
13 |
14 |
15 | ## For people who already know a bit of Python
16 |
17 | Try our [Python programming challenges](../challenges), designed to improve your knowledge
18 | of some of the more advanced, but more Pythonic, Python features
19 |
20 | * list, dict, set comprehensions
21 | * magic methods and duck typing
22 | * decorators
23 | * lambda functions
24 | * context managers
25 | * generators
26 | * and more
27 |
28 |
29 | ## For people learning web development in Python
30 |
31 | Nothing beats [Harry Percival's book](https://www.obeythetestinggoat.com) for a comprehensive overview of modern software engineering techniques, django, test-driven development, version control workflow, refactoring, and plenty more. [citation required]
32 |
33 |
34 | ## For sciencey people:
35 |
36 | * Conrad's [4 pydata uk beginners' notebooks](http://conrad.pythonanywhere.com/pydata)
37 |
38 | * Vincent's [intro to numpy and pandas notebook](https://github.com/koaning/python_data_intro/tree/master)
39 |
40 | * [Try the Jupyter notebook in your browser](http://jupyter.readthedocs.io/en/latest/tryjupyter.html).
41 |
42 | * Check out the [Gallery of interesting notebooks](https://github.com/ipython/ipython/wiki/A-gallery-of-interesting-IPython-Notebooks)
43 | to see the many great things Python can do and the
44 | [Jupyter Notebook Viewer](http://nbviewer.jupyter.org/) for a way to share notebooks
45 |
46 | * [top 8 pandas tutorials](http://www.dataschool.io/best-python-pandas-resources/)
47 |
48 | * scientific Python lectures: http://github.com/jrjohansson/scientific-python-lectures
49 | * data science Python: http://github.com/donnemartin/data-science-ipython-notebooks
50 | * official Pandas tutorial: http://pandas.pydata.org/pandas-docs/stable/tutorials.html
51 | * Pandas lessons & tutorials: http://bitbucket.org/hrojas/learn-pandas
52 | * Scikit-learn tutorial by Gael Varoquaux at EP 2014: https://github.com/GaelVaroquaux/sklearn_europython_2014
53 | * simplified text processing with textBlob: https://textblob.readthedocs.org/en/dev/
54 | * official Seaborn tutorial: http://web.stanford.edu/~mwaskom/software/seaborn/tutorial.html#tutorial
55 | * official Bokeh tutorial: http://bokeh.pydata.org/en/latest/docs/tutorials.html
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------