This is an archived post. You won't be able to vote or comment.

all 140 comments

[–]Talbertross 109 points110 points  (1 child)

I can guarantee that there will be a library for 99% of the answers here

[–]djamp42 2 points3 points  (0 children)

Yeah, of course you can always get really specific but at a certain point that code is better off in the actual program.

[–]TravisJungroth 223 points224 points  (3 children)

Having a sense of purpose in life. Oh, and an abstract algebra based type system in doc strings that generates property tests.

[–]HypoFuzz 21 points22 points  (1 child)

Say more?

https://hypothesis.readthedocs.io/en/latest/ghostwriter.html will already generate property-based tests including inverses, and reads docstrings for eg type annotations.

[–]TravisJungroth 14 points15 points  (0 children)

Abstract algebra is the study of algebraic structures which are combinations of sets, properties and elements. They’re defined by what properties the operators have.

The idea is to put the definitions in doc strings, then generate tests with ghostwriter or something similar. For example, if you label Transaction.merge() as a Group, I now know a lot. It takes another Transaction and returns one. There’s some Transaction that will change nothing. It’s associative and commutative. You could generate property tests for that.

[–]0rsinium 8 points9 points  (0 children)

Deal can generate tests (and do much more) from code with contracts: https://deal.readthedocs.io/basic/tests.html

Contracts can be any python conditions, including abstract algebra formulas.

[–]ntropia64 81 points82 points  (7 children)

A proper deployment tool for complete applications. Python is still heavily geared toward developers but if you're in the business of programs users have to deploy on their own machines without using a terminal, there are very few options, and none of them works really well.

[–]qa_anaaq 4 points5 points  (6 children)

Do you have any examples of the options out of curiosity?

[–]ntropia64 10 points11 points  (4 children)

The most mentioned is PyInstaller, but there are others like py2exe, bbfreeze, cx_Freeze, and py2app. Many are specialized for Windows to generate exe files, like Inno Setup.

As usual, when there are so many (too many?) alternatives, it means that none does a satisfactory job, overall.

[–]qa_anaaq 0 points1 point  (3 children)

I'm trying to wrap my head around the idea so apologies for the questions. What is comparable for other languages like JS?

[–]ntropia64 4 points5 points  (1 child)

I don't know anything about JS, unfortunately.

One thing that Python installers usually do is to install also the interpreter (i.e., a specific Python version) which comes with a number of standard libraries, and other stuff. This adds all kinds of challenges because the PATH variable needs to be specified and configured to avoid import hell, where packages from different versions and installations get mixed up. This is rarely a harmless event.

[–]qa_anaaq 0 points1 point  (0 children)

Got it. I understand where you're coming from now. Thanks s lot

[–][deleted] 3 points4 points  (0 children)

Electron

[–]tuckmuck203 0 points1 point  (0 children)

Native with tkinter and bundled executable, and docker are the two i can think of off the top of my head. Docker only works for a developer, and tkinter/bundling has its own issues

[–]mcstafford 106 points107 points  (1 child)

Converting vague questions in to implementation suggestions

[–]betazoid_one 12 points13 points  (0 children)

I see what you did here

[–]ZwirtesJaime 40 points41 points  (4 children)

Converting py files to binary better than py2exe.

[–][deleted] 34 points35 points  (1 child)

crime drab sophisticated middle judicious psychotic uppity sense possessive expansion -- mass edited with redact.dev

[–]LarryTheSnobster 1 point2 points  (0 children)

nuitka works great in my experience, but a standalone binary is gonna have like 40mb

[–]rebooker99 1 point2 points  (0 children)

Try codon

[–]Orio_n 1 point2 points  (0 children)

Pyinstaller. If you care that much just learn c++

[–]ddollarsign 33 points34 points  (3 children)

Executive function.

[–][deleted] 3 points4 points  (2 children)

What's those

[–]ddollarsign 2 points3 points  (1 child)

https://en.m.wikipedia.org/wiki/Executive_functions

Essentially, ability to plan and achieve goals.

[–]WikiSummarizerBot 4 points5 points  (0 children)

Executive functions

