Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
os.path vs pathlib?

One short question, how and when do you use this modules?

​

For a very long time I only used os.path, but recently I discovered pathlib. My short answer:

os.path, if I just want to check if the path exists or just a few actions.

And pathlib for complicated tasks, like a base folder in various functions or class.

​

What do you think about this?

/r/Python
https://redd.it/l45ojr
This media is not supported in your browser
VIEW IN TELEGRAM
Improved autocompletion in JupyterLab with the LSP

/r/JupyterNotebooks
https://redd.it/l47doj
SimpleGUIBuilder - A GUI for designing Python GUI's for PySimpleGUI

Hello Python people :)

I don't really like doing frontend but I really like the idea of giving my backend/terminal programs something more pleasurable to interact with and look at.

That's when I came across PySimpleGUI, a simple solution to quickly give my programs an interactive front. Shortly, it allows you to quickly create a GUI by designing its layout and then map it to your backend code.

But in checking it out I found I wanted more and had an idea: It would be nice if PySimpleGUI and therefore GUI making was in itself more interactive.

And that's how SimpleGUIBuilder came to be: A GUI for creating/designing GUI layouts for PySimpleGUI, made with PySimpleGUI.

I hope this will be useful to people :)

You can get it in the releases and check out more info here in github.

Short preview

/r/Python
https://redd.it/l46dz4
Monday Daily Thread: Project ideas!

Comment any project ideas beginner or advanced in this thread for others to give a try! If you complete one make sure to reply to the comment with how you found it and attach some source code!

/r/Python
https://redd.it/l4b3uy
AF Questions on a github repo / second guessing myself for a job interview

Hello,

I’m interviewing for a flask developer position and part of the process is this:

“Use Case: Building a Cloud Portal

After looking around to leverage other gov code, you find an available repo to use as a portal for your future cloud portal. Before using it, you want to review the instructions, deploy the system locally to your computer, and provide technical feedback on the README.md file that you could use to streamline the local deployment of the application.

After getting the system running, you are excited to show your work and setup a demo for the application for us to see.

The repo is locating here: https://github.com/dod-ccpo/atst

After attempting to deploy this application on multiple systems (mac os, windows, linux and docker) I’m unable to for a multitude of reasons,

My questions are the following: Is this code base fucked or what? What’s the point of using poetry (first time ive ever seen it) when better alternatives exist? Why reinvent the wheel? Why the hell would you want to use one script rules them all? Is this repo a test and it’s not meant to at work at all and they want to see what I say?

And also, for the record the docker deployment doesn’t

/r/flask
https://redd.it/l4clcy
Hiring Senior Backend Engineer | HR SaaS (Remote)

HI!

My team is looking for a skilled Senior Backend Engineer to join our growing 4-person engineering team. We're looking for someone with deep experience in Django Rest Framework and how it fits into a SaaS product.

Tech stack: Vue+Django, but open to other backgrounds

Compensation: $120k-150k base

Location: Remote (open to global applicants // we have team members in USA, Canada, and Europe // no visa transfers)

Company: Pequity

Mission: Equal pay and opportunity for all

Funding: Seed

Requirements:

Must have previous professional experience as a senior backend engineer
Startup experience highly preferred but not required
SaaS experience highly preferred by not required
Full-time preferred, but we can be flexible

If interested in learning more, please shoot me a message here and to warren@getpequity.com

/r/django
https://redd.it/l49bt0
Show profile page after login

If possible I'd like some help with a little self-teaching project. So I was following flask's own tutorial to build a blog. See here. I've managed to get the login and registration pages up and running with a connection to a mariadb server sitting on a raspberry pi in my network.

So I decided to expand on it to create a profile page which requires the user to be logged in to view. I created a new py file and a new html page to display this profile page. However, when I add the @loginrequired to the blueprint route for the profiles page it throws an app.context error.

Profile page code snippet

@zerg.beforeapprequest
def load
loggedinuser():
userid = session.get('userid')

if userid is None:
g.user = None
else :
db = get
db()
cur = db.cursor()


/r/flask
https://redd.it/l3zz22
Best way to display python code and graphic outcomes in a Django site?

If I want to display some python code, and its resulting output and graphs as part of a Django page (I haven't decided if the visitors can or cannot modify the code, and rerun), what is the best way to do it? If I allow visitors to tweak the python code to see different output or graphs, is it really risky as a site security point of view?

/r/django
https://redd.it/l4i0of
Creating a scalable Flask Application

We have a large flask application containerized using docker, different services are exposed via different endpoints. The application has a total of 5 containers with multiple deep learning models

The system is supposed to get data in large bulk, so it should be able to use hardware at full capacity on heavy load

I researched and found some ways (mentioned below) to make application scalable but which one to choose

​

1. Gunicorn
2. Docker swarm

/r/flask
https://redd.it/l4lb1v
Does your Flask-powered site has robots.txt?

My first Flask project went into production mode a couple of days ago. What's different about my project is that I'm replacing a 5-year old php-powered site with a brand new python app. The project is a directory for professional services, and the old site was built using WordPress. I've analysed the structure and tried to preserve all of the important endpoints, but did not try to make sure that every WP endpoint would have an equivalent in the Flask app. There were just too many rudimentary endpoints that did not serve any meaningful purpose. Since the new site went live, I've been monitoring the requests that resulted in 404 error. There are hundreds of such requests per day, and it looks like most of them are made by bots. There are also lots of requests for the images that are no longer where they used to be - perhaps these images were embedded on some external sites? Anyway, one thing that I've noticed is that robots.txt is requested very often, but I did not bother adding this file. I know what robots.txt is for, but I'm not sure how it should be configured and used in the context of

/r/flask
https://redd.it/l4xqf7
Advise - Flask + ? for job board website

Hi everyone!

I'm building a job board website and I just finished building the backend using Flask + Eve. I will use MongoDB Atlas to store the database and I think I want to serve the website using Heroku. I'm a beginner with web apps but I've been writing Python and Scala for my DS 9-5 since I got out of college. My question is, how should I proceed with this project? The way I see it I could:

Build the app fully in Flask with jinja + html and style it with Bootstrap
Separate back end and front end, write a front end app that will communicate with my flask server

I can see advantages to both of these approaches, the easiest for me would be to just use Flask all the way. But I'm interested in the future of this app if it would scale up better by having a separate front end.

For the front end I have been researching Vue.js, and React.js but I'm unsure of the benefits of one over the other.

I'm open to suggestions or any other comments! Thanks everyone!

/r/flask
https://redd.it/l4wa5d
Clean Architecture in Flask

Hi guys!


Nice to post here, I coming from Javascript and I keep looking at Flask. I'm a little noob in this framework but I wanna an alternative programming language to develop my backend as API REST.

I using Clean Architecture for all my new projects and I wanna look at some projects that use Clean Architecture.


Can you share your folder structure with Clean Architecture? I don't wanna copy your project, it's just for my personal projects.

​

(excuse for my English, it's not my native language)

/r/flask
https://redd.it/l540pd
Trying to find entry in my database but cant

So I'm trying to find a entry in my database that I created. When I go to query and compare the entry I'm looking for I get nothing.

Below is my code to query my database

enteredusername = request.form"username"
existinguser = db.session.query(UsersTable).filterby(username = enteredusername)

This is the result I get

SELECT
userstable.id AS userstableid, userstable.username AS userstableusername, userstable.password AS userstablepassword FROM userstable WHERE userstable.username = ?

Assistance is much appreciated

/r/flask
https://redd.it/l52wpl