sub
stringclasses 1
value | title
stringlengths 7
303
| selftext
stringlengths 0
8.65k
| upvote_ratio
float64 0.08
1
| id
stringlengths 9
9
| created_utc
float64 1.65B
1.65B
|
---|---|---|---|---|---|
Python | 3d Game Engine in Python | Have any of you guys experimented with 3d game engines in python like ursina, Panda3d etc... I want to prototype some ideas but I'm worried about running into platform specific issues after completing most of the development. I can obviously learn Unity or Unreal but I would like to know if viable options are there in python | 0.92 | t3_u6695b | 1,650,262,365 |
Python | Why are some static type-checking functionalities implemented as identity functions? | For example, `typing.cast` returns the argument unchanged. Obviously, this has no effect on the program at runtime. If this is the case, why can we not just tell the static type checker (mypy) that we want the argument to be treated as some type *without* having to add a function call? Why can’t this override/cast be in a comment of some sort? | 0.76 | t3_u64dfw | 1,650,255,058 |
Python | 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! If you're looking for project ideas, you might be interested in checking out Al Sweigart's, ["The Big Book of Small Python Projects"](https://inventwithpython.com/bigbookpython/) which provides a list of projects and the code to make them work. | 0.87 | t3_u5zpzh | 1,650,240,011 |
Python | I wrote a program to play Minecraft in your Windows command line / Linux console | Video demonstration: https://youtu.be/P1d04is-wQQ
Source code: https://github.com/louis-e/cli-screenview | 0.93 | t3_u5ykrh | 1,650,236,464 |
Python | Type safe Django app, Part 3 | 0.7 | t3_u5xql9 | 1,650,233,988 |
|
Python | r/Place Data Visualization w/ Python + Blender (open source project) | I've created a [GitHub repository](https://github.com/ChrisCrossCrash/r-place-blender) containing everything you need to create beautiful 3D renders of the [r/Place](https://www.reddit.com/r/Place/) 2022 canvas (scroll down for more info).
[Python Logo \(r\/Place 2022\)](https://preview.redd.it/bm0m1c1vv5u81.jpg?width=1920&format=pjpg&auto=webp&s=c813de013e50fe3fa91cd954478cc3fdff25cb66)
[Blender Logo \(r\/Place 2022\)](https://preview.redd.it/l7w8d9wet5u81.jpg?width=800&format=pjpg&auto=webp&s=45fc8f698e489d0c2b2b8bd8f9c1cf3d8d1420a9)
[Whatever this is \(r\/Place 2022\)...](https://preview.redd.it/fmbxz1xms5u81.png?width=3840&format=png&auto=webp&s=f721632bb9e10af682fdbb01b8ca2f64403afa30)
[Start of r\/Place 2022](https://preview.redd.it/f7ckdpshs5u81.png?width=3840&format=png&auto=webp&s=9654241197449ccb064a01d32a4d69d93aba53bb)
[\\"Darth Plagueis the Wise \(r\/Place 2017\)\\"](https://preview.redd.it/ete7b05vr5u81.png?width=1920&format=png&auto=webp&s=6fc618bf43ce3cb1476a58620c7bcb92063a38c4)
[Rainbows \(r\/Place 2017\)](https://preview.redd.it/tiz5v32ts5u81.png?width=1920&format=png&auto=webp&s=b07375a5843038d3bed97040688aaa9e52003599)
[Green Lattice \(r\/Place 2017\)](https://preview.redd.it/9jrmj6c6t5u81.png?width=1920&format=png&auto=webp&s=282051e36bd9bbddc2d83dc97656100cdc4c2743)
[r-place.blend open in Blender](https://preview.redd.it/101fu8vzv5u81.jpg?width=1921&format=pjpg&auto=webp&s=c3bfd90fc93d3a69ca88de3ffbf5d2080a9ed607)
I've prepared a [GitHub repository](https://github.com/ChrisCrossCrash/r-place-blender) with everything you need to create beautiful 3D renders of the r/Place 2022 canvas. It's an open source project with an MIT license.
I recently posted a [Star Wars timelapse I created earlier](https://www.reddit.com/r/blender/comments/u0gtvs/a_long_time_ago_in_a_subreddit_far_far_away/). I also created one for the [Michigun memorial](https://www.reddit.com/r/blender/comments/u178pc/michigun_memorial_request/) artwork, which somebody requested. The linked GitHub repository contains an improved version of the code and `.blend` file used to generate those renders.
Let me know if you need help or notice any mistakes. I'm super excited to see what other people can do with this! | 0.82 | t3_u5xfgt | 1,650,233,080 |
Python | Quickly create online forms for your python scripts | 0.63 | t3_u5x46b | 1,650,232,184 |
|
Python | Relational Algebra interpreter powered by Python | I made a RA interpreter in Python, [Pireal](https://github.com/centaurialpha/pireal).
Small story: In my database class (back in 2015), I could not use a software made for Windows (WinRDBI), so I set out to make a free and cross-platform alternative. Taking advantage of what I wanted to understand how the compilers and interpreters work, I wrote an interpreter for Pireal.
Today the project is used at my university, but I had never been promoted. I hope it serves more people. And of course, any can collaborate to improve it. | 0.64 | t3_u5w63g | 1,650,229,365 |
Python | Mean population of US States with graph | import random
import numpy
from statistics import mode
import matplotlib.pyplot as plt
import csv
import collections
##dictionary of States and populations
from numpy import ndarray
#states_info_dic = {
# "California": 39538223,
# "Texas": 29145505,
# "Florida": 21538187,
# "New York": 20201249,
# "Pennsylvania": 13002700,
# "Illinois": 12812508,
# "Ohio": 11799448,
# "Georgia": 10711908,
# "North Carolina": 10439388,
## "Michigan": 10077331,
# "New Jersey":8882190,
# "Virginia": 8535519,
# "Washington":7614893,
# "Arizona": 7278717,
# "Massachusetts":6949503,
# "Tennessee":6833174,
# "Indiana": 6732219,
# "Missouri": 6137428,
# "Maryland": 6045680,
# "Wisconsin":5822434
#}
states_info_dic = {
"Cal": 39538223,
"Tex": 29145505,
"Flo": 21538187,
"NY": 20201249,
"Pen": 13002700,
"Ill": 12812508,
"Ohio": 11799448,
"Geo": 10711908,
"NC": 10439388,
"Mich": 10077331,
"NJ":8882190,
"Vir": 8535519,
"Was":7614893,
"Ari": 7278717,
"Mass":6949503,
"Ten":6833174,
"Ind": 6732219,
"Miss": 6137428,
"Mary": 6045680,
"Wis":5822434
}
##print values of states
population = list(states_info_dic.values())
print(population)
##round population
round_up_list =[]
for num in population:
round_up_int=num/1000000
round_up_list.append(round(round_up_int))
#Mean, median and mode of list
mean1=numpy.mean(population)
median1=numpy.median(population)
mode1=mode(round_up_list)
print(f"The mean of the population is {mean1}")
print(f"The median of the population is {median1}")
print(f"The mode of the population is {mode1}")
print(round_up_list)
##Grpah population information
# x-coordinates of left sides of bars
left = states_info_dic.keys()
# heights of bars
height = states_info_dic.values()
# plotting a bar chart
plt.bar(left, height, width=0.8, color=['green'])
# naming the x-axis
plt.xlabel('States')
# naming the y-axis
plt.ylabel('Populations')
# plot title
plt.title('U.S States populations')
# function to show the plot
plt.show() | 0.33 | t3_u5v91y | 1,650,226,634 |
Python | Weekly Algorithm Project: Middle Square Method | Recently I started a weekly algorithm project just to help me study new algorithms with a flair of good practice. This week I decided to focus on Python and the "Middle Square Method" a PRNG produced by John von Neuman in 1949. I further reiterated two attempted improvements to the algorithm that come from a couple of papers just last month: one using a Weyl Sequence and another using the Weyl Sequence with a Counter - both were by Bernard Widynski.
Testing them was interesting as there appeared to be barely a difference between the two new iterations, however, both were much more stable than the original work by von Neuman. Typically with the newer algorithms I'd gather a standard deviation roaming around 4-8 x 10\^15-18. Obviously that's fairly in line with modern standards. The original method had a lower deviation, however, I found that one harder to test perhaps because I should have a used a different algorithm.
Full documentation can be found here if anyone is interested. For GitHub, it is under KNOWNALGO/W03.
[https://youtu.be/O53ihWtoEGk](https://youtu.be/O53ihWtoEGk)
[https://github.com/F35H/WeeklyCode](https://github.com/F35H/WeeklyCode)
Any word on improvements \[don't get me with "four space only"\] would be appreciated. Although, I'm fairly certain I could have done much better with the original method probably implementing the "bit-shift" way of doing it Bernard used at the very least.
Might as well link it here, here are the two papers:
[https://arxiv.org/pdf/1704.00358.pdf](https://arxiv.org/pdf/1704.00358.pdf)
[https://arxiv.org/pdf/2004.06278.pdf](https://arxiv.org/pdf/2004.06278.pdf) | 0.61 | t3_u5twnz | 1,650,222,631 |
Python | Simple android game with online functionality | Hi everyone!
Topics covered in this project are:
* game made using the Kivy Python module
* compiling with buildozer (and spec file) to get an .aab file
* using the 'kv' language
* using Kivy to switch between screens, display graphs, etc.
* online functionality (e.g. leaderboard) using firebase
* firebase rules
* app splash screen
​
showcase video: [https://youtu.be/PFNS4bGSocQ](https://youtu.be/PFNS4bGSocQ)
github: [https://github.com/Contraposite/PrimeFactorization](https://github.com/Contraposite/PrimeFactorization)
buildozer method I followed: [Creating an AAB for python apps using Buildozer (github.com)](https://gist.github.com/Guhan-SenSam/35c5ed7da254a7c0141e6a8b6101eb33)
play store listing: [Prime Factorizer Game - Apps on Google Play](https://play.google.com/store/apps/details?id=com.jf.primefactorizer)
This is my first app, which I wrote in Python and the 'kv' language, using Kivy, compiled to create an android app bundle using buildozer, and successfully uploaded to the Google Play Store.
There is a reasonable amount of support for Kivy but not too much for using it with firebase, so I hope this helps some people trying to make something similar. My github link includes my buildozer spec file and a text file of my firebase rules.
The premise of my game is simple: you're shown a target number, and you need to use the on-screen buttons to input the prime factors of that number, in order of smallest to largest (e.g. for target number 66, the prime factors are 2, 3, and 11, so you would press '2 3 1 1'. You are timed, and each time you complete a target, you get a new one. Target numbers get larger with time so that there is some difficulty progression.
Most of the functionality is shown in the linked video above, but some notable things are that you can create an online profile or play fully offline, the game shows you a variety of stats and graphs of your past play data, there are search functions to find points shown on the graphs, there is an online scoreboard, with a graph showing the leaderboard entries overlapped. You can also view the stats and graphs of other online players.
There are two glitches that I ran into with Kivy:
* kivy-garden scatterplot graphs sometimes have a graphical issue where the data points disappear and are not redrawn. The workaround was to redraw the graph with a slightly different size (I added a numpy random number times a negligibly small number to the size I actually needed).
* in the kivy textboxes, if the user types an '@' sign while the font size is large, it can crash the app. Definitely one of the most bizarre glitches I've ever encountered, but I just kept the font size small to avoid it.
I tried to add sounds for button feedback, but there was too much of a delay and it wasn't very good, so I've taken it out and plan to add sounds sometime in the future with another method to avoid the delay. | 0.76 | t3_u5tqje | 1,650,222,127 |
Python | Use python to optimize the rebar lost in construction. | Hello everyone, I'm a python beginner. I want to improve my coding skill so I try to use python to help my work.The following problem is bar cut list. It use in construction business. The rebar length is 10 meter each and We have to cut to length follow the order.We have to find the sequence of each Rebar Mark.I.E. We should cut bar No. 439(7350mm) then use it's scrap as rebar No.410 (2650mm) or We might cut bar no.443(6950mm) then no.410(2650mm) this would left the scrap 400mm.The less scrap on rebar the less rebar We have to order.The goal is to minimize rebar scrap on bar cut list.How should I create a logic follow this Idea?I have attached the link to csv file in case you want to try it.Thanks in advance.
[https://drive.google.com/file/d/1vxJXX8jmEoumwA08x8UtVyBCjSDpyldu/view?usp=sharing](https://drive.google.com/file/d/1vxJXX8jmEoumwA08x8UtVyBCjSDpyldu/view?usp=sharing)
https://preview.redd.it/tm23n32zp4u81.png?width=450&format=png&auto=webp&s=252b11688408922e06d0192bc52f2a415319124f | 0.93 | t3_u5sisg | 1,650,218,540 |
Python | Gupshup - Chat in the terminal | Gupshup is a terminal-based application inspired by discord!
github: [https://github.com/kraanzu/gupshup/](https://github.com/kraanzu/gupshup/) | 0.81 | t3_u5q6jl | 1,650,211,690 |
Python | Funny bot I made | [https://youtu.be/XrYadm3y\_e4](https://youtu.be/XrYadm3y_e4) | 0.36 | t3_u5pjy6 | 1,650,209,914 |
Python | Writing Better Django Queries | A blog that explains how to write better Django Queries by both performance and Memory wise.
[https://delliganesh.dev/tech/the-one-with-better-django-queries/](https://delliganesh.dev/tech/the-one-with-better-django-queries/) | 0.47 | t3_u5o1aq | 1,650,205,312 |
Python | PySGI, the library for creating web servers | Still under development, the PySGI library can manage HTTP routes, requests and responses simply and quickly. Help me by giving this repository a star!
[PySGI GitHub ](https://github.com/jaedsonpys/pysgi) | 0.6 | t3_u5npcy | 1,650,204,250 |
Python | How to create an image out of text using Python and Glide OpenAI library ? [tutorial] | ERROR: type should be string, got " \n\nhttps://preview.redd.it/2q5yox16e3u81.png?width=1280&format=png&auto=webp&s=0e06a88407034c5e567443a881a43e59684fb1ef\n\nHi,\n\nThis is a nice and fun Python tutorial that enables to produce an image out of a simple text \n\nThis is effect is based on Python and the amazing Glide library (based on OpenAI's )\n\nThe outcome is impressive. \n\nYou can find the link for the video tutorial here: https://youtu.be/DKEOmRBgPe8\n\nYou can find Python instructions file here : [https://github.com/feitgemel/Python-Code-Cool-Stuff/blob/master/Glide/glide-Install-instructions.txt](https://github.com/feitgemel/Python-Code-Cool-Stuff/blob/master/Glide/glide-Install-instructions.txt) \n\n\nEnjoy\n\nEran\n\n​\n\n\\#python #opencv #Glide #OpenAI" | 0.77 | t3_u5n88a | 1,650,202,661 |
Python | Python Script EXE detected as virus in VT | Hey Everybody,
I'm creating from a python script, with Pyinstaller ,an exe file, but when I insert it to Virus total for testing it detects it as a virus in many viruse detections softwares.
I have tried to solve it with nukita, several guides I found but nothing worked.
Anyone has any advice? | 0.75 | t3_u5m3x5 | 1,650,198,722 |
Python | Toolchain recommendations for a production-quality monorepo? | Hi,
I’m not exactly a newcomer to Python, but I’ve been using C++ pretty much exclusively for all of my professional projects. I am starting a new project in Python where we are going to be using a monorepo and I am looking for some recommendations on what people use for tooling.
Build system: I would like something to help orchestrate tests, generate coverage reports, handle running a typechecker in CI, do dependency analysis to figure out what changed in a commit, build Docker images and package cloud functions. It looks like the leading candidates are Bazel and Pants? Which does the community prefer?
Typechecker: Which do people use? A balance of speed, thoroughness of warnings and integration into editors/build systems seems like the driving factors here.
Dependency management: I am familiar with virtual environments, but to me this seems at odds with a monorepo where the virtual environment will grow boundlessly. Is there any tooling to help here?
Documentation: one of the main points of a monorepo is to ease the reuse of code, so docs are important. I am familiar enough with sphinx to know it is a pain in the butt. Are there any easy-to-use alternatives that can produce comparable quality?
Any other tools that make a big difference in refactoring and shifting errors to the left?
Thanks! | 0.84 | t3_u5kkxh | 1,650,192,403 |
Python | Stack Game made in pygame | GitHub - [https://github.com/Vaibhav521/Pygame/tree/main/stack](https://github.com/Vaibhav521/Pygame/tree/main/stack)
in-game footage
​
[stack game](https://reddit.com/link/u5ilqk/video/fzhstiy6t1u81/player) | 0.57 | t3_u5ilqk | 1,650,183,508 |
Python | Python Cybersecurity— Network Tracking using Wireshark and Google Maps | 0.6 | t3_u5ibzu | 1,650,182,335 |
|
Python | Windows 11 design on Python | Hello. This is my project to styling Win32 applications on Python. I try to make the application look in Fluent design with Mica.
If someone is interested, you can join or just look. 😊
[witalihirsch/QTWin11: QT Theme for Win32 apps on Windows 11 (github.com)](https://github.com/witalihirsch/QTWin11)
[Example](https://preview.redd.it/q9tcxjjgz0u81.jpg?width=1078&format=pjpg&auto=webp&s=060b7e0390e85cf641b6b4c8141eb61dbf4f3d15)
https://preview.redd.it/qgd7ykywc1u81.jpg?width=346&format=pjpg&auto=webp&s=0057bb4e4d4da836fdfe1384894b7f039bef5e89
https://preview.redd.it/cw3qmuywc1u81.jpg?width=344&format=pjpg&auto=webp&s=1e324ad9ac28484d38be37a154e8ae997a685f69
https://preview.redd.it/z8rkcwywc1u81.jpg?width=345&format=pjpg&auto=webp&s=84f73edc619d65c26998b44051bcfd0e0b630889
https://preview.redd.it/1hwt01zwc1u81.jpg?width=345&format=pjpg&auto=webp&s=2a0e0dcbf7ece6a400eb6d784fc5e11cba0b98b5
https://preview.redd.it/fldjh6zwc1u81.jpg?width=186&format=pjpg&auto=webp&s=35ffbee447fb622c0d3a75e22872bdf6a34c6232 | 0.97 | t3_u5gcj7 | 1,650,173,660 |
Python | I watched programmer who said for every beginners don't learn python because only jobs you can use python with are data science and machine learning etc.. and these jobs are not for beginners, so you will not work and get money with python as beginner. is it true ? | 0.41 | t3_u5fqtp | 1,650,171,251 |
|
Python | Edge detection project | I'm in grade 12 and planning on doing a project on something edge detection related. What can I do somewhat unique? | 0.75 | t3_u5dr4w | 1,650,164,059 |
Python | They say Python is the easiest language to learn, that being said, how much did it help you learn other languages? Did any of you for instance try C++ but quit, learn Python, and then back to C++? | 0.94 | t3_u5c9et | 1,650,158,940 |
|
Python | Sunday Daily Thread: What's everyone working on this week? | Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share. | 0.92 | t3_u5amsg | 1,650,153,610 |
Python | Arrowdantic 0.1.0 released | Hi,
I am announcing the release of [arrowdantic](https://pypi.org/project/arrowdantic/):
Arrowdantic is a small Python library backed by a
[mature Rust implementation](https://github.com/jorgecarleitao/arrow2) of Apache Arrow that can interoperate with
* [Parquet](https://parquet.apache.org/)
* [Apache Arrow](https://arrow.apache.org/) and
* [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity) (databases).
It has a similar performance and higher safety (e.g. no segfaults) than pyarrow.
It supports reading from and writing to ODBC compliant databases at
likely similar performance as [`turbodbc`](https://turbodbc.readthedocs.io/en/latest/) and it does not require conda to install.
This package is particularly suitable for environments such as AWS Lambda - it takes 13M of disk space, compared to 82M taken by pyarrow.
## Features
* declare and access Arrow-backed arrays (integers, floats, boolean, string, binary)
* read from and write to Apache Arrow IPC file
* read from and write to Apache Parquet
* read from and write to ODBC-compliant databases (e.g. postgres, mongoDB)
It is not intended for OLAP type of queries (Pandas, Polars and many others serve this purpose better).
There is still work to support more types (e.g. datetimes, python dictionaries), etc, but the gist is there - a small utility to lower the barrier to interoperate the Arrow format with Parquet, Arrow and ODBC.
Looking forward for feedback! | 0.84 | t3_u58xni | 1,650,148,309 |
Python | Slowpoke: A tool to convert Spotify and Youtube songs to slow and reverb | [https://github.com/newpolygons/SlowPoke](https://github.com/newpolygons/SlowPoke)
Little tool I worked on this weekend. Hope you guys like it. Currently setup to allow you to control the speed of the song. | 0.78 | t3_u58rf6 | 1,650,147,774 |
Python | Is it me learning python that there are many different ways to write it? I learn one way to write variable then next lesson shows me functions to show the same outcome. Or am I’m looking at this too soon and something else suppose to go along with it? | 0.62 | t3_u57opq | 1,650,144,578 |
|
Python | Space Science: Asteroid spectra meet Autoencoders | Hey Pythonistas,
In my [previous videos](https://www.youtube.com/playlist?list=PLNvIBWkEdZ2gagAcgm44cplgSvQ_Cmvbv) I explained and showed the "nature" of asteroid spectra. Based on their major 4 classes, I created a Support-Vector-Machine classifier as well as a Keras-based neural network to distinguish between these classes ([GitHub repo](https://github.com/ThomasAlbin/Astroniz-YT-Tutorials/tree/main/%5BML1%5D-Asteroid-Spectra); yes... I should have numbered my scripts starting at 01, 02, 03, ...).
Classifying imbalanced data is really interesting, and it is also somehow exciting to write Conv1D networks, since it is rarely seen (most use Conv2D in their tutorials, since most use images to classify data).
But what would be more interesting than writing a neural network classifier? Well, data classes can be artificial constructs. Especially "space spectra" (asteroid, mass spectra of dust particles in space, or spectra of so-called active galactic nuclei), are not always 100% distinguishable and have transitional classes between major classes.
So... can we classify our asteroid spectra in a data-driven way? Well, that's the goal of my last 3 video sessions, starting today with the very first one. The idea:
\- Creating an Autoencoder to reconstruct asteroid spectra
\- Displaying and inspecting the latent space of these spectra
\- Applying some clustering algorithm on the latent space to determine a data science based number of potential asteroid classes
Starting with the Autoencoder part I'd like to share my most recent tutorial:
[YouTube Link](https://www.youtube.com/watch?v=UsiY28qjBK8&list=PLNvIBWkEdZ2gagAcgm44cplgSvQ_Cmvbv&index=13)
[GitHub Link](https://github.com/ThomasAlbin/Astroniz-YT-Tutorials/blob/main/%5BML1%5D-Asteroid-Spectra/11_dl_autoencoder_reconstruction.ipynb)
I hope you'll like the final steps of this *Space Science with Python* project. I am honestly thinking to put everything in a small scientific paper :).
Cheers,
Thomas | 0.73 | t3_u57cdr | 1,650,143,542 |
Python | What are your useful packages to help scraping (besides requests, beautifulsoup etc)? | What are your go-to packages to include in python scraping scripts?
Besides the basics (requests/urlib(2), beautifulsoup/lxml, selenium, scrapy). What are the packages you include in your scripts?
For me it's:
* click
* requests-cache
* retry/backoff
* fake-useragent | 0.8 | t3_u578lt | 1,650,143,213 |
Python | Shipping command line programs with a python package | I already know this inherently sounds like a bad idea, but I'd love some genuine, constructive technical advice on the following scenario.
I have a python package that is used by others at work, and one of the features I need to add is the ability to upload binary files (\~1GB) from local to a cloud object storage, in this case Azure Data Lake.
The Azure Data Lake python client does have the ability to upload data, but it is significantly slower than their recommended command line bulk copy tool AzCopy.
**Can I get feedback on this approach:**
\-pip install the python package
\-the python package already has a command line entry point so the user would type something like
<package_name> setup externals
Which would then run a setup script which would install azcopy to the users $HOME path and create a symlink to their PATH for the binary to run.
\-Then python would use it via subprocess.
**For me the negatives I see are:**
\-Having to write handling code for the setup script to fail gracefully.
\-Possibly having to host the already installed binaries on a fileshare somewhere so URL changes and version changes don't break the installer
\-Having an extra step if someone else clones the repo, pip installs the requirements, they have one more step before they can recreate.
**Positives are:**
\-AzCopy is way faster than the python sdk and doesn't have to upload objects one at a time.
\-I can extend this to use RClone eventually to make it cloud storage agnostic, and have it work with S3 as well
&#x200B;
Has anyone ever done anything like this? Am I being oblivious to any major issues here? | 0.5 | t3_u53wpo | 1,650,133,545 |
Python | Do you think AI/machine learning is a very important field to get into for future relevance? | I am just starting to learn about it this week and thinking it is really going to be integral in the years to come right?
Perhaps as important if not more than the information age we are in now. More probably when skynet goes online and the war between humans/ai begins.
So, good to get onboard now.
I think my last great decision was learning coding around 2016 and this is going to be another great one in terms of time management and where to focus your efforts.
Not only yes but interested to hear what fields it will be relevant in? All?
EDIT: seems this is going off what I intended. I am not actually looking for a new career path. I am more just interested in knowing what future implementations will/might be as it becomes more ubiquitous, just speculating what that might be. | 0.69 | t3_u51zk3 | 1,650,128,123 |
Python | CLI macro for Windows | Hey everyone, I built a cli program for windows that can open files,websites, create temporary python enviroments. This is kind of my first full scale project that really eases my workflow.I would love to get suggestions on this program. :)
[https://github.com/Sidharth-S/do](https://github.com/Sidharth-S/do) | 0.7 | t3_u51ud3 | 1,650,127,715 |
Python | Python Virtual Environments: A Primer | 0.96 | t3_u51l5b | 1,650,126,979 |
|
Python | A lightweight way to profile Python Code non-intrusively | Latency:
[https://github.com/oracle-samples/hiq/blob/henry\_dev/hiq/examples/paddle/demo.ipynb](https://github.com/oracle-samples/hiq/blob/henry_dev/hiq/examples/paddle/demo.ipynb)
Memory:
[https://github.com/oracle-samples/hiq/blob/main/hiq/examples/paddle/demo\_memory.ipynb](https://github.com/oracle-samples/hiq/blob/main/hiq/examples/paddle/demo_memory.ipynb)
&#x200B;
[Latency Graph](https://preview.redd.it/qgc7upex3xt81.png?width=512&format=png&auto=webp&s=87a0a0cbf34e2ee4fd560d5c0768179ec5d95d76)
&#x200B;
More details at: [https://github.com/oracle-samples/hiq](https://github.com/oracle-samples/hiq) | 0.59 | t3_u51h29 | 1,650,126,645 |
Python | How to make annoy any interviewer with the fizzbuzz challenge | I was bored so I decided to solve the fizzbuzz in an obnoxious way. Hope you enjoy (:
`output = ["fizzbuzz", "buzz", "fizz"]`
`iterList = lambda x: [x%i for i in [15, 5, 3]]`
`fizzBuzz = [output[iterList(x).index(0)] if 0 in iterList(x) else x for x in range(1, 101)]`
`print(fizzBuzz)`
`[1, 2, 'fizz', 4, 'buzz', 'fizz', 7, 8, 'fizz', 'buzz', 11, 'fizz', 13, 14, 'fizzbuzz', 16, 17, 'fizz', 19, 'buzz', 'fizz', 22, 23, 'fizz', 'buzz', 26, 'fizz', 28, 29, 'fizzbuzz', 31, 32, 'fizz', 34, 'buzz', 'fizz', 37, 38, 'fizz', 'buzz', 41, 'fizz', 43, 44, 'fizzbuzz', 46, 47, 'fizz', 49, 'buzz', 'fizz', 52, 53, 'fizz', 'buzz', 56, 'fizz', 58, 59, 'fizzbuzz', 61, 62, 'fizz', 64, 'buzz', 'fizz', 67, 68, 'fizz', 'buzz', 71, 'fizz', 73, 74, 'fizzbuzz', 76, 77, 'fizz', 79, 'buzz', 'fizz', 82, 83, 'fizz', 'buzz', 86, 'fizz', 88, 89, 'fizzbuzz', 91, 92, 'fizz', 94, 'buzz', 'fizz', 97, 98, 'fizz', 'buzz']`
Edit: yes I know the title is messed | 0.64 | t3_u4zs3s | 1,650,121,763 |
Python | Live flame graph rendering in the terminal | Austin TUI 1.2.0 has just been released, with the new live flame graph mode.
[https://github.com/P403n1x87/austin-tui](https://github.com/P403n1x87/austin-tui)
This is what it looks like in VS Code. The graph can be paused and files opened directly in the editor with a Ctrl + Click on the path for further inspection. The VS Code extension is also available for more insight into performance
[https://marketplace.visualstudio.com/items?itemName=p403n1x87.austin-vscode](https://marketplace.visualstudio.com/items?itemName=p403n1x87.austin-vscode)
https://i.redd.it/5kh8pn811wt81.gif | 0.72 | t3_u4x741 | 1,650,113,643 |
Python | "Safe" way to install Python 3 on MBA M1 | Hi. I just want to ask if there's something like a "safe" way to install Python 3 on Macbook Air m1. I'm learning Python right now, and MBA has Python 2.7 something version. | 0.82 | t3_u4uji2 | 1,650,103,050 |
Python | Recover deleted and overwritten files with RecoverPy 1.5.0 | &#x200B;
https://i.redd.it/qg7rwesb1vt81.gif
Hi! I recently release RecoverPy v1.5.0 and I think I might give you some news.
**-> Repo:** [https://github.com/PabloLec/RecoverPy](https://github.com/PabloLec/RecoverPy)
# What is it?
RecoverPy is a 100% Python tool to not only recover deleted but also overwritten files.
I got the idea when I was quite new to some programming best practices, especially version control...
Long story short, I accidentally piped my output into my precious script... Just spent the day working on something and instead of typing myscript > log, I typed log > myscript, oh boy what a feeling.
I knew some tools to recover deleted files, but my problem was quite different, I didn't deleted the file (in system words, marked the file blocks as deleted/available), I just replaced it's content. Talk about an impostor syndrome.
After a long ride in the abysses of unix stackexchange, I found some dark combination of grep and dd command to search directly in your raw system partitions blocks and eventually recovered my file! But as the process was really slow and painful, I thought it might be a good idea to make a tool out of it. That's how RecoverPy was born.
# 1.5.0
Since then, the tool has had quite some success. Especially in the hacker community (wasn't the initial intent but still). It even appeared in hakin9 magazine.
Last releases have been quite stable, lastly I mostly added QoL updates and better binary file search handling.
Feel free to have a look and tell me what you think of it! It's my biggest personal project and I'm beginning to be quite proud of my baby :) | 0.93 | t3_u4u8mb | 1,650,101,676 |
Python | Python Web Frameworks | 0.29 | t3_u4u85t | 1,650,101,619 |
|
Python | Python for complete begginers Medium | I wrote this cool article about python for complete begginers about 2 months ago and I thought I'd share it. In this article you will learn about:
1) what coding is , what python is
2) The advantages of python
3) How to download and install python
4) What an ide is
5) Maths in python
6) Variables
Here is the link : https://4rkal.medium.com/python-for-beginners-f1df170bcc08 | 0.33 | t3_u4tsp2 | 1,650,099,636 |
Python | GitHub - AlexEidt/ASCII-Video: Blazing fast ASCII Image/Video Renderer. | 0.95 | t3_u4rpyc | 1,650,090,494 |
|
Python | Run python (and sql) with dbt | 0.84 | t3_u4mwco | 1,650,072,702 |
|
Python | Saturday Daily Thread: Resource Request and Sharing! Daily Thread | Found a neat resource related to Python over the past week? Looking for a resource to explain a certain topic?
Use this thread to chat about and share Python resources! | 0.79 | t3_u4l9am | 1,650,067,210 |
Python | i created my own music player in Python3 | i always wanted an offline music player that was low on ram, and functioned properly, and for the love of god i could not find one so i created mine.
i would be glad if you tested it, here's the github link:
[https://github.com/AvivHamagniv69/music-player](https://github.com/AvivHamagniv69/music-player) | 0.83 | t3_u4l7re | 1,650,067,079 |
Python | How to build a disease prediction service | 0.86 | t3_u4jf15 | 1,650,061,429 |
|
Python | TL;DR: Dictionary Comprehension + Early\Late Binding of Lambdas in Python is Mental | Hello,
I found a behaviour I couldn't explain when using lambdas in a dictionary comprehension so I decided to post a little Intermediate Showcase to inform you about my struggles and give you a solution, in the end (no spoilers)
I like to minify python code in my spare time to relax and it often takes some iterations for each different function or class, alongside those iterations I was golfing a function in a progress bar script I wrote a very long time ago, this is the brief description of what the function should have done: `The function has to take a list of n elements and color them green, yellow or red according to a given condition.`
This was the last *functioning* function in the process of being golfed:
def paint(total, done, elements):
color_str = lambda x, y: f'{x}{y}\033[00m'
colors = {'r' : lambda x: color_str('\033[91m',x),
'g' : lambda x: color_str('\033[92m',x),
'y': lambda x: color_str('\033[93m',x)
}['g' if total == done else 'y' if total/2 <= done else 'r']
return [*map(colors,elements)]
I thought, that's easy, this has to be equivalent to this golfed function:
def paint(total, done, elements):
return [*map({'rgy'[i]:lambda x:f'\033[9{i+1}m{x}\033[00m' for i in range(len('rgy'))
}['g' if total == done else 'y' if done <= total/2 else 'r'],elements)]
*Until it's not*, in fact, while the first function outputs a correct response, the last one is **somehow** stuck on the color yellow, so I thought the dictionary comprehension wasn't working properly and thus I tried:
dict_comp = {'rgy'[i]:lambda x:f'\033[9{i+1}m{x}\033[00m' for i in range(len('rgy'))}
print(dict_comp)
This prompted what I thought it would prompt, a dictionary with `r`,`g` and `y` as keys and a list of lambdas in different memory locations `{'r': <function <dictcomp>.<lambda> at 0x0000018D3E986200>, 'g': <function <dictcomp>.<lambda> at 0x0000018D3E9860E0>, 'y': <function <dictcomp>.<lambda> at 0x0000018D3E986050>}` so I tried to print all the key and lambda pairs with a test for each lambda:
for key, lmbd in dict_comp.items():
print(key, lmbd(f'Testing {key}'))
This was the output:
[Horrific Minion-Colored Results](https://preview.redd.it/o216rv5pjrt81.png?width=139&format=png&auto=webp&s=eb4882d1c3114792c06656ac59204a08f297a790)
I decided to remove the slash to check the text value of the lambda and the correct progression of `i` and this why I noticed the problem: each lambda stored the last value of `i`!
dict_comp = {'rgy'[i]:lambda x:f'033[9{i+1}m{x}\033[00m' for i in range(len('rgy'))}
for key, lmbd in dict_comp.items():
print(key, lmbd(f'Testing {key}'))
>> r 033[93mTesting r # the value after the square bracket is 93 (it's supposed to be 91)
>> g 033[93mTesting g # the value after the square bracket is 93 (it's supposed to be 92)
>> y 033[93mTesting y # the value after the square bracket is 93
Here's the whole code in order to try both functions:
from time import sleep
def paint(total, done, elements):
color_str = lambda x, y: f'{x}{y}\033[00m'
colors = {'r' : lambda x: color_str('\033[91m',x),
'g' : lambda x: color_str('\033[92m',x),
'y': lambda x: color_str('\033[93m',x)
}['g' if total == done else 'y' if total/2 <= done else 'r']
return [*map(colors,elements)]
# UNCOMMENT THIS IN ORDER TO TEST THE FUNCTION DOWN BELOW
"""
def paint(total, done, elements):
return [*map({'rgy'[i]:lambda x:f'\033[9{i+1}m{x}\033[00m' for i in range(len('rgy'))
}['g' if total == done else 'y' if done <= total/2 else 'r'],elements)]
"""
def CustomProgressBar(task, completeness) -> None:
size = 100 // 5
empty = size - completeness//5
fill = size - empty
percent = f'{completeness:>3}% '
filler = f'{"═"*fill}'
isComplete = fill==size
progress_bar, percent = paint(size,fill, [filler, percent])
progress_bar+=f'{"─"*empty}'
print(f'\r{task:<25}{percent}{progress_bar}',
end='\n' if isComplete else '')
for i in range(101):
sleep(0.05)
CustomProgressBar('Range 0-100', i)
I then asked myself:
>Why does this happen? Isn't each anonymous function different?
After some scavenger hunt in StackOverFlow (thanks you Stack for the duplicate question tootip) I found out that the issue might be in [late binding in functions and lambdas in particular](https://stackoverflow.com/questions/3431676/creating-functions-in-a-loop), so the answer, apparently, is that even if the functions are stored in a different memory location as part of the dictionary, the lambda function captures the ***NAME*** of the variable, not the ***VALUE*** of the variable and assigns the value after the dict comprehension is called, so each value becomes the last value in the loop, as the friendliest guy on StackOverFlow explains [here](https://stackoverflow.com/questions/70862614/how-does-python-dict-comprehension-work-with-lambda-functions-inside).
And so, the solution was there, after several hours of head scratches and articles about early and late bind and (anonymous) functions in loop variables inside loops, I had to tie (or late-bind, if you will) the value name of the variable in the lambda function to the value of the variable in the loop.
This means I had to create another value in the lambda and that the value HAS to be the last in the lambda function because it will be created as a keyword argument and lambdas respect the rule of \*args first, \*\*kwargs last.
So, the solution was finally here:
def paint(total, done, elements):
return [*map({'rgy'[i]:lambda x, y=i+1:f'\033[9{y}m{x}\033[00m'for i in range(len('rgy'))}['g' if total == done else 'y' if done >= total/2 else 'r'],elements)]
If you have any question, you find this interesting, you have any feedback, you want to talk about Python or you just want to send me death threats because I wrote a long-ass post about lambdas and how they work in loops, HMU or comment down below.
Have fun, and happy easter:
[Easter Bunny](https://preview.redd.it/c2qo8krnmrt81.png?width=564&format=png&auto=webp&s=354dfac6c9adada4c4e5a57d531b073aa4967968) | 0.73 | t3_u4j0jn | 1,650,060,242 |
Python | Learn Python from Scratch to Advance with Detailed Hands-on | 0.38 | t3_u4hgpj | 1,650,055,769 |
|
Python | Archimedes Spiral: Converting old-school BASIC to Python | A little bit retro, a little bit Python. This is pretty much a direct conversion of the BASIC code to Python. Perhaps you can make it even better!
https://goto10.substack.com/p/archimedes-spiral
https://i.imgur.com/eHdCPrK.jpg | 0.87 | t3_u4h485 | 1,650,054,739 |
Python | Creating an HTTPS Lambda Endpoint without API Gateway | 0.57 | t3_u4gkfx | 1,650,053,153 |
|
Python | Python module for Notion |
Notionpy is a python module that helps you integrate notion with your programme\\workflow utilizing notion's API, the module helps you create, retrieve and update pages or databases with ease
Someone will ask "what is the difference between this module and the other plenty of modules out there !?", as far as I have seen searching the web, this is the most versatile, user-friendly one
you can start using it by typing in your terminal :
pip install auto-py-notion
Github repo :
[https://github.com/kareemmahlees/NotionPy.git](https://github.com/kareemmahlees/NotionPy.git)
Note :
this module is still basic stage with fairly simple functionality, so all your suggestions, issues, and contributions are very welcome | 0.6 | t3_u4da5o | 1,650,044,005 |
Python | How to build a RSS from scraping using Python | 0.94 | t3_u4d17u | 1,650,043,321 |
|
Python | Python, Flask, Elasticsearch - front controller and API documentation - Part 3 Tutorial | Hi, the 3d article devoted to the theme: “How to work with ElasticSearch, Python and Flask” already ready for reading. Here will speak about package dependencies we are going to use, some project structure aspects, controller, REST API, flask\_apispec package and response/request models. All details are here: ["Symfony, elasticsearch - front controller and api documentation"](https://sergiiblog.com/python-flask-elasticsearch-front-controller-and-api-documentation/). Have a pleasant reading. | 0.4 | t3_u4aplz | 1,650,036,900 |
Python | Geometry Calculation | 0.25 | t3_u4a3sa | 1,650,035,177 |
|
Python | How To Build Your Own Crypto News Aggregator [Streamlit] | 0.23 | t3_u49yxj | 1,650,034,812 |
|
Python | A simple email app | I made a simple email app in python
[gocrazygh/emailapp: A simple email app in python (github.com)](https://github.com/gocrazygh/emailapp) | 0.6 | t3_u48ux2 | 1,650,031,662 |
Python | Fun project to notify my boss if I’m at my desk or not each morning. | I made a script that utilizes opencv to help me identify if I’m at my desk or not and then let my boss know. Made a fun video on how it turned out.
[Video](https://youtu.be/AV7qLsYnOWY) | 0.92 | t3_u48iqw | 1,650,030,683 |
Python | Running Python in the Browser with WebAssembly | 0.72 | t3_u47p54 | 1,650,028,107 |
|
Python | 2 Use Cases of Python Pre-commit Hooks to Tidy Up Your Git Repositories | 0.64 | t3_u47kk6 | 1,650,027,739 |
|
Python | Like httpie? Might need to like it again... | A great Python project, [HTTPie](https://github.com/httpie/httpie) recently lost all of its Github stars due to an easy-to-make mistake. [Read more at their blog](https://httpie.io/blog/stardust).
I enjoy [HTTPie](https://github.com/httpie/httpie) as a cURL-like command line tool for interacting with APIs and other web resources. A very clever UI, and a good example of using [rich](https://rich.readthedocs.io/) and [requests](https://docs.python-requests.org/).
You may want to consider helping them restore or even increase their online community, sadly lost due to this error. You can star and/or watch the repo at https://github.com/httpie/httpie | 0.96 | t3_u46vhe | 1,650,025,435 |
Python | Firedm repos no longer exist. | FireDM is a python open source (Internet Download Manager) with multi-connections, high speed engine, it downloads general files and videos from youtube and tons of other streaming websites .
Yesterday I tried to go to the GitHub page to download the latest release but the repo returns a 404 which means it does not exist. The pypi package still exists and here's the link:
https://pypi.org/project/FireDM/
The project page clearly shows that the repository is inaccessible.No forks of it even exist on Github. I can't seem to find any news or complaints anywhere on the internet about this so I was wondering is there some announcement I missed?
And to my last question, is there a way we can save the project through pypi and create forks of it?
Edit : my package manager still has a copy(Manjaro and AUR) | 0.92 | t3_u44t8y | 1,650,017,535 |
Python | Vitrix - An open source FPS video game coded in Python! | Vitrix is a fully open source video game coded in Python! It makes use of Ursina Engine and TKinter for its GUIs and has with prebuilt releases that come bundled with a Python binary and all necessary libraries preinstalled!
Even though Vitrix is still in the early stages of its development, it is still perfectly playable and has actively maintained code and a wiki. Me being the developer, I'm not very good with any of the arts, so anybody who can contribute textures, models or sounds is much appreciated. Vitrix still has much development to go, so anybody who helps will be welcomed.
&#x200B;
Want to see one of your ideas in Vitrix someday?
Recommend me ideas: [https://github.com/ShadityZ/Vitrix/discussions/24](https://github.com/ShadityZ/Vitrix/discussions/24)
Apply to become a developer: [https://github.com/ShadityZ/Vitrix/discussions/26](https://github.com/ShadityZ/Vitrix/discussions/26)
&#x200B;
You can find the Vitrix github repository here: [https://github.com/ShadityZ/Vitrix](https://github.com/ShadityZ/Vitrix)
Here at some images:
[https://user-images.githubusercontent.com/543577/163570397-c4736068-199e-4527-a998-e18309e9c49c.png](https://user-images.githubusercontent.com/543577/163570397-c4736068-199e-4527-a998-e18309e9c49c.png)
[https://imgur.com/a/PLKDG4L](https://imgur.com/a/PLKDG4L)
&#x200B;
Contributions open, ShadityZ | 0.9 | t3_u43oxi | 1,650,012,550 |
Python | Python custom formatting | 0.83 | t3_u43mf5 | 1,650,012,218 |
|
Python | Good GUI builder for Python similar to Java’s Eclipse Windowbuilder | Hi guys! I’m a Java developer migrating to Python, and I’m trying to find a good GUI builder that is similar to Java’s Eclipse windowbuilder. I have tried PyQy5 and it’s Qt Designer which is very good and very close to windowbuilder in terms of interface, but the only problem is that the Qt Designer doesn’t work dynamically with the IDE like the windowbuilder: all Qt Designer’s ui file need to be translated manually to py file and then modified. This is really bad for efficiency since everything added and modified in the Qt Designer need to be saved and translated again and manually copied from the new py file to the main py file, and all objects’ code’s locations need to be manually located (Unlike in windowbuider where you double click the object in the builder and you will be automatically redirected to the related code)
Since Python is such a popular language and so many people use it to develop complicated GUI softwares, I guess there has to be a GUI builder that is more efficient and similar to Java’s windowbuilder | 0.78 | t3_u40lpu | 1,649,999,500 |
Python | Airflow 2.3.0 - Dynamic Tasks | Coming Soon in Airflow 2.3.0 - First-class support for "Dynamic Tasks". This is feature is called "Dynamic Task Mapping"
The wait for the most requested feature of Apache Airflow is almost over !!
No longer hacking over creating dynamic tasks, with Dynamic Task Mapping, Airflow will allow users to create a number of tasks at runtime based upon current data, rather than having to know in advance how many tasks would be needed.
https://twitter.com/kaxil/status/1514745136680419335?s=21&t=suoW11Re4Ew2cooN4FbhEw | 0.73 | t3_u3vzb1 | 1,649,983,938 |
Python | Collection(s) of counter-intuitive Python behaviour | This is kind of a shot in the blue: Some time ago I found a (GitHub?) repo that collected unexpected/surprising Python behaviour. Ofc this depends on ones knowledge but it is stuff that is counter-intuitive if you don't know it or the internals.
The first example was [internal caching of -5...256](https://www.reddit.com/r/Python/comments/18leav/python_integer_range_5_256_and_identity_comparison/) and all the consequences of that (ids, is), …
If you don't know that particular repo, do you know similar behaviour? I found this [Python oddities talk](https://treyhunner.com/python-oddities/) but that wasn't it.
Secondary question: What would be a good source for this (edit: finding oddities/inconsistencies)? I enjoyed to learn what's new by reading the release notes <3. I found looking/searching through [bugs.python.org](https://bugs.python.org/) quite interesting, because you can follow a discussion about aspectes of the language properties/behaviour, same idea why I skimmed PEPs and their discussion.
However, there is always something one does not know and I want to learn all of that. For that reason I am keeping a file in which I document parts of the language that I am not that used to, and then I mostly play around with `ptpython` and try stuff which I try to use later on if it seems like a good fit.
I guess well fitting flairs are discussion, help, resource, … but since I can't really decide I am choosing help. after all I want help to find a resource which could provide material for a discussion. | 0.77 | t3_u3vd2g | 1,649,981,969 |
Python | Friday Daily Thread: Free chat Friday! Daily Thread | Use this thread to talk about anything Python related! Questions, news, projects and any relevant discussion around Python is permitted! | 0.57 | t3_u3uzei | 1,649,980,810 |
Python | Non developer code review | Hello, I am not a developer and barely work with software for my job but have been self taught ever since reading "Automate the boring stuff with python" four years ago. One of the biggest issues that I run into by being self taught and not working with software is I am never really certain if I am doing things correctly or if there are better ways. I have found a bunch of people on fiver to do code reviews but as I don't have a complete project, I'm not sure if that is the best path to take for a code review. For the most part I believe I am past the point of having to following tutorials, but not far enough to really make a full project from start to finish. To summaries my questions:
1. What are the best places/communities for non developer code review?
2. What are the best places/ways to learn how to construct a project from start to finish?
Here is my github to assess my level of knowledge (FYI not much lol)
[https://github.com/daedalus23/Configuration](https://github.com/daedalus23/Configuration) | 0.67 | t3_u3u8om | 1,649,978,547 |
Python | For those familiar with SpeechRecognition module, does it collect user data? | I have a question, and it may be dumb but I haven't been able to find an answer online, but does the SpeechRecognition module, specifically CMU Sphinx or Google Speech Recognition collect user data?
I am a fan of having privacy and try to leave as minimal of a digital footprint when possible and have been wondering since I started using SpeechRecognition about the data collection. I'd like to avoid having to deploy my own NLP, TTS, and STT models if I can to achieve privacy for the project I am working on that involves this stuff. | 0.6 | t3_u3tp8v | 1,649,976,942 |
Python | Version 2.1.1 of YFrake library just released! | I'm happy to let you guys know that the YFrake library now implements caching, speeding up consecutive identical requests to the same endpoints even more! If you are into fintech and use stock market data from Yahoo Finance, give YFrake a try!
It's easy to use, it's way faster than yfinance, has more data endpoints, is thoroughly tested, is fully documented and can even run as a server to forward data to other applications!
You can check it out on GitHub at: [https://github.com/aspenforest/yfrake](https://github.com/aspenforest/yfrake)
The docs are available on: [https://yfrake.readthedocs.io/](https://yfrake.readthedocs.io/) | 0.6 | t3_u3taxa | 1,649,975,777 |
Python | Ready-Made Mobile App UI for Serverless Python | I made a tool for myself to wrap Python code in a mobile app (chat interface) so that I can let my non-technical friends try any programs I write. Curious if you guys would be interested too.
I like coding in Python, but I didn't like how my non-technical friends and family couldn't try my python apps. So I made a lightweight frontend for iOS and Android using Flutter and a lightweight web app to fill in a serverless Python function.
This is how it works:
1. User uses the mobile app to send a message. Optionally with an attachment, like an image. This message is sent to serverless function as a JSON object.
2. Serverless function starter code is just print(msg) and return empty\_message. But when I want to write an app, I do some operations on msg, and return a JSON in a certain schema.
3. Mobile app gets the JSON back from serverless, and I render it to user according to the JSON schema.
I thought I'd try a bunch of consumer app ideas, but I actually ended up mostly making a bunch of other tools for myself. Like when I send a hard-coded message like "redis flushall", I make the backend flush redis cache for another app that I made.
I'm not really utilizing my own tool well, so I'm curious whether anyone here would be interested in using it to make some consumer tools. I can't publicly open it, cuz I made it for myself and there's no robust authentication to prevent people from running spam code on the serverless infra. But I'd love to send link and placeholder auth to some people if you are interested and leave a comment! (Would love to know what kind of apps you'd build!).
If a lot of people are interested, I'll work on protecting it behind some auth, or let people pay for their own compute cost (for example, log in to their AWS; and automatically set up a VM to run the python code you write using my web IDE)! | 0.5 | t3_u3s8ji | 1,649,972,674 |
Python | Run Multiple Functions in Parallel in Python3 | 0.3 | t3_u3rxoa | 1,649,971,834 |
|
Python | I'm organizing a hackathon! | Someone interested in build something next weekend?
\-> workby.io/hackathon | 0.29 | t3_u3r7bu | 1,649,969,801 |
Python | Financial portfolio optimization for scikit-learn enthusiasts | Scikit-portfolio is a Python package designed to introduce **data scientists and machine learning engineers** to the problem of **optimal portfolio allocation in finance**. The main idea of scikit-portfolio is to provide many well-known portfolio optimization methods with an easily accessible **scikit-learn inspired** set of API.
You can optimize your portfolio starting from a pandas Dataframe with the prices or returns and simply compute the MinVol vanilla portfolio to get the optimal weights as:
`MinimumVolatility().fit(prices).weights_`
When your portfolio optimization method depends on a number of hyperparameters you can simply perform a `GridSearchCV` as in machine-learning algorithms, and present the grid of hyperparameters, which for most methods are already encoded in the class.
```
prices_train, prices_test = train_test_split(prices, test_size=0.3, shuffle=False)
ptf_model = MaxSharpe()
best_model = GridSearchCV(
estimator=ptf_model,
param_grid=ptf_model.grid_parameters(),
cv=KFold(5),
scoring=sharpe_ratio_scorer
).fit(prices_train)
```
It implements Omega Ratio and MAD efficient frontier as well as a number of portfolio hyperparameters search methods for the optimization in backtesting settings, using the same methods as in classical machine-learning model selection method.
Additionally, I've implemented ensemble portfolios, like the **Michaud Resampled Efficient Frontier** that builds an optimal portfolio based on the average of many efficient frontiers based on random perturbations of the expected returns.
We not only support the classical MeanVariance efficient frontier, but many kind of efficient frontiers, with different definitions of risk and satisfaction.
This is for example how you build an ensemble of estimators of the maximum Sharpe ratio portfolio:
```
prices = load_tech_stock_prices()
# create a Maximum sharpe ratio portfolio estimator to be fed to resampled frontier meta-estimator
ptf = MaxSharpe(
returns_data=False,
risk_free_rate=0.0,
frequency=252,
rets_estimator=MeanHistoricalLinearReturns()
)
ensemble = MichaudResampledFrontier(
ptf_estimator=ptf,
rets_estimator=MeanHistoricalLinearReturns(),
risk_estimator=SampleCovariance(),
n_iter=512,
n_jobs=-1
).fit(prices)
```
**Documentation**
[https://scikit-portfolio.github.io/scikit-portfolio/](https://scikit-portfolio.github.io/scikit-portfolio/)
**Source code**
[https://github.com/scikit-portfolio/scikit-portfolio](https://github.com/scikit-portfolio/scikit-portfolio)
The project requires some help in the documentation, while it is already pretty stable in the API and bugfix.
 | 0.67 | t3_u3qq2x | 1,649,968,463 |
Python | Parts of the Standard Library that are considered to be bad practice / un-Pythonic ? | I had an argument today about the using the `_empty` object from the `inspect` module to denote an item not found in a lookup, rather than just returning None (as None could well be a value in our data), or erroring (as too many try/excepts make code more difficult to read, and failing to find something in our system is not actually an error anyway).
Aside from the idea of using a private attribute of another module, the other person says it's "not Pythonic" to use smaller custom types like this, as it's too close to something like `typedef` in c++ (never mind that Python has `namedtuple` for almost the exact same purpose anyway, but I digress).
I argued that it's a ready-made and easily legible solution to the problem, and regardless, if it's good enough for the standard library then it should be good enough for us.
While I think I'm right in this case, I know the last point is a very dogmatic way of looking at things.
It got me thinking - are there any notable parts of the language's standard modules, that would be considered a poor or incorrect use of the language if you were to use them in production? | 0.92 | t3_u3p62s | 1,649,964,161 |
Python | GUI, CLI and library for remote controlling Philips Android TVs | Some time ago I was trying to find out if there's a way to programmatically control my TV's Ambilight feature. It turns out Philips Android-powered TVs have a pretty extensive API and there's no decent library or program to make use of it! I found this state of affairs unacceptable and decided to be the change I want to see in the world. Then I proceeded to create a library, CLI, and finally GUI utilizing this API:
* [PhilipsTV GUI](https://github.com/bcyran/philipstv-gui) \- a GUI, obviously
* [philipstv](https://github.com/bcyran/philipstv) \- CLI and a lib
The features include emulating pressing TV remote keys, listing and changing channels and applications, and of course controlling Ambilight.
[All of PhilipsTV GUI functionality in one image](https://preview.redd.it/vkp8gfnkzit81.png?width=1241&format=png&auto=webp&s=14a40b658da14951ad22c1e59e07ec98074547b4)
It would be pretty cool if someone found that useful because I spent quite a lot of time on this and actually... I don't even need this. | 0.94 | t3_u3m6ar | 1,649,955,769 |
Python | I used a new dataframe library (polars) to wrangle the one of the largest housing price databases. Code in post | 0.94 | t3_u3m0qp | 1,649,955,374 |
|
Python | A live 45-minutes session on the fundamentals of observability, OpenTelemetry, and distributed tracing with microservices' messaging systems (Kafka, RabbitMQ, etc) | Hi everyone, we're running another live OpenTelemetry and observability fundamentals session - Wednesday, April 20 at 11 AM PDT.
You will learn how to instrument your message brokers and apps to capture traces with OpenTelemetry.
This session is at no cost and vendor-neutral.
You can expect in this session: 45 minutes of core concepts, how to deploy it yourself hands-on + Q&A.
If you are interested in observability, OpenTelemetry, and tracing - join!
Register here [https://www.aspecto.io/opentelemetry-fundamentals/messaging-systems/](https://www.aspecto.io/opentelemetry-fundamentals/messaging-systems/?utm_source=post&utm_medium=reddit&utm_campaign=r-python-opentelemetry-fundamentals-messaging-systems) | 0.71 | t3_u3kzsh | 1,649,952,550 |
Python | Using Python how to connect to multiple Bluetooth LE devices and transfer data between them. | 0.59 | t3_u3j2d6 | 1,649,947,229 |
|
Python | Running Rich's Inspect in bashrc | I really like [Rich's Inspect method](https://rich.readthedocs.io/en/stable/introduction.html#rich-inspect) such that I want to create a shortcut in my bashrc. I tried thiese and it didn't work.
alias rinspect='python -c "from rich import inspect; import '$1'; inspect('$1')"'
alias r2inspect='python -c 'import sys; from rich import inspect; import sys.argv[1]; inspect(sys.argv[1])'
Basically, I want to run it like this:
$ rinspect datetime
What am I missing here? | 0.81 | t3_u3imay | 1,649,945,996 |
Python | how to handle huge amount of data for a web app ? |
hey guys, i'm working on a project where i'm importing data from google sheets using sheets API weekly, so that each week a new sheet is added to the spreadsheet and then the data is automatically collected in one new sheet to be used as input for my dashboard that i used streamlit to build, i'm planning now to deploy it on heroku, but i came to ci/cd part which i didnt get tbh, and i,m wondering how my app would perform when the data would be larger maybe after 1 year, whaat to do then , is there any solution to handle that big data from the start ? | 0.7 | t3_u3gs01 | 1,649,940,505 |
Python | mdiff - generating diff with block move detection | [mdiff](https://github.com/m-matelski/mdiff) is a package for comparing and generating diff for input sequences. It can detect sequence elements displacements (i.e. line in text have been moved up or down).
# Sequence Matcher
Example:
from mdiff import HeckelSequenceMatcher
a = ['line1', 'line2', 'line3', 'line4', 'line5']
b = ['line1', 'line3', 'line2', 'line4', 'line6']
sm = HeckelSequenceMatcher(a, b)
opcodes = sm.get_opcodes()
for tag, i1, i2, j1, j2 in opcodes:
print('{:7} a[{}:{}] --> b[{}:{}] {!r:>8} --> {!r}'.format(tag, i1, i2, j1, j2, a[i1:i2], b[j1:j2]))
Output:
equal a[0:1] --> b[0:1] ['line1'] --> ['line1']
move a[1:2] --> b[2:2] ['line2'] --> []
equal a[2:3] --> b[1:2] ['line3'] --> ['line3']
moved a[1:1] --> b[2:3] [] --> ['line2']
equal a[3:4] --> b[3:4] ['line4'] --> ['line4']
replace a[4:5] --> b[4:5] ['line5'] --> ['line6']
# Text Diff
Generating diff for input texts with (optional) similar lines changes detection.
from mdiff import diff_lines_with_similarities, CompositeOpCode
a = 'line1\nline2\nline3\nline4\nline5'
b = 'line1\nline3\nline2\nline4\nline6'
a_lines, b_lines, opcodes = diff_lines_with_similarities(a, b, cutoff=0.75)
# Just printing diff on a line level, and nested diff on a character level for similar lines
for opcode in opcodes:
tag, i1, i2, j1, j2 = opcode
print('{:7} a_lines[{}:{}] --> b_lines[{}:{}] {!r:>10} --> {!r}'.
format(tag, i1, i2, j1, j2, a_lines[i1:i2], b_lines[j1:j2]))
if isinstance(opcode, CompositeOpCode) and opcode.children_opcodes:
for ltag, li1, li2, lj1, lj2 in opcode.children_opcodes:
print('\t{:7} a_lines[{}][{}:{}] --> b_lines[{}][{}:{}] {!r:>10} --> {!r}'
.format(ltag, i1, li1, li2, j1, lj1, lj2, a_lines[i1][li1:li2], b_lines[j1][lj1:lj2]))
Output:
equal a_lines[0:1] --> b_lines[0:1] ['line1'] --> ['line1']
move a_lines[1:2] --> b_lines[2:2] ['line2'] --> []
equal a_lines[2:3] --> b_lines[1:2] ['line3'] --> ['line3']
moved a_lines[1:1] --> b_lines[2:3] [] --> ['line2']
equal a_lines[3:4] --> b_lines[3:4] ['line4'] --> ['line4']
replace a_lines[4:5] --> b_lines[4:5] ['line5'] --> ['line6']
equal a_lines[4][0:4] --> b_lines[4][0:4] 'line' --> 'line'
replace a_lines[4][4:5] --> b_lines[4][4:5] '5' --> '6'
# App
**mdiff** provides simple [CLI tool](https://github.com/m-matelski/mdiff#cli-tool) and [GUI app](https://github.com/m-matelski/mdiff#standalone-gui-application) for comparing files and texts. It can be used for visualising and testing different diff algorithms (also Python built-in difflib.SequenceMatcher).
https://preview.redd.it/tu88e3lhrgt81.png?width=1211&format=png&auto=webp&s=45b602c8fed5b89d0dfc1228f889c44a1bca397f | 0.87 | t3_u3glpx | 1,649,939,930 |
Python | HackerRank or Leetcode? | In which one do you guys prefer to practice, and why? | 0.85 | t3_u3ghm3 | 1,649,939,555 |
Python | Running your scheduled Python tasks on Heroku? You can now natively monitor them! 👾👾👾 | Hi devs!
Do you, like so many others, use one-off dynos to run your scheduled tasks on Heroku?
Do you feel like one-off dynos running in the background are kind of invisible?
Have a look at the [One-off Dyno Metrics Heroku add-on](https://elements.heroku.com/addons/one-off-metrics)!
This Heroku add-on plots the execution times, throughput, concurrency, and dyno events of your one-off dynos. It also provides threshold alerting, allowing you to monitor important stuff. You will know exactly how your one-off dynos behave, and what is going wrong.
The add-on is about to become generally available. Last chance to install during the beta and get full access for a month after launch! | 0.8 | t3_u3gaab | 1,649,938,900 |
Python | DataSpell 2022.1 Released | 0.66 | t3_u3d9w5 | 1,649,928,154 |
|
Python | Using Python to create large scale SEM campaigns in minutes. | Join our next webinar on Wednesday 20/04/2022 at 12 PM CET.
Our next guest will be Elias Dabbas, the creator of advertools. He'll share how he's using Python to create large scale SEM campaigns in minutes using advertools.
Topics covered:
\- Generating Keywords for SEM Campaigns
\- Creating Ads Using Long Descriptive Text
\- Creating Ads on a Large Scale
Register here: [https://www.linkedin.com/events/usingpythontocreatelargescalese6918192144046338048/about/](https://www.linkedin.com/events/usingpythontocreatelargescalese6918192144046338048/about/)
[https://github.com/eliasdabbas/advertools](https://github.com/eliasdabbas/advertools) | 0.4 | t3_u39d7x | 1,649,911,596 |
Python | Python as a career | I am an Engineer and have a little background in coding using R.
Is it possible I can learn Python to make it a side hustle?
I welcome your advice. Thanks | 0.82 | t3_u379ba | 1,649,904,315 |
Python | Thursday Daily Thread: Python Careers, Courses, and Furthering Education! | Discussion of using Python in a professional environment, getting jobs in Python as well as ask questions about courses to further your python education!
**This thread is not for recruitment, please see** r/PythonJobs **or the thread in the sidebar for that.** | 0.67 | t3_u343wx | 1,649,894,414 |
Python | Learn how to write clean Python code with this free ebook | Hi!
I wrote [Cleaner Python](https://ezzeddin.gumroad.com/l/cleaner-python) with the intention to help developers who are getting started in writing clean code in Python.
I'd love to hear your feedback and please let me know if you have any questions. | 0.58 | t3_u32r51 | 1,649,890,439 |
Python | Chances of getting a job for smb. learned python at home | Hey folks! I hope it’s the place that I can post this question. Let me give you a brief info about my background.
I’ve studied economics and worked in international sales. After my gf got a job from a Swedish company we decided to move there. We will be there by August if everything went as we want. So I was thinking of learning software to change my career path.
During pandemic I learnt SQL but than didn’t develop myself. So now I started with python which I think easier than many languages. But what I am wondering is if I can get a job or not. I know that it depends on what and how much I learnt and etc. but what you guys think or recommend?
Honestly speaking, I think I can get a job as an intern or a junior. Especially after Covid the demand for developers increased rapidly. So I am not pessimistic about this idea. After python I am planning to learn JavaScript too.
Anyway. I am waiting for your answers and valuable feedbacks! | 0.6 | t3_u32l5z | 1,649,889,953 |
Python | What are your most wanted quality indicators for Python code? | Dear,
I'm trying to list the good and bad practices regarding Python code to write a document to help the teams to assess progress points.
For example in good practices:
* Comments
* Typing
* Docstrings
* Sphinx documentation
* Readable variable names
* Git
* CI/CD
* Unit Tests
* ...
For pollutions:
* Deprecated code with no warning
* Commented code everywhere
* Full paths
* ...
I would like to know what are your own pain points and what you like, or hate, when you inherit from someone else code.
Thanks | 0.71 | t3_u31bkw | 1,649,886,437 |
Python | Alarm-Clock made with Python and Kivy | Hi! I'm here to share with you a little project I developed as a hobby last year: an alarm-clock made with Python and Kivy! I'd appreciate feedbacks :3
[https://github.com/v0di/alarm-clock](https://github.com/v0di/alarm-clock) | 0.84 | t3_u2zz5r | 1,649,882,880 |
Python | PyCharm 2022.1 released | 0.96 | t3_u2vp01 | 1,649,871,165 |
|
Python | The fastest tool for querying large JSON files is written in Python! (benchmark) | [spyql](https://github.com/dcmoura/spyql) is a tool (and python lib) for querying and transforming data. It is fully written in Python.
In the [latest benchmark](https://colab.research.google.com/github/dcmoura/spyql/blob/master/notebooks/json_benchmark.ipynb), spyql outperformed all other tools, including jq, one of the most popular tools written in C.
Here is one example extracted from the benchmark that shows spyql achieving the lowest processing time while keeping memory requirements low when the dataset size is >= 100MB.
&#x200B;
[Processing time and memory requirements vs size of input JSON data](https://preview.redd.it/ejgy2k0gwbt81.png?width=1315&format=png&auto=webp&s=782958571e0a5a7309484011fbc0d7c1c9da5015)
IMO, these results might questions some preconceived opinions about Python’s performance and interpreted languages in general.
The benchmark is very easy to reproduce without installing any software since it runs on a [google colab notebook](https://colab.research.google.com/github/dcmoura/spyql/blob/master/notebooks/json_benchmark.ipynb).
Happy to hear your thoughts!
**UPDATE 2022/04/22**
Thank you all for your feedback. The benchmark was updated and the fastest tool is **NOT** written in Python. Here are the highlights:
* Added ClickHouse (written in C++) to the benchmark: I was unaware that the clickhouse-local tool would handle these tasks. ClickHouse is now the fastest (together with OctoSQL);
* OctoSQL (written in Go) was updated as a response to the benchmark: updates included switching to fastjson, short-circuiting LIMIT, and eagerly printing when outputting JSON and CSV. Now, OctoSQL is one of the fastest and memory is stable;
* SPyQL (written in Python) is now third: SPyQL leverages orjson (Rust) to parse JSONs, while the query engine is written in Python. When processing 1GB of input data, SPyQL takes 4x-5x more time than the best, while still achieving up to 2x higher performance than jq (written in C);
* I removed Pandas from the benchmark and focused on command-line tools. I am planning a separate benchmark on Python libs where Pandas, Polars and Modin (and eventually others) will be included.
This benchmark is a living document. If you are interested in receiving updates, please subscribe to the following issue: [https://github.com/dcmoura/spyql/issues/72](https://github.com/dcmoura/spyql/issues/72)
Thank you! | 0.92 | t3_u2v858 | 1,649,869,896 |
Python | Ohio State University Researchers Develop SAT2LoD2: An Open-Source Python Tool For 3D Landscape Modelling Using Satelite Imagery | 3D landscape modeling has seen a rise in its popularity and applications in recent years. It has countless applications in the fields of civil engineering, earth sciences, military applications, and many others. Geometric 3D models are typically developed using the city geography markup language (CityGML), and the Level-of-Detail (LoD) building model is the preferred model for building 3D models using CityGML.
The use of Satellite imagery for landscape modeling provides the advantage of covering a wide area and is low cost. However, developing LoD2 models using satellite imagery remains a big challenge. Building models in such a way involves complex steps demanding heuristics-based approaches and ML-based detection paradigms.
In a recent paper, researchers at the Ohio State University propose a [SAT2LoD2 ](https://arxiv.org/pdf/2204.04139v1.pdf)to facilitate the development of 3D landscape models. SAT2LoD2 is an open-source, python-based GUI-enabled software that takes the satellite images as inputs and returns LoD2 building models as outputs. The software also has the feature of taking road networks and custom maps as additional inputs for better results.
[Continue Reading](https://www.marktechpost.com/2022/04/13/ohio-state-university-researchers-develop-sat2lod2-an-open-source-python-tool-for-3d-landscape-modelling-using-satelite-imagery/)
Paper: https://arxiv.org/pdf/2204.04139v1.pdf
Github: https://github.com/gdaosu/lod2buildingmodel | 1 | t3_u2v7m9 | 1,649,869,856 |
Python | typeforce: Make mypy more effective |
**Typeforce** is a CLI tool that enriches your Python environment with type annotations, empowering [mypy](https://mypy.readthedocs.io/en/stable/).
In particular:
+ Generates `py.typed` for annotated packages.
+ Installs missed stub files and plugins.
https://github.com/orsinium-labs/typeforce | 0.81 | t3_u2sbgj | 1,649,862,123 |
Python | `nme` - package to simplify data persistence when upgrading data structures | I would like to share my python package `nme`. This package is for simplifying loading data from the older versions of code. It was initially created for [napari](https://napari.org/) plugins for improving science reproducibility, but I think that it may be useful for other projects.
Code is here: https://github.com/Czaki/nme
Documentation: https://nme.readthedocs.io/en/latest/?badge=latest
Currently, it supports `json` and `cbor2` as backends for serialization.
I'm open to any improvement suggestions. | 0.5 | t3_u2s3uy | 1,649,861,576 |
Python | Why does the Development Company use the Python web framework? | 0.11 | t3_u2rvxb | 1,649,860,950 |
|
Python | Minimalist dependency injection in Python | 1 | t3_u2pow9 | 1,649,854,549 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.