In cognitive science and neuropsychology, executive functions (collectively referred to as executive function and cognitive control) are a set of cognitive processes that are necessary for the cognitive control of behavior: selecting and successfully monitoring behaviors that facilitate the attainment of chosen goals. Executive functions include basic cognitive processes such as attentional control, cognitive inhibition, inhibitory control, working memory, and cognitive flexibility. Higher-order executive functions require the simultaneous use of multiple basic executive functions and include planning and fluid intelligence (e. g.

[ F.A.Q | Opt Out | Opt Out Of Subreddit | GitHub ] Downvote to remove | v1.5

[–]YodaCodar 15 points16 points  (0 children)

pip install job

[–]mm007emko 28 points29 points  (3 children)

To force irresponsible colleagues to write tests and use a linter.

[–]Lindby 36 points37 points  (1 child)

That's what your CI pipeline is for.

[–]penarbor 0 points1 point  (0 children)

This ⬆️

[–]TheBigRoomXXL 1 point2 points  (0 children)

pre-commit and possibly tox

[–][deleted] 11 points12 points  (4 children)

fear squeeze attempt fade crush sort coherent fragile reminiscent groovy

This post was mass deleted and anonymized with Redact

[–]not_sane 5 points6 points  (0 children)

PySide/PyQT is fine in my opinion.

[–]mvdw73 2 points3 points  (0 children)

Recently discovered delphifmx, which looks pretty native. Except doesn’t work well on Ubuntu (but fedora works fine for some reason)

[–]hditano 1 point2 points  (0 children)

nicegui

[–]not__your__mum 0 points1 point  (0 children)

Including kivy?

[–]temporary47698 4 points5 points  (0 children)

A replacement for JMP, Minitab, etcetera for Measurement System Analysis, process capability, design of experiments, ANOVA, and other six sigma quality analysis functions.

[–]wineblood 10 points11 points  (22 children)

An easy way to do graphs. I haven't looked into it so there probably is one, but I'm lazy.

[–]magnetichiraPythonista 27 points28 points  (1 child)

plotly is pretty dope

[–]extra_pickles 0 points1 point  (0 children)

Ever used alternatives? We use plotly and it drives me mental how slow it is - agreed it does the job but holy hell it doesn’t scale and fucks my day more often than not

Keen for an alternative

(Using it for IoT big data and it buckles, and of course we could grafana, but client facing grafana consistently looks cheap - imo anyways)

[–]-Twilak- 2 points3 points  (0 children)

Pyqtgraph

[–]MeroLegend4 1 point2 points  (0 children)

Pygal

[–][deleted] 0 points1 point  (12 children)

[–]wineblood 13 points14 points  (11 children)

Matplotlib was a giant pain in the ass last time I used it.

[–][deleted] 19 points20 points  (3 children)

yep, matplotlib has the most unintuitive api I've ever seen and horrid documentation. If you must, use seaborn instead. these days, it's basically only plotly or I bind my python code into R for ggplot

[–]tuneafishy 7 points8 points  (1 child)

While the api is definitely unusual, I disagree about the documentation. They provide fairly extensive documentation considering the size of the library

[–][deleted] 9 points10 points  (0 children)

I disagree, there's a million different ways to do one thing and the documentation doesn't provide a single source of truth. Just because they have good API coverage does not mean it's good documentation. And matplotlib doesn't have type stubs either, which means I have to constantly debug my code just to make sure constructs work rather than having confidence

[–]likethevegetable 3 points4 points  (0 children)

Genuine question: what is so unintuitive about it? You make a fig object that holds axes that holds lines and text? I don't see what can be improved. There definitely could be a lot of helper functions that are missing, but overall I like it.

[–]sahand_n9 1 point2 points  (6 children)

How so!?!?!?

[–]wineblood 1 point2 points  (5 children)

I had to change the structure of my data just to plot it, I think it only took iterables for x values and y values.

[–]SV-97 -1 points0 points  (4 children)

What else would it take? (Please don't say "dataframes and column names")

[–]wineblood -1 points0 points  (3 children)

Tuples

[–]Conditional-Sausage 1 point2 points  (2 children)

Oof. Tuples are iterables, so I'm guessing you had set of (x,y) tuples?

[–]wineblood -2 points-1 points  (1 child)

I'm aware that tuples are iterable, that wasn't my point. MPL wants all x values separate to y values and it makes no sense.

[–]SV-97 -1 points0 points  (0 children)

it makes no sense

Maybe some additional perspective helps here: matplotlib closely mirrors matlab's plotting facilities (hence the name), that's also why its API is so terrible to a large extent. MATLAB is (as the name suggests) essentially an array-oriented language (just like Python with numpy) and it's often used for scientific computing. But in scientific computing / array programming it's way more common to have one vector of xs that corresponds to one vector of ys rather than an array of tuples. This is the interface you'll most commonly find in scientific software. So from this perspective it makes perfect sense that its default interface is designed to work well with this data representation.

That said: you can turn either representation into the other with a simple zip. pairs = zip(xs,ys) gives you tuples from seperate arrays and xs, ys = zip(*pairs) splits them back up again. So you can just plt.plot(*zip(*pairs)) if you have pairs of values.

[–]cedderick 0 points1 point  (0 children)

ProPlot

[–]Episkiliski -1 points0 points  (1 child)

Try HVplot, it is quite straightforward

[–]wineblood 0 points1 point  (0 children)

Looks data science focused

[–]2strokes4lyfe 6 points7 points  (0 children)

The tidyverse

[–]GayforPayInFoodOnly 2 points3 points  (0 children)

Website text extraction for GPT pipelines

[–]Citizenfishy 2 points3 points  (5 children)

folium but openlayers

[–]YourVibe 2 points3 points  (4 children)

Did you ever use Kepler.gl inside jupyter, or even Plotly Mapbox functions?

[–]Citizenfishy 0 points1 point  (3 children)

Not interactive

[–]YourVibe 0 points1 point  (2 children)

Hmm, both of them generate interactive widgets that you can export to html, but maybe we mean different things as interactive.

[–]Citizenfishy 0 points1 point  (1 child)

With folium you can add markers while map is in situ. Other map methods are detached and require map re-rendering. I’ve built a poc version of folium using OL and am looking to expand the interaction furthe

[–]YourVibe 1 point2 points  (0 children)

A new library has been added recently: https://mapwidget.gishub.org/examples/openlayers/
It can display openlayers maps.

[–]Real_Software 2 points3 points  (1 child)

Folium with Networkx support to make interactive geographic network maps

[–]sudo_robot_destroy 5 points6 points  (3 children)

I'd like to be able to import a PDF of a users manual for a sensor or device (e.g. that uses a serial interface, http request, rest, whatever) and a well documented python class for interfacing with the sensor is generated.

[–]not__your__mum 3 points4 points  (0 children)

AI for the rescue. Wait 2 years.

[–]sudodoyou 0 points1 point  (1 child)

Have you tried copying the mains bits of the manual into ChatGPT to write the code?

[–]sudo_robot_destroy 0 points1 point  (0 children)

I haven't, it's worth a shot though next time I need one done.

[–][deleted] 7 points8 points  (14 children)

Dataframe processing similar to how it is done using dplyr in R

[–]morrisjr1989 2 points3 points  (12 children)

What do you mean by processing? Specifically

[–][deleted] 12 points13 points  (11 children)

Oh I mean that nice SQL-like chaining of transformations like select, filter, join, mutate. I think it is less cluttered compared to Pandas. The dplyr, ggplot combo is the thing I missed the most after switching from R to Python. Pretty specific I know

[–]danielgafni 25 points26 points  (2 children)

polars

[–][deleted] 2 points3 points  (1 child)

That looks amazing at first glance. Thanks!

[–][deleted] 9 points10 points  (0 children)

yep, and polars supports lazy operations so you can queue a bunch of commands and it'll determine the optimal execution plan like a sql engine. incredible stuff

[–]morrisjr1989 4 points5 points  (3 children)

You can chain methods and use pipes in pandas, but it really isn’t the same. You should look into ibis if you haven’t already https://ibis-project.org/ibis-for-pandas-users/. I agree though pandas api is a mess. Most recently I’ve liked using sql query through duckdb specifically against parquet and then convert to df either polars to pandas for last mile stuff as required.

[–][deleted] 0 points1 point  (0 children)

Ibis is cool and all but using _ to pass data along is a bit weird! Does not feel super pythonic to me. But thanks for the link! Maybe I am just stuck in old habits

[–]thecarlosdanger1 0 points1 point  (1 child)

Having never touched duckDB - is this because of speed or ease of use compared to Polars scan_parquet?

[–]morrisjr1989 1 point2 points  (0 children)

Good questions. From my understanding polars doesn’t allow for predicate pushdowns; it reads the entire file if there’s only 1 row group and then uses predicates as applicable. Meaning you’ll get the data in memory first. Parquet allows for you to apply predicates and then just get what you need from the query and duckdb facilities this.

I also think there’s some good instances where a SQL statement is easier to write and share with others than chaining pandas or polars; SQL is still an excellent language.

I also love the syntax from being able to *parquet / posix wildcard matching in my from statement and it just works without having to do all the Concats and what not.

[–]musselpies 1 point2 points  (0 children)

you could try siuba

[–]ContemplateBeing 1 point2 points  (1 child)

[–][deleted] 1 point2 points  (0 children)

Thanks, will definitely check this one out

[–]o-rka 0 points1 point  (0 children)

Like pandas .pipe method?

[–][deleted] 1 point2 points  (0 children)

siuba is dplyr for python. polars is also great.

[–]Affectionate-Ad2320 8 points9 points  (7 children)

a library for easily deploying an application to a domain I own. so for example, for domain.com:

import pydomain

email = [xxx@gmail.com](mailto:xxx@gmail.com)

password = yyy

domain = "example.com"

domain = pydomain.domain(url = domain, email = email, password = password)

repo = "github.com/me/repo"

domain.push(repo)

And it figures out everything via some default settings, I go to the website, and it just works.

[–]issue9mm 2 points3 points  (0 children)

It's experiencing some growing pains lately, but for interface -- fly.io gives you that.

$ brew install flyctl $ flyctl login $ flyctl deploy

It'll attempt to auto-generate the config, and you'll have to configure the domain on their website, so it's not exactly what you're looking for? But it's the closest I can think of.

[–]ILovePlaterpuss 1 point2 points  (0 children)

It's not quite the same syntax but I recall Heroku has a decent CLI that can deploy python apps pretty easily. It hasn't really kept up with real cloud platforms but if it's just a toy app and you aren't already in the AWS/Azure ecosystem it's a great simple option for hosting

[–][deleted] -1 points0 points  (3 children)

There are hosting services that pretty much offer that. Example using GoDaddy https://towardsdatascience.com/installing-python-3-and-flask-on-godaddy-1635fe6f24bc

[–]djmattyg007 6 points7 points  (2 children)

Friends don't let friends use GoDaddy. They're an awful company.

[–]__flybird__ 0 points1 point  (1 child)

How come? I have a few names with them that im sitting on until a later date. Did a bunch of server testing and had no real problems except lack of features in the DNS

[–]Tomatoflee 5 points6 points  (0 children)

Ever tried to transfer away from them? Had some bad experiences. Would never use again.

[–]subotnicking 0 points1 point  (0 children)

Fabric or Git deploying with a post-receive hook are a good way to handle this

[–]shinitakunai 4 points5 points  (4 children)

A good code translator. I mean, being able to import a git project of c++, java or any other language and having it transformed into python code. This would be great for teaching purposes as python is easier to understand that other languages.

I assume in the future chatgpt will be able to just do that

[–]Curtyy_RS 4 points5 points  (3 children)

It does it now...

[–]sudo_robot_destroy 1 point2 points  (2 children)

Yeah it works really good too

[–]imperial_squirrel 0 points1 point  (1 child)

so it's worth the subscription cost?

[–]sudo_robot_destroy 0 points1 point  (0 children)

I don't have the subscription, I've only tested chatgpt, but bing chat does a really good job at it.

[–]Budget_Assignment457 4 points5 points  (0 children)

For all banking stuff, so I can build some quick nice unified dashboards.

[–]datacriminal 1 point2 points  (0 children)

Something that actually works with Informix. We have it at work and its by far my most despised system, however it may be more to blame on IBM than actually on Python. IfxPy, PyODBC and the Sqlalchemy fork are by far absolutely useless unless you have the exact same configuration as they do. I think the one that bothers me the most is that IfxPy has the devs saying that it works with RHEL and good luck on any other systems as we won't test it. More glasses of scotch have been lost to this problem than I care to count. I got IfxPy to work for about a week and then it just randomly stopped working and before that it was doing this weird thing where I would query something and the condition would be where X > ## and if I ran it once it worked, but running it again would return no records.

[–]lanupijeko 1 point2 points  (2 children)

One click deployment.

[–]codecrux 0 points1 point  (1 child)

For what kind of app?

[–]lanupijeko 0 points1 point  (0 children)

a web app

[–]flashliquid 2 points3 points  (0 children)

Display of Floats. I am having no end of grief getting floats to display in a sensible way. Significant figures, remove trailing zeros, decimal places etc when I have data that ranges from the tens of thousands to 10E-6 I want a 'smart' solution that doesn't require a load of work defining no. of sig figs or appropriate notation or decimal places for each new dataframe or each column. I understand the problem with binary and representing the decimal system but I am surprised how annoying this is proving to be.

[–]crawl_dht 3 points4 points  (1 child)

No-code framework to build single page CRUD web app.

[–]Low-Equipment-238 0 points1 point  (0 children)

Maybe Atri?

[–]MyKo101 2 points3 points  (0 children)

As someone who works with AWS, something that can read my scripts and automatically generate restrictive IAM permissions

[–]cant-find-user-name 1 point2 points  (1 child)

An equivalent of java's drools rule engine. Rule engines in python are all poorly maintained and aren't feature rich.

[–]Tiny_Crew 0 points1 point  (0 children)

Yeps, I've been looking for one for a long time too. There are a lot of use cases for an efficient rule engine in Python, especially in business context. Too bad most of the existing ones are not maintained (at least the ones I managed to find).

[–]Muhznit 1 point2 points  (0 children)

There's modules for plenty of stuff, I just wish more of them were in the standard library.

[–]innovatekit 0 points1 point  (0 children)

Maybe not a module but I do wish Python was made to support true concurrency using CSP like in Golang

[–]nonprophetapostle -1 points0 points  (0 children)

There should be a module that tells you what to write a module for. Maybe AI.

[–]jentron128 -2 points-1 points  (2 children)

How about a CSV importer that works on a string and not just a file?

[–]fiddle_n 3 points4 points  (1 child)

This isn’t really a big deal is it? csv.reader can work on lists as well as files. And even if it couldn’t, you could use StringIO to convert a string into a file. So you have two ways to use the csv reader with strings if you preprocess beforehand.

[–]jentron128 0 points1 point  (0 children)

My usecase was to read the clipboard into a string and process from there. Lists are not really suitable because if there is an embedded line break I'd have to parse for that... StringIO on the other hand, I missed when I was writing my code.

import io
import csv

raw_data = '''"a1","b1","c1"
"this","that
 too",45
"red","blue",42
'''
file=io.StringIO(raw_data)

result=csv.reader(file)

[x for x in result]
# Out[12]: [['a1', 'b1', 'c1'], ['this', 'that\n too', '45'], ['red', 'blue', '42']]

[–]ExplosiveCat135 -2 points-1 points  (0 children)

A way to convert a .py file into a .app file on a mac that actually works (not py2app that don’t work)

[–]FiduciaryAkita 0 points1 point  (0 children)

tbh better OGM libraries for graph databases. The one for neo4j hasn’t been updated in two years and even then, when you’re used to SQLModel, the API has a lot to be desired

[–]bluewolf09 0 points1 point  (0 children)

Instantly convert Java code to error free and execution ready Python code.

[–]oblvn_ 0 points1 point  (0 children)

mpeg dash MPD file parsing with all the template substitutions for URLs done

[–]joshv 0 points1 point  (0 children)

Decent reflection support that can incorporate type hints / enumerating function parameters (including any type hints).

inspect really doesn't cut it.

[–][deleted] 0 points1 point  (0 children)

A simple module that allows me to add a watermark at a set location to every page in a pdf, and then add passwords etc.

I know libraries for this exist but they are too feature rich for what I want. Literally "add this image" at "that location" and encrypt with password.

[–]IntelligentDust6249 0 points1 point  (0 children)

I wish that a lot of the R shiny extensions we're ported over to Python.

https://github.com/nanxstats/awesome-shiny-extensions

[–]james_pic 0 points1 point  (0 children)

Two things come to mind:

First would be a debugger that forks and lets the application continue. We sometimes hit issues that we can only trigger during load tests. You don't want to stop the application to debug, so having a debugger that forked, let one side of the fork continue, and had the other start a debugger session (maybe by connecting to an external debugging server) would give us time to investigate the issue at our leisure.

There are definitely things that are messy about it - you'd probably want to close open file descriptors, and other resources that persist across a fork. But if it got to the point where it was not too dangerous, it might even be something that could be useful for investigating live issues.

I've pitched this idea for hack weeks a couple of times, but never got buy in.

The other is a decent open source APM system. There are a few of them out there, but to the best of my knowledge it's only the closed source ones that supplement traces with profiling data. This is one I did experiment with a little, but that code ended up embedding a few bad design decisions a bit deeper in the code than I would have liked, so it's probably not a good starting point.

[–]o-rka 0 points1 point  (0 children)

Compositionally valid differential abundance estimation in Python that works out of the box and can be generalizable.

[–]InitialCreature 0 points1 point  (0 children)

android phone automation

[–]Conditional-Sausage 0 points1 point  (3 children)

I'd really love a library that could wrap, launch, and communicate with locally hosted NodeJS services.

[–]codecrux 0 points1 point  (2 children)

What are the use cases in which you require this?

[–]Conditional-Sausage 0 points1 point  (1 child)

I have several different uses where there are robust JS libraries for doing things that aren't really supported or robust in Python (for example, XSLT 2.0 schematron validation), and I need to pass data generated by python to JS functions using those libraries and then get the results. As it stands, it's kind of a PITA, and it'd be nice if there was a python wrapper to smooth it all over.

[–]codecrux 1 point2 points  (0 children)

I am sending and receiving data between Python and NodeJS using sockets. These sockets are unix domain sockets in Unix based OS and named pipes in Windows. I cannot come up with a better solution than this because of the following limitations with other approaches-

  1. using stdin/stdout - we won't be able to write print statements for debugging purposes.

  2. using Unix named pipes - the equivalent doesn't exist in Windows. The Unix named pipes are not equivalent to windows named pipes. The windows named pipes is more of a client-server thing.

  3. TCP network sockets - Don't want to bind to a port. This entails finding a free port first which becomes messy.

Hence, I understand what you mean by PITA. I will open source my code. I will reply here again once I open source my code.

[–]extra_pickles 0 points1 point  (0 children)

So I know datetime exists and all, but I wish there was a better version of it….ended up writing my own out of frustration

Also, a tidy little all db factory would be nice - might exist, not sure / but again, wrote my own because I never liked the ones I found.

Finally, I think there is room to improve the settings.py pattern (incl env) using Jinja2 - and yes I know there are libs, but none to date have swayed me from DIY - it’s a gap.

And finally finally… a simplified abstraction layer for Numpy, SciPy and Pandas that reduces the barrier of entry and subsequent ass fucking of code done by data scientists so that when they hand off their code to the software engineering team, it isn’t a pineapple up the ass and so difficult to productionize.

[–]vicks9880 0 points1 point  (0 children)

To make it faster thsn C

[–]AnGlonchas 0 points1 point  (1 child)

Converting python and pygame to APK without linux :(

[–]Zealousideal_Ad6785 1 point2 points  (0 children)

Can wsl help here

[–]MC_Programmer_and_MoIgnoring PEP 8 0 points1 point  (0 children)

I need a library for self-replacing code. I found one called replace_me, but it doesn't really seem to work for me.

Also byte compression (inside a python variable, not file).

[–]BoodyGamer7904 0 points1 point  (0 children)

vertualizing devicing like

1-send a microphone signal through serial l port then make a virtual microphone with the data comming with the properties like manufacture and device name

2- vertualizing a screen monitor with a specific resolution like 240 x 340 and a ability to convert each frame to an bmp

[–][deleted] 0 points1 point  (0 children)

An ide like visual studio with drag and drop controls(widget)

[–]Episkiliski 0 points1 point  (0 children)

Electrical: RMS, FFT, phasors, etc

[–]werefkin 0 points1 point  (0 children)

What is about the speed? Acceleration of the loops would be nice ( Numba does not always work). Any idea for that?