-
7 votes
-
New major versions released for the six core Pallets projects - Flask 2.0, Werkzeug 2.0, Jinja 3.0, Click 8.0, ItsDangerous 2.0, and MarkupSafe 2.0
7 votes -
Pyodide is now an independent project - The CPython 3.8 interpreter compiled to WebAssembly which allows Python to run in the browser, originally developed at Mozilla
9 votes -
Exploiting machine learning models distributed as Python pickle files, and introducing Fickling: a new tool for analyzing and modifying pickle bytecode
3 votes -
A recent Python Enhancement Proposal targets adding "exception groups," as well as new syntax to catch and handle the groups
4 votes -
What is a class in Python?
I've been learning a bit more Python, going through a Udemy course to expand my skills a little. One of the programs the course guides you to make is a little dictionary, but it currently only...
I've been learning a bit more Python, going through a Udemy course to expand my skills a little. One of the programs the course guides you to make is a little dictionary, but it currently only runs once and then quits.
I'd like to adapt it to use a nice TUI that keeps itself open until the user specifies they want to quit, using something along the lines of npyscreen. However, this library uses classes, and that's not something I'm yet familiar with. I'd rather have an understanding of what classes are, how they work, and why to use them before I take the plunge and start fiddling around with npyscreen (although I'd be interested to hear if you think that I should Just Do It instead).
Can anyone give or point me towards a good explanation of the what, how, and why of Python classes? Or better yet, a tutorial that will give me something to write and play with to figure out how it all fits together?
Thanks!9 votes -
[Python] Buffer overflow in PyCArg_repr
5 votes -
Input from a text file, pull from multiple APIs, formatting output, etc. in Python
I don't need answers so much as an idea of where to start. Essentially, I have a Google Sheet that uses importjson.gs to pull from the following APIs OMDB (IMDB) TheMovieDB TVMaze I also use...
I don't need answers so much as an idea of where to start.
Essentially, I have a Google Sheet that uses importjson.gs to pull from the following APIs
- OMDB (IMDB)
- TheMovieDB
- TVMaze
I also use another script to scrape Letterboxd for ratings.
This works well, but sometimes it'll time out or I'll hit urlFetch limits that Google has in place.
Basically, I'd like to have a text file (input.txt) where I pop in a bunch of titles and year or IMDB IDs, then the script runs and pulls set endpoints from all of these, outputting everything on one line (a pipe as a delimiter.)
My thinking is that I can then pull that info a sheet and run all of the formatting, basic math, and whatever else so it suits my Sheet.
I have a feeling I'll be using
requests
for the JSON andbeautifulsoup
for letterboxd -- or maybe a module.Can anyone point me in the right direction? I don't think it'll be too difficult and should work well for a first python project.
7 votes -
Python has accepted the proposal for a new pattern-matching structure, will be added in version 3.10
26 votes -
Ten awesome, rigorous, and curated Python interview questions
5 votes -
Installing and analyzing every package in PyPI to look for malicious activity
6 votes -
makesite.py - Simple, lightweight, and magic-free static site/blog generator
7 votes -
How to design a database?
I'm working on an application that allows a user to view playlists belonging to a particular radio show and stream/download/favourite the tracks in them. It has 4 core entities: User, Show,...
I'm working on an application that allows a user to view playlists belonging to a particular radio show and stream/download/favourite the tracks in them. It has 4 core entities: User, Show, Playlist and Track.
- Each show has multiple playlists (one-to-many)
- Each playlist has multiple tracks (one-to-many)
To be able to reference a playlist belonging to a particular show. I gave those playlists the same uuid as the show they belong to. A few questions though.
- Is this the right/best way to associate data?
- As a track could potentially belong to multiple playlists, I can't take the same approach as I do for (show/playlist) How would be best to handle this? Ideally I would like to have a single "Track" table containing all tracks for all playlists.
For any experienced database designers out there, how would you structure this data? What would you consider in designing the schema and why? If I did go with 4 tables only, presumably there would be performance implications given the potential amount of data in any one of those tables, particularly tracks. If that is the case, how best to structure this kind of thing with performance in mind? Thanks in advance for any help :)
For reference, in case it's of importance, I'm using sqlite3.
5 votes -
Architecture for untrained software engineers (Python)
Hey everyone, I've been programming for some time now but notice without any formalized education in CS I often get lost in the weeds when it comes to developing larger applications. I'm familiar...
Hey everyone,
I've been programming for some time now but notice without any formalized education in CS I often get lost in the weeds when it comes to developing larger applications. I'm familiar with the principles of TDD and SOLID - which have helped with maintainability - however still feel that I'm lacking in the ability to architect a properly structured system. As an example, I'm currently developing a flask REST API for a website (just for learning purposes). This involves parsing a html response and serializing the result as JSON. I'm still quite unclear as to structuring this sort of thing. If any more experienced developers could point me in the right direction/offer up their opinion I'd be very appreciative. Currently I have something like this (based - I hope correctly? - on uncle bob's clean architecture).
Firstly, I'm defining the domain model. i.e the structure of the API response. Then, from outside in.
- Infrastructure (Flask): User makes request via interface (in my case a request to some endpoint)
- Adapters: request object checks if the request is valid (on the way back it checks if the response is valid) - Is this layer only for error handling?
- Repository: I'm struggling a bit here, AFAIUI this layer is traditionally a database. In my case however, where the request is valid, is this where I should handle the networking layer? i.e all the requests to return the website source? I'm also confused given at this stage I should be returning the relevant domain model, like an ORM, but as my data is unstructured, in order to do this I need to transform the response first. Where would it be best to handle this?
- Use Cases: Here I transform the domain model depending on the request. For example, filter all objects by id. Have I understood this correctly?
- Serializers: Encode the domain model as JSON to return from flask route.
If you got this far, thanks so much for reading. I really hope to hear the opinions of more experienced devs who can steer me in the right direction/correct me should I have misunderstood anything.
8 votes -
Passing the Same Parameters to Multiple Functions
6 votes -
What is the best way to teach Python for my 11-year-old sister that lives in another state?
This may seem an obvious question, but not as much as it seems. She uses Windows, I’m currently using Linux/macOS. How to instruct her to install her Python environment? Should I use Zoom, Skype,...
This may seem an obvious question, but not as much as it seems. She uses Windows, I’m currently using Linux/macOS. How to instruct her to install her Python environment? Should I use Zoom, Skype, Google Hangouts, or another solution? Is there and easy way for live-drawing (online blackboard) to explain things to her visually? And, perhaps most importantly, how can I do that for free?
13 votes -
Debugging a misbehaving Python program that makes significant use of asyncio
4 votes -
What's coming in Python 3.9
19 votes -
Write a Simple Steganography Program using Python
5 votes -
Variations on the Death of Python 2
8 votes -
JetBrains Academy - Learn to program in Python, Java, or Kotlin by creating working projects - Currently available for free
17 votes -
What's the current state-of-the-art in Python package creation/distribution?
I've been thinking on and off about packaging up a few simple Python utilities I've written to stick up on Github for people to use if they want, but, every time I go to check out how one goes...
I've been thinking on and off about packaging up a few simple Python utilities I've written to stick up on Github for people to use if they want, but, every time I go to check out how one goes about managing dependencies and all that for a project, I run into a whole wall of options. Does anyone better versed in all of this have any recommendations for me?
11 votes -
Python Web Scraping with Virtual Private Networks
3 votes -
JPMorgan's Athena has 35 million lines of Python code, and won't be updated to Python 3 in time
6 votes -
The debate over adding support for the IANA time zone database to the Python standard library
7 votes -
Jupyter Notebooks in the IDE: Visual Studio Code versus PyCharm
4 votes -
(ESR) Notes on the Go translation of Reposurgeon
8 votes -
A version of Python called "Snek" targeting embedded processors
10 votes -
Minimal TOTP Generator in 20 lines of Python
7 votes -
My Python Development Environment, 2020 Edition
9 votes -
Guido van Rossum, the creator of Python, is leaving Dropbox and heading into retirement
13 votes -
Faster ZIP Decompression
8 votes -
Python 3.8.0 has been released
26 votes -
Safeway coupons, automation, and reversing private APIs
9 votes -
Wrecking ball animation - 14 lines of Python in Blender 3d
10 votes -
PyPy's new JSON parser
5 votes -
Python for Beginners - Microsoft Developer
5 votes -
The journey of building mypy and type-checking 4 million lines of Python at Dropbox
6 votes -
Turtle graphics in JavaScript the goofball way
5 votes -
How Instagram uses static analysis like linting and automated refactoring to help manage their multi-million-line Python codebase
10 votes -
Domino animation in 10 lines of Python (Blender 3d)
5 votes -
Python challenges or projects with just the standard library?
I've been slowly learning python for some months already. I used the Python Crash Course book from No Starch Press, it teaches the basics and then goes on with some projects with pygame,...
I've been slowly learning python for some months already. I used the Python Crash Course book from No Starch Press, it teaches the basics and then goes on with some projects with pygame, matplotlib, etc.
However, I feel that my Python skills aren't very good yet, and before learning to use libraries I would like to have a better command of the standard library.
I have been looking for some book with projects or, even better, challenges using just the standard library, but haven't found any good ones. Most of them either are for absolute beginners, or use additional libraries, or are very technical and without focus on practice.
Do you know of any good book or resource with challenges or projects that don't depend on additional libraries? Or, do you have any idea for a project or challenge using just the standard library?
Thanks in advance!
14 votes -
Python built-ins worth learning
13 votes -
Why I'm not collaborating with Kenneth Reitz
25 votes -
Humble Book Bundle: Python books by O'Reilly
4 votes -
Write Yourself A Git - write your own version control to help understand git internals
7 votes -
Regrettable Code, Episode 1 - a senior dev's look at debugging python code
11 votes -
How Dropbox rolled out one of the largest Python 3 migrations ever
16 votes -
‘Master/Slave’ Terminology Was Removed from Python Programming Language
47 votes -
How do you keep pypi programs up to date?
If you install a bunch of stuff from pypi (like in virtualenv), how do you keep abreast of security fixes and updates etc?
7 votes