r/learnpython • • Jul 16 '20

Just finished "Automate The Boring Stuff With Python''. What next?

Should I start building projects? What are some good beginner projects to start on? What books will help me build projects?

375 Upvotes

88 comments sorted by

170

u/skiutoss Jul 16 '20 edited Jul 16 '20

Build some small project.

Example:
Build a tiny web application that you can spin up locally or deploy somewhere (you can use Flask, or FastAPI).
The application should:

  • Check what you're listening to on spotify (through spotify API)

  • Fetch from somewhere the lyrics to the song you're listening to (some other lyrics api)

  • display the lyrics pretty on a webpage in your app

Caveats:

  • Find a way to not store secrets like API keys (for authentication to apis) with your code

  • Application should have some basic unit tests for its logic

  • Should follow Model-View-Controller design, but not strictly

  • All of this should be saved in some version control system (Github, Gitlab)

Building this will teach you:

  • How to design a simple web application with Flask

  • Fiddling around with html/css

  • Learning how to efficiently use requests package for making API calls

  • Parsing JSONs

  • How to show JSON data prettily in a webpage

  • Git

  • How to write unit tests

  • Reading documentation

  • Bashing your head against an application that sort of mirrors what a proper "real-world" web application might look like

  • Have a project in your portfolio

12

u/linuxlib Jul 16 '20

Find a way to not store secrets like API keys (for authentication to apis) with your code

All of this should be saved in some version control system (Github, Gitlab)

The consensus about the proper way to do this seems to be store the keys in a local file, usually not within the same directories as your code. Often the suggestion is to put it in the current user's app data directory and make it user generic, that is not tied to a particular user (like the author). The big thing is: Make sure this file does not get uploaded to your top-level git repo where anyone can see it. The entire reason for putting it in a separate file is so you can prevent this.

4

u/expertgamers Jul 16 '20

Wouldn’t environment variables be a better alternative to storing files? That way you don’t accidentally push them to a repo or something?

3

u/Ajha7 Jul 16 '20

Quick question, do you if environment variables are a thing in Macs?

1

u/expertgamers Jul 16 '20

Yes, Macs do have environment variables. In a terminal you can view them using printenv and set them using export VARIABLE_NAME=VALUE. Although, you would have to set them every time you load a new terminal since they are not permanent. I’m sure they can be made permanent, but I’ve never looked into it.

3

u/ademwanderer Jul 16 '20

I think if you add the export command to your bash_profile in your home directory it should remember them every time you open a shell (you may have to source it the first time).

3

u/DrShocker Jul 16 '20

If you go this path but also keep your dot files and other settings on github, then you've just given yourself the same issue you started with lol

2

u/ejpusa Jul 17 '20

vi .bashrc

Add them there.

1

u/Ajha7 Jul 16 '20

Ok thanks, sry im a newbie

1

u/expertgamers Jul 16 '20

All good. Good luck with whatever your doing, though!

2

u/skiutoss Jul 16 '20

env variables are my go-to solution for this most times. :)

1

u/expertgamers Jul 16 '20

They definitely take the worry off of carefully making sure I don’t push my secret keys to my repos

2

u/linuxlib Jul 16 '20

Might very well be.

But if you use a file put it somewhere that's not under version control (like your personal app data dir) for that very reason.

1

u/expertgamers Jul 16 '20

That’s also true. Both ways are definitely valid, I guess it’s up to personal preference.

4

u/snip3r77 Jul 16 '20

I'm interested in accessing the Spotify api. I read through and it's not that easy. Is there a tutorial for python based .

Also I know there's a Spotipy library but I think it has stopped development.

Can help to point at the right direction? Thanks

4

u/skiutoss Jul 16 '20

It seems the easiest way is to use spotipy client. Someone wrote a blog post on how to get started with getting authenticated and start making calls.

Really and truly the best way at least in my opinion is to get familiar with how REST architecture works, the Spotify docs, and play around with any webclient you have available like curl.

1

u/snip3r77 Jul 17 '20

oh so the native spotify api is using REST? no wonder it's so different then normal API .

2

u/nitissue Jul 16 '20

Thank you so much for this. I've been spending the past few days trying to figure out what I can work on with the Spotify API. As a beginner, this helps me a LOT. 😁

3

u/skiutoss Jul 16 '20

No worries, by all means if you want someone to review your code and help out when you're stuck, feel free to DM.

2

u/Reptile449 Jul 16 '20

I recently made a web app for my first Python project and would throw in learning how to use Fetch with javascript. Gives you some quick javascript knowledge and lets you update web pages without reloading the page.

1

u/alonso284 Jul 16 '20

I've seen the word API all around python subreddits, what does it mean?

2

u/skiutoss Jul 18 '20

Well, a quick google search will definitely answer that question, but in general, an API is a common interface that you can use to programmatically communicate with different services.

Following the Spotify example: Spotify exposes its own API, and has it all well documented. You can have a program authenticate to your Spotify account and fetch data like current songbeing played, much in the same way the web or mobile application does with a pretty GUI.

Normally an API will answer to web requests, like GET, POSTs.
Nowadays, everything is an API or an API call behind the scenes, so it's a great move to get acquainted with them.

1

u/veleros Jul 16 '20

Does “how to automate the boring stuff” teach flask?

7

u/skiutoss Jul 16 '20

I'm not sure, I guess I'm one of few in this sub who hasn't started out with that particular book.

But there's plenty of resources to get up to speed with Flask, one of them being Miguel Grinberg's Flask Mega Tutorial.

2

u/corbanmonoxide Jul 16 '20

I can second this tutorial. Very easy to follow and great concepts to practice.

0

u/[deleted] Jul 16 '20

[deleted]

1

u/jumbo53 Jul 16 '20

Remindme! 1 week

191

u/sme272 Jul 16 '20

You should use what you've learnt and start automating some boring stuff.

45

u/gangculture Jul 16 '20

this... if you can’t apply what you’ve learned on your own, then you weren’t learning, you’ve just read a book.

14

u/SubstantialIce2 Jul 16 '20

Going through this stage right now. I’m in chapter 3. I caught myself early. I was just reading and not enforcing what I learned. Big mistake. Every chapter or topic I’m making sure I create projects in multiple ways so I can solidify the info. Programming is my opinion not that complex because you can get to the same ans. Multiple ways and that is why I like it.

4

u/[deleted] Jul 16 '20

I have fallen into this trap. Got a few hours through an online course I'm doing and realized none of it had stuck. I'm going over everything I've covered already before advancing any further.

1

u/stickedee Jul 16 '20

This comment should be stickied somewhere

9

u/Elteras Jul 16 '20

I've only been learning for a little while but my problem is, when I learn something I really struggle to think what, in practice, to do with it to practice. I usually just default to simple text based game stuff because games are what I understand, but i feel it's limiting and inefficient sometimes. Do you have any tips on how to think or decide what to do?

3

u/sme272 Jul 16 '20

Focus on a goal and let that direct the learning. Pick a project that interests you and that'll tell you what to learn and you'll get practice doing it at the same time.

2

u/Elteras Jul 16 '20

It's hard to just find something that interests me that can use the things I'm trying to train though, and whenever I try too hard to come up with an idea my mind goes totally blank. I know I need to focus on a goal, but I can't find the goals!

1

u/[deleted] Jul 16 '20

I have a pretty big project in mind. Do you know of a good place to figure out exactly what I’ll need to learn to complete it? I’ve learned some Python, HTML and CSS, but there are still several aspects to the project that I’ve got no clue how I would go about creating or even what to google to figure it out.

For anyone who’s curious, the project would be an online DnD platform with a drawable map, a chat with some commands for rolling dice and what not and a few other features specific to the game. Not unlike Roll20 or Fantasy Grounds for anyone familiar with those.

6

u/JaxIsGay Jul 16 '20

The book even says that you should read parts of it again to understand it. If OP can't make something yet, time to go back to page 1

44

u/unhott Jul 16 '20

Manually do the interesting stuff.

5

u/ChiefLoneWolf Jul 16 '20

“Hun, I got a new book idea!”

10

u/SirKainey Jul 16 '20

I did Python Crash Course after Automate the Boring Stuff. Goes into more detail

1

u/aspiringpterodactyl Jul 16 '20

Is this the one by Colt Steele?

1

u/SirKainey Jul 16 '20

Eric Matthes

4

u/[deleted] Jul 16 '20

[removed] — view removed comment

5

u/SirKainey Jul 16 '20

Yup! Automate the boring stuff should be a breeze after PCC.

4

u/solariportocali Jul 16 '20

I went with Python Crash Course first and am now working through Automate the Boring Stuff. I'd say doing Crash Course first is, like you're doing, ideal; Sweigart claims that Automate the Boring Stuff is for beginners, but... well, it's not. Not entirely. It flies too quickly through the material. Having Crash Course under my belt is helping tremendously, and Automate is adding tons of good detail.

2

u/Clicking_Circles Jul 16 '20

They both teach basics - I’d only recommend one or the other. They both are good books.

9

u/mujolocal Jul 16 '20

that book is good for making you comfortable. If you want some real computer science skills the next step is: http://composingprograms.com/ this is a great resource is youre self taught. makes you nearly able to get a job in the field.

8

u/[deleted] Jul 16 '20

You could start make something to get rid off stuff that annoys you. Automatic processing of word docx or more.
If you want to do some co-op, we got a discord with different levels of skill and I always seek people to do projects with

3

u/Triggs390 Jul 16 '20

can you send me the discord as well?

0

u/[deleted] Jul 16 '20

[deleted]

1

u/[deleted] Jul 16 '20

ofc, PM me

6

u/MeatyLabiaLover Jul 16 '20

Automate the interesting stuff

5

u/[deleted] Jul 16 '20

Set yourself a project to work on, and learn things as you go along. Trust me; you will learn a LOT more and a lot faster if you're working on something you're actually interested on.

I was working on a discord music bot for quite a while and it was huge for teaching classes. It's functional, too. I started out by copying bits of code from various GitHubs, then reading through the discord py documentation and figuring out what does what and tinkering/switching it up. Added a bunch of other functionalities too.

Learning for the sake of learning is hardly efficient. If you learn with a purpose (ie. "How do I make this program wait for input and continue looping until the correct input is supplied") you'll learn a lot more pointedly.

9

u/HighO1 Jul 16 '20

Than explore other books from same author -Al Sweigart

cracking codes,code in minecraft,invent your own game,making game with pygame

4

u/Petelah Jul 16 '20

Start a project! best way to master other aspects of python. Tech with Tim on YouTube has some great ideas to get started on.

4

u/mr_chanandler_bong_1 Jul 16 '20

My best bet was to go after Complete Python Bootcamp - Go from zero to hero .

Or Complete Python Developer Course by Udemy, instructor was amazing and I'm much more confident with python now than I was after finishing ATBSWP. Now I know OOPS too and using functions to automate most of the stuff by defining functions.

Even though ATBSWP was good, it's good for beginners, to get more confident, you could go through above mentioned courses which will make your basics much stronger.

3

u/Dragon20C Jul 16 '20

I made pong with pygame completely different how about making a name finder in a spreadsheet with reverent names etc

3

u/honk-thesou Jul 16 '20

Don’t use a book that help you build projects. You will just follow them as you followed that book. Now look for a project and build it by yourself googling stuff. That’s how you will learn

2

u/Aggravating-Ad-2339 Jul 16 '20

If you are interested in using your Python knowledge for machine learning projects then I would recommend Hands-On Machine Learning with Scikit-Learn, Keras & Tensorflow by Aurelien Geron. There are a couple chapters where he goes through a project from start to finish using the classic datasets for learning - i.e titanic, autos, wine, boston housing. Also tons of code examples for smaller projects and practice. I believe the book is meant to be followed through with the code/jupyter notebooks shared on Github. I was in a program and I used this book for studying process but from how its written, its meant to be 'hands-on'.

1

u/6ImLightningMcQueen9 Oct 03 '24

how long did it take you to go through the machine learning book and actually be half decent at doing ML stuff afterwards?

2

u/espero Jul 16 '20

Practicalbusinesspython.com ?

2

u/Cornel-Westside Jul 16 '20 edited Jul 16 '20

I just finished that book as well. Just to give you some ideas, I've made 3 quick things after/during the book.

  1. A script to pull financial data from Mint and put it in my finance spreadsheet (instead of doing that by hand monthly). It automatically does this every month - it was pretty simple, took me maybe 4-6 hours - mostly wrestling with the Mint API I found online.

  2. A script to pull some info monthly from Yahoo Finance that tracks the performance of some basic investment algorithms I use. This was easier than the first one because the python yahoo_fin library is well documented and has lots of info on its use. Probably took 2-3 hours.

  3. A script that automatically sorts my download folder into separate areas depending on the filetype of the download folder, and deletes duplicates. This was using the watchdog library. This was simple in theory, but there were some practical challenges that were useful to troubleshoot. When files are written to the disk, the filename can appear, but the file may not be completely downloaded to be ready to be moved, which can lead to corrupted files. So it was useful to have to learn at an OS level how to handle these kinds of race conditions. Probably took another 2-3 hours.

Future project ideas for me involve automating more web applications (maybe an auto-login for my gmail while keeping it secure - I use 2FA so I don't know how possible it is to do this). I may try to do some work related things - I'm a mechanical engineer so I might try to automatically read PDFs of drawings to automatically check for all necessary fields (name, description, revision number, next assy, material, etc.) which would be really huge for productivity.

Long term, I would love to write a chess engine or other game simulations. Data visualization for mechanical analysis at work would be another interesting option. Building some inverse kinematics or other library for robotics/mechanical automation would also be fun. And before I read this book, I would have said these things are super far away, but now they actually seem very possible. So much has already been developed and you can just customize with the amazing free tools people put out to get exactly what you want.

2

u/Viren_p Jul 16 '20

Start doing projects and also would recommend reading "Practices of python pro by dane hillard" for improving your OOP, design descisions and code more idiomatic python

1

u/geos59 Jul 16 '20

How is that anyways? I have it bookmarked, but haven't used it yet; is was it actually useful?

1

u/heaplevel Jul 16 '20

What do you like? Games, logic, hardware, web etc?

1

u/blackuchiha1192 Jul 16 '20

Once I finished that course I started building small CLIs to help me with local tasks on my computer. Once I built enough I got familiar with too yet and made them into a sing lizard desktop app that calls functions. From there I started building flask sites and more and containerizing them. Of course that’s just my other but hopefully that helped some! I am diving back into the scraping part!

1

u/z-oid Jul 16 '20

Do you feel as though you learned anything in the process?

I've been looking for good sources of information on learning Python as I'm currently stuck in the tutorial loop.

1

u/Avi_TheCodex Jul 17 '20

Build projects in areas you are passionate about!! If you are looking for something to start off on, try building this Weather API Dashboard with Python and Flask... one of my first projects in Python.

https://blog.thecodex.me/weather-dashboard-python-and-flask/

Full text & video tutorial ^ If you get stuck anywhere in the project, tag me and I can help!

1

u/Remote_Cantaloupe Jul 17 '20

Automate the exciting stuff?

1

u/JeamBim Jul 17 '20

Yes, start building scripts for anything you can think of.

Then get into Flask or Django. These are some of the best ways to learn how to put together a larger project.

1

u/thrallsius Jul 17 '20

find more boring stuff to automate now :)

1

u/Rude_Order Jul 16 '20

Give yourself a project to solve. Have you tried tic tac toe? Connect 4?

1

u/SnicSnac Jul 16 '20

Automate the boring stuff I guess.

1

u/[deleted] Jul 16 '20

Start automating the boring stuff, try using Python

0

u/[deleted] Jul 16 '20

>Just finished "Automate The Boring Stuff With Python''. What next?

Automate stuff with python?

6

u/Whackles Jul 16 '20

I do wonder what it is you all constantly do that can be automated? I can’t think of anything like that

6

u/Micotu Jul 16 '20

our work makes us scan a qr code on a sheet every day which pulls up a website that we have to type in our name, select todays date, answer 3 questions about if we have come across anyone with covid. if we have any symptoms and have us enter our temperature. It's a bit annoying because the answers for me are the same every day except for the temperature and today's date. I emailed myself the website that the qr code pulls up and made a python script that asks me for my temperature. I enter it, and then it pulls up the page with selenium and fills in my name, fills in todays date using datetime ,clicks the buttons to answer the questions and then enters in the temperature i entered at the start. I put some time.sleep(2) in there so i can review each page before it is submitted, and it lets me hit the final submit, so if something looks wrong like if they change the website, i can back it out and fix it. I later decided i didn't want to use my keyboard to enter my temp, so i made a gui with tkinter where i select the numbers on the gui to enter my temp.

Was this needed? no. Does it save me a lot of time? no. It does save me about a full minute at the start of every day, and makes me not be as annoyed at having to pull out my phone and enter my temp, but more importantly, i learned how to use selenium and tkinter and if i need them for a new project i know what each are capable of. oh and the program makes me happy.

0

u/ChrisIsWorking Jul 16 '20

Try some data analysis. Kaggle has some datasets. Learn to use Jupyter and some charting libraries.

I learned this in codecademy if you’re interested.