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 | I've released a cache backend that uses dynamodb which is compatible with Django's cache framework. | Hello Pythonistas!
I've released a cache backend that uses dynamodb which is compatible with Django's cache framework!
please enjoy :)
https://github.com/xncbf/django-dynamodb-cache | 0.8 | t3_tk54q8 | 1,647,961,771 |
Python | Unraveling the Mystery Behind Background Filters in Video Calling Apps | Ever wondered how video calling apps apply background filters during meetings and replace the background in the video with a background of your choice. This article explains this concept in detail and guides in step by step to implement one in Python.
​
[https://medium.com/geekculture/unraveling-the-mystery-behind-background-filters-in-video-calling-apps-6802507f88a0](https://medium.com/geekculture/unraveling-the-mystery-behind-background-filters-in-video-calling-apps-6802507f88a0) | 0.5 | t3_tk40cc | 1,647,958,616 |
Python | GitHub - gretelai/gretel-python-client: The Gretel Python Client allows you to interact with the Gretel REST API. | 0.5 | t3_tk3uqx | 1,647,958,170 |
|
Python | Python Project Workflow | 0.74 | t3_tk1o33 | 1,647,951,494 |
|
Python | I've been a bit confused on which data class library to use. I wrote this article as part of my own investigation into protobuf, pydantic, etc.. | 0.75 | t3_tk0i4d | 1,647,947,327 |
|
Python | Launching Open Source python library, VevestaX: track your Machine Learning experiments and features in an excel using 5 lines of code |
Hi everyone! We have launched an awesome open source python project that we have developed.
We have created a Python module named **VevestaX:** Easiest library in to track Machine learning experiments and features in an excel file with 5 lines of code !
You can check out the source code at our **GitHub page**: [https://github.com/Vevesta/VevestaX](https://github.com/Vevesta/VevestaX)
Please find a sample output file [https://docs.google.com/spreadsheets/d/1iOL3jiiQ834\_vep5E4fPpxj7QDGVxOBJ/edit](https://docs.google.com/spreadsheets/d/1iOL3jiiQ834_vep5E4fPpxj7QDGVxOBJ/edit)
**Please register** [https://forms.gle/samkZ1gDR53xDvPg7](https://forms.gle/samkZ1gDR53xDvPg7) **as beta testers**. Eager to hear from you.
We are also reachable on [[email protected]](mailto:[email protected]).
**Please star our repository if you want to see it grow !** | 0.57 | t3_tjz9fx | 1,647,942,213 |
Python | Gufo Err: Python error handling framework | [Gufo Err](https://pypi.org/project/gufo-err/) is the flexible Python error handling framework. We'd used the same approach in the [NOC](https://getnoc.com/) for a long time. Now we reworked it as an independent component.
Besides the extended tracebacks and *Sentry* integration it offers
a middleware-based approach for error handling, reporting, analysis, and mitigation. Fail-fast behavior allows detecting unrecoverable errors and quick termination of the application.
Error handling done right is a good foundation for all ranges of python applications, from simple automation scripts to high-load services. | 0.6 | t3_tjykut | 1,647,939,172 |
Python | Asynchronous Web Scraping With Python GRequests | 0.77 | t3_tjy5ed | 1,647,937,217 |
|
Python | python syntax | does anyone feel like changing languages because of how anyone can understand python syntax?
i feel like its cooler writing code that no one can ynderstand.. maybe its just me | 0.28 | t3_tjxth4 | 1,647,935,730 |
Python | PEP 675 titled "Arbitrary Literal String Type" just got accepted. | 0.91 | t3_tjx689 | 1,647,932,830 |
|
Python | How to be a Successful Python developer: Tips to help your hiring prospects | 0.11 | t3_tjwwnn | 1,647,931,691 |
|
Python | Just learned implementing decorators | Hi, I just learned how to make my own decorators and want to know some examples to use them. Some are using a `timer` decorator or a `log` decorator. Would like to get more examples to start thinking about the possibilities. Thanks in advance!
EDIT:
Thank you everyone 🙏🙏🙏 | 0.75 | t3_tjv4c3 | 1,647,924,427 |
Python | The code for `import this` is amazing | Maybe this has been shared here before, but I recently took a peek at the code for the `this` module (the famous `import this` Easter egg that displays Tim Peters' "Zen of Python"). I think it might be the greatest "do as I say not as I do" code example that I've ever seen.
s = """Gur Mra bs Clguba, ol Gvz Crgref
Ornhgvshy vf orggre guna htyl.
Rkcyvpvg vf orggre guna vzcyvpvg.
Fvzcyr vf orggre guna pbzcyrk.
Pbzcyrk vf orggre guna pbzcyvpngrq.
Syng vf orggre guna arfgrq.
Fcnefr vf orggre guna qrafr.
Ernqnovyvgl pbhagf.
Fcrpvny pnfrf nera'g fcrpvny rabhtu gb oernx gur ehyrf.
Nygubhtu cenpgvpnyvgl orngf chevgl.
Reebef fubhyq arire cnff fvyragyl.
Hayrff rkcyvpvgyl fvyraprq.
Va gur snpr bs nzovthvgl, ershfr gur grzcgngvba gb thrff.
Gurer fubhyq or bar-- naq cersrenoyl bayl bar --boivbhf jnl gb qb vg.
Nygubhtu gung jnl znl abg or boivbhf ng svefg hayrff lbh'er Qhgpu.
Abj vf orggre guna arire.
Nygubhtu arire vf bsgra orggre guna *evtug* abj.
Vs gur vzcyrzragngvba vf uneq gb rkcynva, vg'f n onq vqrn.
Vs gur vzcyrzragngvba vf rnfl gb rkcynva, vg znl or n tbbq vqrn.
Anzrfcnprf ner bar ubaxvat terng vqrn -- yrg'f qb zber bs gubfr!"""
d = {}
for c in (65, 97):
for i in range(26):
d[chr(i+c)] = chr((i+13) % 26 + c)
print("".join([d.get(c, c) for c in s]))
Seriously! You can see it [here](https://github.com/python/cpython/blob/main/Lib/this.py).
Beautiful is better than ugly unless you're Tim Peters and can make something that is both beautiful AND ugly! | 0.67 | t3_tjskz4 | 1,647,915,671 |
Python | would it be more human readable if we had a "the" and "where" keywords that turned this: [item for item in items < 0] into: [the item in items where item < 0] | The reason I ask is because I was wondering if list comprehension always starts with item for item in items?
if so, it's so inefficient and clumsy to always write thing for thing in things if... rather than just the thing in things where...
Please be kind if this is the stupidest idea ever. It was just a thought. | 0.24 | t3_tjr17p | 1,647,910,929 |
Python | Useful Tools and Programs list for Python | Useful Tools and Programs list for Python including learning resources, development tools , and frameworks. [https://github.com/mikeroyal/Python-Guide](https://github.com/mikeroyal/Python-Guide) | 1 | t3_tjqlra | 1,647,909,621 |
Python | Tuesday Daily Thread: Advanced questions | Have some burning questions on advanced Python topics? Use this thread to ask more advanced questions related to Python.
**If your question is a beginner question we hold a beginner Daily Thread tomorrow (Wednesday) where you can ask any question! We may remove questions here and ask you to resubmit tomorrow.**
This thread may be fairly low volume in replies, if you don't receive a response we recommend looking at r/LearnPython or joining the Python Discord server at [https://discord.gg/python](https://discord.gg/python) where you stand a better chance of receiving a response. | 1 | t3_tjpsnz | 1,647,907,211 |
Python | LPT: Pandas DataFrames have a "to_clipboard" method | For those that don't know, Pandas has very useful to_clipboard and read_clipboard methods that make it easy to drop a DataFrame into an Excel sheet or to move it across python sessions without having to read and write CSV files. This is really useful for me and I hope it will help you too! | 0.97 | t3_tjodin | 1,647,903,155 |
Python | My TUI now automatically downgrades RGB colors to the richest palette available in your terminal! | &#x200B;
https://preview.redd.it/56i77k4h6to81.png?width=1150&format=png&auto=webp&s=8b1cbeb3f7d719c0c47d5c9c11dc08cfa806e138
[PyTermGUI](https://github.com/bczsalba/pytermgui), my terminal user interface library has now gained the ability to determine the highest-grade color that can be displayed in the terminal emulator it is running in, so that it can convert anything you would normally not be able to see into a color supported. This calculation is done with human perception of colors and brightness factored in, so it looks surprisingly accurate, even with only 16 colors.
It also gained extensive [https://no-color.org](https://no-color.org) support, turning all the colors that would normally be displayed into an xterm-256 greyscale based on their luminance & brightness, once again using human-based formulae.
&#x200B;
https://preview.redd.it/4m0otk4h6to81.png?width=1150&format=png&auto=webp&s=a912b1f662ea7b3653805ffacaa4ab04974cd4b3
If this interests you, check out the [release notes](https://github.com/bczsalba/pytermgui/releases/tag/v4.2.0), see our [subreddit](https://reddit.com/r/pytermgui) or simply install the module with [PIP](https://pypi.org/projects/pytermgui)! | 0.77 | t3_tjnd4p | 1,647,900,398 |
Python | I'm making my own 3D engine ! (I'm trying my best to improve the projection system but it's still garbage for now) | Source code: https://github.com/uItimatech/Python-3D-engine
Demo: https://youtu.be/W-oaCeMkQkw | 0.81 | t3_tjlv0x | 1,647,896,295 |
Python | What is the difference between PyInstaller and PyOxydizer? | 0.14 | t3_tjla5f | 1,647,894,759 |
|
Python | We created a tool to enrich your datasets | Hi everyone!
I’m Nathan, working on [subsets.io](https://subsets.io/), a platform where you can upload datasets, and get matched with relevant external data which you can add with one click.
I've created a prototype to access our platform via sdk:
&#x200B;
https://i.redd.it/wp7qu2xy8so81.gif
Our goal is to make it easier to pull in relevant external data. No more dealing with APIs and their rate limits, pagination, etc.
Do you think this is be useful? Would love to hear your thoughts | 0.67 | t3_tjjdcf | 1,647,889,658 |
Python | Programmable HTTP CLI Tool | Instead of rewriting the same requests or sending a few data one by one while testing the api, I wrote a programmable http tool that can make many requests at once.
[https://github.com/SinanKanidagli/httpy](https://github.com/SinanKanidagli/httpy)
Some key features:
* Expressive and intuitive syntax
* Formatted and colorized terminal output
* Programmable requests
* Multiple requests one line
* Value incremented each time
* Random number per request
* Read each value from the lines in the file
* Value per each request as a list of multiple values
* Built-in JSON support
* Arbitrary request data
* Custom headers | 1 | t3_tjhae1 | 1,647,884,233 |
Python | I wrote a short article about the advantages and disadvantages of python with an example of how to use Python for working with data. | [https://dev.to/patrikbraborec/why-you-should-use-python-for-your-next-project-1lin](https://dev.to/patrikbraborec/why-you-should-use-python-for-your-next-project-1lin) | 0.63 | t3_tjcr91 | 1,647,871,996 |
Python | Python Interpreter API? but a little bit better (Coding 101) | Coding 101 is a API that you can use in making an application similar to leetcode, codewars and other platforms that helps you practice technical interviews. Example calls are getting an easy question this API GET call will return the following
{"Id": 23
"Description":
"Create a Function and Name it Add and it will take 2 arguments and will return the sum of these 2 arguments"
FunctionName":"Add(a,b)"
"Level":1 }
&#x200B;
[API GET QUESTION CALL](https://preview.redd.it/xahvguwrgro81.png?width=940&format=png&auto=webp&s=6c016a3e5d9e867b71187439125bca510f5e7987)
&#x200B;
After receiving your first Api request call you can now call the PostCode api call which is a POST request you will send a json object that will contain your answer to the question and the Question ID.
See example below
&#x200B;
{Code: 'def Add(a , b) : return len(a)', Id: 23}
&#x200B;
&#x200B;
[Tests return](https://preview.redd.it/s0laomztgro81.png?width=940&format=png&auto=webp&s=f1bd860da8e91927516271ff82ef35349c6c8341)
&#x200B;
It will return the output of your answer respectively above picture is an example if your code gets accepted on all 3 testcases. If you get it wrong see below picture for the incorrect output
&#x200B;
[Incorrect Output](https://preview.redd.it/fnl46dbwgro81.png?width=940&format=png&auto=webp&s=4e141aec346b6c1bbf4c291dbb04863c8ad1ccbf)
&#x200B;
And That’s It! Now you can create your own Website like leetcode , codewars if you have any creative ideas go ahead :D api link
[https://rapidapi.com/pacejhayict--7\_la6-gv3/api/coding101](https://rapidapi.com/pacejhayict--7_la6-gv3/api/coding101) | 1 | t3_tjffhc | 1,647,879,245 |
Python | Tetris in Pygame | Just my casual project
[Demo](https://youtu.be/DjAszPLisic)|[Source Code(GitHub(Fixed))](https://github.com/Jatan-Bhatt-21/Tetris)
:P | 0.63 | t3_tjeoz6 | 1,647,877,303 |
Python | Video: Build a Speech Recognition System on a Raspberry Pi | 0.67 | t3_tjenh3 | 1,647,877,197 |
|
Python | I Use Python for Soccer Analytics | Hello Pythonauts!
I use python for Data Analytics; specifically for soccer. I am a Software Developer but this is a passion project for me. On my website, [TodoFootballClub](https://todofootballclub.com/), I write about soccer and the burgeoning use of data in the game. All of my studies are done in python as it is my favorite language to use.
I've done a case study on fatigue in soccer in this article: [https://todofootballclub.com/?p=620](https://todofootballclub.com/?p=620)
I provide the full code in the article as well. I'd love to hear what you think!
https://preview.redd.it/qn7xlb186ro81.png?width=984&format=png&auto=webp&s=86156733e61b2baa55d1be441caf47a44c31b614
&#x200B;
https://preview.redd.it/ls08atns5ro81.png?width=982&format=png&auto=webp&s=cfeb2be3ad82bcff75b23b35fb8572030366f7c3 | 0.72 | t3_tje08f | 1,647,875,451 |
Python | When do you use generators? | I know what they are, but I never write code and come to a point where I go "ah yeah, perfect place to use a generator"
How do you guys recognize that right case or what's the common pattern where you use it and why? | 0.95 | t3_tjd9l1 | 1,647,873,449 |
Python | Async web server on ESP32 using Microdot | Micropython tutorial | Comprehensive written (and video!!) guide on how to use Microdot for your Micropython projects.
Includes how to deal with more advanced async coding, i.e. running web server while making pretty neopixel animations.
[https://bhave.sh/micropython-microdot](https://bhave.sh/micropython-microdot)
If you have questions or comments, please let me know below! | 0.7 | t3_tjd7b8 | 1,647,873,272 |
Python | I created a sorting algorithm, it is a schrobogosort. Basically it bogosorts and if it isn't sorted there is a 50% chance to shut down your PC every time it fails to sort | [https://replit.com/@KieranMcevoy/SchrodingerSort?v=1](https://replit.com/@KieranMcevoy/SchrodingerSort?v=1)
WARNING: THIS WILL SHUTDOWN YOUR PC IF RAN OFF AN IDE NOT REPL | 0.63 | t3_tjcn6j | 1,647,871,678 |
Python | Aproches to planning a project | Tldr:
Are there any tools/tips/tricks you guys use when starting out/ mapping a new project? Or rewriting an existing one?
I mainly use python to analyze data from experiments i run in as part of my phd.
So for the past few years it's been very sufficient to simply create scripts per job/project i work on.
But I'm getting to a point where I'm trying to rework things so it's easier to understand - and for that i want to kind of map out what different steps i do overall.
I guess the most basic way to represent this would be to say i have:
input data -> parsed and combined to a csv -> different calculation -> different plots
It's obviously more complex but that is where i get lost - i can't think of a way to represent all the things i do. And it got me wandering since i guess this is a widely spread issue - how to layout a big project.
So again - any resources/tools/tips/tricks would be appreciated | 1 | t3_tjcfcy | 1,647,871,105 |
Python | All-in-One Python book bundle by Packt | 0.89 | t3_tjbbj6 | 1,647,867,698 |
|
Python | I have my own database that I wanna check plagiarism against, how difficult is it making a plagiarism checker? | 0.4 | t3_tjb86q | 1,647,867,437 |
|
Python | Daily dose of Python | I've been creating small posts about slightly more advanced Python topics lately. They are all available in [https://jerry-git.github.io/daily-dose-of-python/](https://jerry-git.github.io/daily-dose-of-python/).
The episodes so far:
1. [Union vs TypeVar](https://jerry-git.github.io/daily-dose-of-python/doses/1/)
2. [contextmanager from contextlib](https://jerry-git.github.io/daily-dose-of-python/doses/2/)
3. [Modern Python web stack](https://jerry-git.github.io/daily-dose-of-python/doses/3/)
4. [Exhaustiveness checking with mypy](https://jerry-git.github.io/daily-dose-of-python/doses/4/)
5. [PEP 673 Self Type](https://jerry-git.github.io/daily-dose-of-python/doses/5/)
6. [Final qualifier](https://jerry-git.github.io/daily-dose-of-python/doses/6/)
7. [apischema](https://jerry-git.github.io/daily-dose-of-python/doses/7/)
8. [Static duck typing via Protocol](https://jerry-git.github.io/daily-dose-of-python/doses/8/)
9. [dirty-equals](https://jerry-git.github.io/daily-dose-of-python/doses/9/)
And countless more to come 😉
The site itself is mkdocs based static website which is hosted as GitHub pages. Here's the [GitHub repo](https://github.com/jerry-git/daily-dose-of-python). | 0.97 | t3_tj9tz1 | 1,647,862,900 |
Python | How to Deploy a TensorFlow Model as a RESTful API Service | 0.79 | t3_tj8uzz | 1,647,859,275 |
|
Python | oneFace: Generating interfaces(CLI, Qt GUI, Dash web app) from a Python function. | oneFace can generate CLI, Qt GUI and Dash web app at the same time from a Python function. Just mark the function parameters with type and range, for example:
from oneface import one, Arg
@one
def bmi(name: Arg(str),
height: Arg(float, [100, 250]) = 160,
weight: Arg(float, [0, 300]) = 50.0):
BMI = weight / (height / 100) ** 2
print(f"Hi {name}. Your BMI is: {BMI}")
return BMI
# run cli
bmi.cli()
# or run qt_gui
bmi.qt_gui()
# or run dash web app
bmi.dash_app()
These code will generate the following interfaces:
[CLI](https://preview.redd.it/nrgkxp68cpo81.png?width=536&format=png&auto=webp&s=58c872f37c513fc5d2dd120e77065795479455a8)
&#x200B;
[Qt GUI](https://preview.redd.it/c5xrs7lccpo81.png?width=212&format=png&auto=webp&s=5fce4feaa5bec5298e35df574a50b3b72904da64)
&#x200B;
[Dash web app](https://preview.redd.it/nxylugpdcpo81.png?width=610&format=png&auto=webp&s=8df8d72bc95c151caba500c532257c33dfcd0d4e)
## Other features
* Automatically check the type and range of input parameters and pretty print them.
* Easy extension of parameter types and GUI widgets.
## Application and Limitations
Provides interfaces to programs in a very simple way. For example converting functions directly into a web apps for people who don't know how to use the command line. The limitation is that it is only suitable for creating simple interfaces.
## Links
* Repo: [https://github.com/Nanguage/oneFace](https://github.com/Nanguage/oneFace)
* Documentation: [https://oneface.readthedocs.io/en/latest/](https://oneface.readthedocs.io/en/latest/)
## Similar Projects
* [Fire](https://github.com/google/python-fire): Generate CLI from Python objects.
* [Gooey](https://github.com/chriskiehl/Gooey): Turn (almost) any Python 3 Console Program into a GUI application with one line. | 0.9 | t3_tj7d1w | 1,647,853,109 |
Python | Performance testing FastAPI ML APIs with Locust | Rubik's Code | 0.76 | t3_tj6v1x | 1,647,850,944 |
|
Python | Why venv? | I'm new to Python and haven't worked with virtual environments before. I've seen a lot of folks utilising venv and was confused. I searched the web, but I couldn't comprehend much of it. I have a question that I'd want every one of you to answer.
1. Why venv? | 0.82 | t3_tj32vd | 1,647,835,530 |
Python | Codecat | CodeCat is an open-source tool to help you find/track user input sinks and security bugs using static code analysis. These points follow regex rules. [https://github.com/CoolerVoid/codecat](https://github.com/CoolerVoid/codecat) | 0.76 | t3_tj2g24 | 1,647,833,363 |
Python | LinkedIn Researchers Open-Source ‘FastTreeSHAP’: A Python Package That Enables An Efficient Interpretation of Tree-Based Machine Learning Models | Researchers from LinkedIn open-source the FastTreeSHAP package which is a Python module based on the paper ‘[Fast TreeSHAP: Accelerating SHAP Value Computation for Trees](https://arxiv.org/abs/2109.09847).’ Implementing the widely-used TreeSHAP algorithm in the SHAP package allows for the efficient interpretation of tree-based machine learning models by estimating sample-level feature significance values. Its package includes two new algorithms: FastTreeSHAP v1 and FastTreeSHAP v2, both of which improve TreeSHAP’s computational efficiency by taking a different approach.
The empirical benchmarking tests show that FastTreeSHAP v1 is 1.5x faster than TreeSHAP while keeping memory costs the same, and FastTreeSHAP v2 is 2.5x faster while using slightly more memory. The FastTreeSHAP package fully supports parallel multi-core computing to speed up its computation.
[**Continue Reading The Full Summary Article**](https://www.marktechpost.com/2022/03/20/linkedin-researchers-open-source-fasttreeshap-a-python-package-that-enables-an-efficient-interpretation-of-tree-based-machine-learning-models/)
Paper: https://arxiv.org/pdf/2109.09847.pdf
Github: https://github.com/linkedin/fasttreeshap | 0.76 | t3_tj1koz | 1,647,830,519 |
Python | I created a self-hosted security camera system | I don't like the idea of having to stream my video camera feeds to the cloud, so I created a privacy-focused, self-hosted security camera system using python!
[https://github.com/scottbarnesg/smart-sec-cam](https://github.com/scottbarnesg/smart-sec-cam)
Some key features:
* Multi-camera support w/ minimal configuration. Supports USB cameras and the Raspberry Pi camera module.
* Motion detection that automatically saves videos and lets you view them in the web app.
* Encrypted in transit, both from the cameras to the server and the server to your browser.
* Self-hosted and FOSS | 0.96 | t3_tizhpw | 1,647,823,860 |
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.67 | t3_tiyhw1 | 1,647,820,810 |
Python | Live Python Course from computer science professor on Cyber Insecurity Youtube Channel | If anyone wants to learn Python from a professor who's been teaching computer science for over a decade, jump on the Cyber Insecurity Youtube channel on Tuesday nights at 8PM ET. [https://www.youtube.com/channel/UCL4JGzitDkX5TOwzs9A02Kg](https://www.youtube.com/channel/UCL4JGzitDkX5TOwzs9A02Kg) | 0.8 | t3_tixven | 1,647,818,906 |
Python | The LAST 20 Python Packages you will ever need (Machine Learning, Data S... | 0.13 | t3_tith9h | 1,647,806,495 |
|
Python | EZTV-AutoDownloader / Transmission Manager | Hello! (I don't know if this is for this sub.)
I made Auto Downloader from EZTV and Transmission-Remote Manager written in Python.
Some features:
* Automatic download from EZTV
* Check Episode and Season to see if ep is newer
* Remove torrent from Transmission if Completed
* Email notifications on add and complete.
If you're interested, go to the git repo for more information
https://github.com/xhico/EZTV-AutoDownloader
Thanks! | 0.67 | t3_tiqz2t | 1,647,799,587 |
Python | MD now avaible on Termux | A while ago I made a text based tool to download music in mp3 with tags and artworks. Now it's available on Termux. Cheers!
[https://github.com/eliamazzon/MusicDownloader](https://github.com/eliamazzon/MusicDownloader) | 0.8 | t3_tiqdvp | 1,647,798,001 |
Python | Looking for an official documentation regarding security best practices and how to write secure code | I am looking for resources on how to write secure code with Python, I have been in python.org but there is only a Security reporting section. Before considering Google top results I would like to check if there is an official documentation | 0.94 | t3_tiq3ts | 1,647,797,237 |
Python | tkthread - Easy multithreading with tkinter | 0.8 | t3_tip8va | 1,647,794,947 |
|
Python | I just started python 10 days ago an I am super happy. I just created my first program and would love some feedback | I am a complete programming beginner. I started a course on Udemy 10 days ago and this is my first program. I know it is probably not the most efficient way to do it which is why I would like your feedback.
here is the Github link: [https://github.com/RVP97/TicTacToe/blob/main/Project1](https://github.com/RVP97/TicTacToe/blob/main/Project1)
`f_top= ' | | '`
`f_mid= ' 1 | 2 | 3 '`
`f_low= '_____|_______|____'`
`s_top= ' | | '`
`s_mid= ' 4 | 5 | 6 '`
`s_low= '_____|_______|____'`
`t_top= ' | | '`
`t_mid= ' 7 | 8 | 9 '`
`t_low= ' | | '`
&#x200B;
`f_top_1= ' | | '`
`f_mid_1= ' | | '`
`f_low_1= '_____|_______|____'`
`s_top_1= ' | | '`
`s_mid_1= ' | | '`
`s_low_1= '_____|_______|____'`
`t_top_1= ' | | '`
`t_mid_1= ' | | '`
`t_low_1= ' | | '`
&#x200B;
`def print_options():`
`print(f_top)`
`print(f_mid)`
`print(f_low)`
`print(s_top)`
`print(s_mid)`
`print(s_low)`
`print(t_top)`
`print(t_mid)`
`print(t_low)`
`def print_game():`
`print(f_top_1)`
`print(f_mid_1)`
`print(f_low_1)`
`print(s_top_1)`
`print(s_mid_1)`
`print(s_low_1)`
`print(t_top_1)`
`print(t_mid_1)`
`print(t_low_1)`
`def print_every():`
`print('OPTIONS')`
`print_options()`
`print('')`
`print('GAME')`
`print_game()`
`print('Hello players. We are going to play a round of Tic Tac Toe!')`
&#x200B;
`def player_one_name():`
`player_one=input("What is player one's name?: ")`
`return player_one`
&#x200B;
`def player_two_name():`
`player_two=input("What is player two's name?: ")`
`return player_two`
&#x200B;
`player_one=player_one_name()`
&#x200B;
`player_two=player_two_name()`
&#x200B;
`print(f"It is time for {player_one} to play against {player_two}")`
&#x200B;
`import random`
&#x200B;
`list = [player_one,player_two]`
`rand = random.choice(list)`
`print(f"It is {rand}'s turn")`
`if rand == player_one:`
`other=player_two`
`else:`
`other=player_one`
&#x200B;
&#x200B;
`from IPython.display import clear_output`
`print_options()`
`option_list= ['1','2','3','4','5','6','7','8','9']`
`condition=True`
`while condition:`
`while True:`
`if (f_mid_1[2]=='O' and f_mid_1[9]=='O' and f_mid_1[16]=='O') or (s_mid_1[2]=='O' and s_mid_1[9]=='O' and s_mid_1[16]=='O') or (t_mid_1[2]=='O' and t_mid_1[9]=='O' and t_mid_1[16]=='O') or (f_mid_1[2]=='O' and s_mid_1[2]=='O' and t_mid_1[2]=='O') or(f_mid_1[9]=='O' and s_mid_1[9]=='O' and t_mid_1[9]=='O') or (f_mid_1[16]=='O' and s_mid_1[16]=='O' and t_mid_1[16]=='O') or (f_mid_1[2]=='O' and s_mid_1[9]=='O' and t_mid_1[16]=='O') or (f_mid_1[16]=='O' and s_mid_1[9]=='O' and t_mid_1[2]=='O'):`
`print(f'{other} wins')`
`condition=False`
`break`
`if (f_mid_1[2]=='X' and f_mid_1[9]=='X' and f_mid_1[16]=='X') or (s_mid_1[2]=='X' and s_mid_1[9]=='X' and s_mid_1[16]=='X') or (t_mid_1[2]=='X' and t_mid_1[9]=='X' and t_mid_1[16]=='X') or (f_mid_1[2]=='X' and s_mid_1[2]=='X' and t_mid_1[2]=='X') or(f_mid_1[9]=='X' and s_mid_1[9]=='X' and t_mid_1[9]=='X') or (f_mid_1[16]=='X' and s_mid_1[16]=='X' and t_mid_1[16]=='X') or (f_mid_1[2]=='X' and s_mid_1[9]=='X' and t_mid_1[16]=='X') or (f_mid_1[16]=='X' and s_mid_1[9]=='X' and t_mid_1[2]=='X'):`
`print(f'{rand} wins')`
`condition=False`
`break`
`if len(option_list)==0:`
`print("It's a tie")`
`condition=False`
`break`
&#x200B;
`player_choice=input(f'{rand}, pick a number between 1 and 9: ')`
`if player_choice in option_list:`
`player_choice = int(player_choice)`
`if player_choice == 1:`
`clear_output()`
`f_mid_1 = f_mid_1[:2] + 'X' + f_mid_1[2+1:]`
`option_list.remove('1')`
`print_every()`
`break`
`if player_choice == 2:`
`clear_output()`
`f_mid_1 = f_mid_1[:9] + 'X' + f_mid_1[9+1:]`
`option_list.remove('2')`
`print_every()`
`break`
`if player_choice == 3:`
`clear_output()`
`f_mid_1 = f_mid_1[:16] + 'X' + f_mid_1[16+1:]`
`option_list.remove('3')`
`print_every()`
`break`
&#x200B;
`if player_choice == 4:`
`clear_output()`
`s_mid_1 = s_mid_1[:2] + 'X' + s_mid_1[2+1:]`
`option_list.remove('4')`
`print_every()`
`break`
&#x200B;
`if player_choice == 5:`
`clear_output()`
`s_mid_1 = s_mid_1[:9] + 'X' + s_mid_1[9+1:]`
`option_list.remove('5')`
`print_every()`
`break`
&#x200B;
`if player_choice == 6:`
`clear_output()`
`s_mid_1 = s_mid_1[:16] + 'X' + s_mid_1[16+1:]`
`option_list.remove('6')`
`print_every()`
`break`
&#x200B;
`if player_choice == 7:`
`clear_output()`
`t_mid_1 = t_mid_1[:2] + 'X' + t_mid_1[2+1:]`
`option_list.remove('7')`
`print_every()`
`break`
&#x200B;
`if player_choice == 8:`
`clear_output()`
`t_mid_1 = t_mid_1[:9] + 'X' + t_mid_1[9+1:]`
`option_list.remove('8')`
`print_every()`
`break`
&#x200B;
`if player_choice == 9:`
`clear_output()`
`t_mid_1 = t_mid_1[:16] + 'X' + t_mid_1[16+1:]`
`option_list.remove('9')`
`print_every()`
`break`
`else:`
`clear_output()`
`print('Pick a valid number or a position that has not been picked before')`
`print_every()`
`continue`
`while True:`
`if (f_mid_1[2]=='O' and f_mid_1[9]=='O' and f_mid_1[16]=='O') or (s_mid_1[2]=='O' and s_mid_1[9]=='O' and s_mid_1[16]=='O') or (t_mid_1[2]=='O' and t_mid_1[9]=='O' and t_mid_1[16]=='O') or (f_mid_1[2]=='O' and s_mid_1[2]=='O' and t_mid_1[2]=='O') or(f_mid_1[9]=='O' and s_mid_1[9]=='O' and t_mid_1[9]=='O') or (f_mid_1[16]=='O' and s_mid_1[16]=='O' and t_mid_1[16]=='O') or (f_mid_1[2]=='O' and s_mid_1[9]=='O' and t_mid_1[16]=='O') or (f_mid_1[16]=='O' and s_mid_1[9]=='O' and t_mid_1[2]=='O'):`
`condition=False`
`break`
`if (f_mid_1[2]=='X' and f_mid_1[9]=='X' and f_mid_1[16]=='X') or (s_mid_1[2]=='X' and s_mid_1[9]=='X' and s_mid_1[16]=='X') or (t_mid_1[2]=='X' and t_mid_1[9]=='X' and t_mid_1[16]=='X') or (f_mid_1[2]=='X' and s_mid_1[2]=='X' and t_mid_1[2]=='X') or(f_mid_1[9]=='X' and s_mid_1[9]=='X' and t_mid_1[9]=='X') or (f_mid_1[16]=='X' and s_mid_1[16]=='X' and t_mid_1[16]=='X') or (f_mid_1[2]=='X' and s_mid_1[9]=='X' and t_mid_1[16]=='X') or (f_mid_1[16]=='X' and s_mid_1[9]=='X' and t_mid_1[2]=='X'):`
`print(f'{rand} wins')`
`condition=False`
`break`
`if len(option_list)==0:`
`print("It's a tie")`
`condition=False`
`break`
&#x200B;
`player_choice=input(f'{other}, pick a number between 1 and 9: ')`
`if player_choice in option_list:`
`player_choice = int(player_choice)`
`if player_choice == 1:`
`clear_output()`
`f_mid_1 = f_mid_1[:2] + 'O' + f_mid_1[2+1:]`
`option_list.remove('1')`
`print_every()`
`break`
`if player_choice == 2:`
`clear_output()`
`f_mid_1 = f_mid_1[:9] + 'O' + f_mid_1[9+1:]`
`option_list.remove('2')`
`print_every()`
`break`
`if player_choice == 3:`
`clear_output()`
`f_mid_1 = f_mid_1[:16] + 'O' + f_mid_1[16+1:]`
`option_list.remove('3')`
`print_every()`
`break`
&#x200B;
`if player_choice == 4:`
`clear_output()`
`s_mid_1 = s_mid_1[:2] + 'O' + s_mid_1[2+1:]`
`option_list.remove('4')`
`print_every()`
`break`
&#x200B;
`if player_choice == 5:`
`clear_output()`
`s_mid_1 = s_mid_1[:9] + 'O' + s_mid_1[9+1:]`
`option_list.remove('5')`
`print_every()`
`break`
&#x200B;
`if player_choice == 6:`
`clear_output()`
`s_mid_1 = s_mid_1[:16] + 'O' + s_mid_1[16+1:]`
`option_list.remove('6')`
`print_every()`
`break`
&#x200B;
`if player_choice == 7:`
`clear_output()`
`t_mid_1 = t_mid_1[:2] + 'O' + t_mid_1[2+1:]`
`option_list.remove('7')`
`print_every()`
`break`
&#x200B;
`if player_choice == 8:`
`clear_output()`
`t_mid_1 = t_mid_1[:9] + 'O' + t_mid_1[9+1:]`
`option_list.remove('8')`
`print_every()`
`break`
&#x200B;
`if player_choice == 9:`
`clear_output()`
`t_mid_1 = t_mid_1[:16] + 'O' + t_mid_1[16+1:]`
`option_list.remove('9')`
`print_every()`
`break`
`else:`
`clear_output()`
`print('Pick a valid number or a position that has not been picked before')`
`print_every()`
`continue` | 0.46 | t3_tiox8d | 1,647,794,055 |
Python | I made a video tutorial on how to work with image data with python. Hope its a helpful introduction for anyone interested in learning about image processing. | 0.9 | t3_tinykr | 1,647,791,398 |
|
Python | Sending Emails With Python | 0.5 | t3_tin22d | 1,647,788,786 |
|
Python | pip install medium-api | Hi Guys, I recently published a python wrapper around [Medium API](https://rapidapi.com/nishujain199719-vgIfuFHZxVZ/api/medium2) which helps you to extract/fetch data from [medium.com](https://medium.com).
To install it, just run:
```
pip install medium-api
```
**What can you extract with it?**
- Medium User information and user-written articles
- Medium Articles information and their textual content
- Medium Publications information
- Medium’s Top Writers
- Medium’s Topfeeds (Trending, Latest, All time best, best of year/month/week)
- Medium’s Latest Posts (distributed articles)
**How to use it?**
```python
from medium_api import Medium
medium = Medium('YOUR_RAPIDAPI_KEY')
user = medium.user(username='nishu-jain')
user.fetch_articles()
for article in user.articles:
print(article.title)
```
**A few references:**
- Github repository: https://github.com/weeping-angel/medium-api
- Website: https://mediumapi.com
- Swagger documentation: https://docs.mediumapi.com
- ReadTheDocs: https://medium-api.readthedocs.io/en/latest/
- PyPI: https://pypi.org/project/medium-api/
Hoping someone will find it useful :) | 0.87 | t3_timph1 | 1,647,787,819 |
Python | Python Collection Classes - Queues, NamedTuples, DefaultDict, the Professor and Mary Ann | [https://codesolid.com/useful-collection-classes-in-python-you-may-not-know/](https://codesolid.com/useful-collection-classes-in-python-you-may-not-know/)
Enjoy! | 1 | t3_tilukh | 1,647,785,280 |
Python | Creating Real-Time Charts with FastAPI | https://github.com/roniemartinez/real-time-charts-with-fastapi
I've made sample application for anyone interested in writing real-time charts with FastAPI + Server-Sent Events. You can check my Github repo above. | 0.82 | t3_tilg4d | 1,647,784,101 |
Python | Create A REST API In Python Flask | 0.38 | t3_tikn0t | 1,647,781,534 |
|
Python | Step by Step Procedure to Deploy A Flask App On Heroku | 0.17 | t3_tikmj3 | 1,647,781,487 |
|
Python | Python Flask, ElasticSearch and docker environment | Hi, the second article devoted to the theme: “How to work with ElasticSearch using Python and Flask framework” is already ready for reading. It is about preparing microservice environment using docker and docker compose. All details are here: "[Python Flask, ElasticSearch and Docker environment](https://sergiiblog.com/python-flask-elasticsearch-and-docker-environment/)". Have a pleasant reading. | 0.81 | t3_tiid1f | 1,647,772,934 |
Python | Gufo Loader | [Gufo Loader](https://github.com/gufolabs/gufo_loader) is the flexible Python plugin infrastructure framework. We'd used this approach in the [NOC](https://getnoc.com/) \- an open-source network management system and finally decided to release this component as the independent package. Very useful tool to build extendable and reliable python applications and services. | 0.75 | t3_tihlqu | 1,647,769,687 |
Python | How to make the most of Pydantic | 0.87 | t3_tih4e7 | 1,647,767,586 |
|
Python | Sudoku Solver Using Python | AI projects | Github: [https://github.com/bhimrazy/Artificial-Intelligence-Projects](https://github.com/bhimrazy/Artificial-Intelligence-Projects)
https://preview.redd.it/xswtp52b3ho81.png?width=1097&format=png&auto=webp&s=8ce31043a6238eb74bddc97ff6dc6b4072f82f38 | 0.87 | t3_tidx7v | 1,647,753,441 |
Python | I Wanted to Make a Game from Scratch (visuals and all) Using Python so I did. | &#x200B;
[https:\/\/github.com\/M0pps\/Dinosaur-Game.git](https://reddit.com/link/tid126/video/pvim4rectgo81/player) | 0.97 | t3_tid126 | 1,647,750,072 |
Python | Creating a DCGAN with PyTorch | I wrote a short tutorial on creating a deep convolutional GAN to generate new wild animals images from the wildlife animal faces dataset using PyTorch:
[https://taying-cheng.medium.com/create-new-animals-using-dcgan-with-pytorch-2ce47810ebd4](https://taying-cheng.medium.com/create-new-animals-using-dcgan-with-pytorch-2ce47810ebd4) | 0.67 | t3_ti9u5w | 1,647,738,961 |
Python | Modularizing a Chalice Application | If you're looking to develop Chalice lambda functions and needing to realistically modularize your application and files, here's a pretty good article (I'm not the author) on how to go about that. Chalice is used for AWS lambda function development and deployment and has routing decorators similar to Flask and other APIs framework.
[https://medium.com/tensoriot/modularizing-a-chalice-application-for-teams-f716f496b94b](https://medium.com/tensoriot/modularizing-a-chalice-application-for-teams-f716f496b94b) | 0.5 | t3_ti9ryn | 1,647,738,759 |
Python | Space Science with Python - AI 1-8: A Dense Neural Network | Hey Python coders,
today I would like to show you a new tutorial video within my Space Science with Python series. I am still working on a Machine Learning project, and this time we will use TensorFlow / Keras to create a multi-class classifier for our asteroids reflectance spectra.
Since our spectra data are already perfectly cleaned and processed, even a simple Dense layer architecture provides fair results; you'll see! And for starters, Dense-layer-based networks are easy to "digest".
The next video will consider convolution networks and afterwards you will see some nice Autoencoder architecture and unsupervised classification methods. Hopefully you'll like it!
Anyway. A word of "warning". When I create my tutorials I prepare my code, test it, format it, test it again etc. Also this time. But: I had some functions in the Google Colab cache. My "new" functions were not called correctly and I figured it out in the last minutes! Anyway, I left it in the video for others to learn from my mistake I made there. Please note: reset your runtime when you start something new and be aware of issues when using Notebooks in a productive environment.
GitHub: [https://github.com/ThomasAlbin/Astroniz-YT-Tutorials/blob/main/%5BML1%5D-Asteroid-Spectra/8\_dl\_dense\_multiclass.ipynb](https://github.com/ThomasAlbin/Astroniz-YT-Tutorials/blob/main/%5BML1%5D-Asteroid-Spectra/8_dl_dense_multiclass.ipynb)
YouTube: [https://youtu.be/O0rQswBZJ7o](https://youtu.be/O0rQswBZJ7o)
Cheers,
Thomas | 0.81 | t3_ti90ps | 1,647,736,289 |
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.9 | t3_ti8esn | 1,647,734,409 |
Python | I teach python for middle and high schoolers – I made this little trophy for a competition of who could make the best image using Turtle/Python | I will also make some keychains with the best images 3d-printed on them – I hope the students like them!
&#x200B;
https://i.redd.it/7cyldg3odfo81.gif | 0.97 | t3_ti7uyh | 1,647,732,704 |
Python | Automate Key board and mouse | see a lot of people probably using this for gaming but can be used for your job. I use this type of stuff to auto mate stuff I have to type over and over then click a bunch of bottons. Hope it helps
&#x200B;
[https://www.youtube.com/watch?v=shi5Ba\_y4HA&t=264s](https://www.youtube.com/watch?v=shi5Ba_y4HA&t=264s)
&#x200B;
Has anyone used Python to automate other stuff. I want to expand on automating on Python. Or know good modules for stuff like that? | 0.92 | t3_ti5hm4 | 1,647,725,723 |
Python | New Python package for stock market data: YFrake | I've released a new open-source Python package named [YFrake (Github Repository)](https://github.com/aspenforest/yfrake), which returns stock market data from Yahoo Finance and can also serve it to other applications. It has built-in swagger documentation and can run in async and threaded modes. More features are planned for future releases. Package documentation is available at [yfrake.readthedocs.io](http://yfrake.readthedocs.io/) . | 0.89 | t3_ti5geq | 1,647,725,628 |
Python | I broke Math. I generated a quantum random number in Python. Split the decimal part of it into groups of 5 digits. Found every single group in the decimal expansion of PI (just upto a million digits). Somebody tell me I'm wrong or give me a Nobel prize. I won't sleep tonight. | import quantumrandom as qr
with open("piDigits.txt", 'r') as f:
pidecimals = f.read()
f.close()
maxrange = int(input("Enter Maxmimum of Range "))
count = 0
for i in range (0,maxrange):
myx = qr.randint()
print(f"Quantum Number {myx}")
decimalstring = str(myx)
substring1 = decimalstring[2:7]
substring2 = decimalstring[7:12]
substring3 = decimalstring[12:17]
if substring1 in pidecimals:
count += 1
print(f"Quantum digit sequence {substring1} found in Pi")
if substring2 in pidecimals:
count += 1
print(f"Quantum digit sequence {substring2} found in Pi")
if substring3 in pidecimals:
count += 1
print(f"Quantum digit sequence {substring3} found in Pi")
print(f"Quantum digit sequences found in Pi {count} times out of {3*maxrange}")
Sample Output: (Ran the code many times to look for an exception. None found. Yet.)
`Enter Maxmimum of Range 20`
`Quantum Number 4.434424353398947`
`Quantum digit sequence 43442 found in Pi`
`Quantum digit sequence 43533 found in Pi`
`Quantum digit sequence 98947 found in Pi`
`Quantum Number 9.409781033035783`
`Quantum digit sequence 40978 found in Pi`
`Quantum digit sequence 10330 found in Pi`
`Quantum digit sequence 35783 found in Pi`
`Quantum Number 9.769588769359885`
`Quantum digit sequence 76958 found in Pi`
`Quantum digit sequence 87693 found in Pi`
`Quantum digit sequence 59885 found in Pi`
`Quantum Number 7.9896238651102465`
`Quantum digit sequence 98962 found in Pi`
`Quantum digit sequence 38651 found in Pi`
`Quantum digit sequence 10246 found in Pi`
`Quantum Number 1.8486305027847716`
`Quantum digit sequence 84863 found in Pi`
`Quantum digit sequence 05027 found in Pi`
`Quantum digit sequence 84771 found in Pi`
`Quantum Number 5.2133974212253`
`Quantum digit sequence 21339 found in Pi`
`Quantum digit sequence 74212 found in Pi`
`Quantum digit sequence 253 found in Pi`
`Quantum Number 3.3063248645761805`
`Quantum digit sequence 30632 found in Pi`
`Quantum digit sequence 48645 found in Pi`
`Quantum digit sequence 76180 found in Pi`
`Quantum Number 6.982528419928283`
`Quantum digit sequence 98252 found in Pi`
`Quantum digit sequence 84199 found in Pi`
`Quantum digit sequence 28283 found in Pi`
`Quantum Number 4.838788433661402`
`Quantum digit sequence 83878 found in Pi`
`Quantum digit sequence 84336 found in Pi`
`Quantum digit sequence 61402 found in Pi`
`Quantum Number 0.5404745555809872`
`Quantum digit sequence 54047 found in Pi`
`Quantum digit sequence 45555 found in Pi`
`Quantum digit sequence 80987 found in Pi`
`Quantum Number 5.2051575494010835`
`Quantum digit sequence 20515 found in Pi`
`Quantum digit sequence 75494 found in Pi`
`Quantum digit sequence 01083 found in Pi`
`Quantum Number 2.928511482413977`
`Quantum digit sequence 92851 found in Pi`
`Quantum digit sequence 14824 found in Pi`
`Quantum digit sequence 13977 found in Pi`
`Quantum Number 8.577248798352025`
`Quantum digit sequence 57724 found in Pi`
`Quantum digit sequence 87983 found in Pi`
`Quantum digit sequence 52025 found in Pi`
`Quantum Number 0.699015793087663`
`Quantum digit sequence 69901 found in Pi`
`Quantum digit sequence 57930 found in Pi`
`Quantum digit sequence 87663 found in Pi`
`Quantum Number 6.524299992370489`
`Quantum digit sequence 52429 found in Pi`
`Quantum digit sequence 99923 found in Pi`
`Quantum digit sequence 70489 found in Pi`
`Quantum Number 5.860379949645227`
`Quantum digit sequence 86037 found in Pi`
`Quantum digit sequence 99496 found in Pi`
`Quantum digit sequence 45227 found in Pi`
`Quantum Number 6.33020523384451`
`Quantum digit sequence 33020 found in Pi`
`Quantum digit sequence 52338 found in Pi`
`Quantum digit sequence 4451 found in Pi`
`Quantum Number 4.562294956893263`
`Quantum digit sequence 56229 found in Pi`
`Quantum digit sequence 49568 found in Pi`
`Quantum digit sequence 93263 found in Pi`
`Quantum Number 2.0715648126955064`
`Quantum digit sequence 07156 found in Pi`
`Quantum digit sequence 48126 found in Pi`
`Quantum digit sequence 95506 found in Pi`
`Quantum Number 8.903639276722362`
`Quantum digit sequence 90363 found in Pi`
`Quantum digit sequence 92767 found in Pi`
`Quantum digit sequence 22362 found in Pi`
`Quantum digit sequences found in Pi 60 times out of 60` | 0.2 | t3_ti584e | 1,647,724,969 |
Python | PyMacApp: Build, Package, and Code-Sign Python Projects on MacOS in just 10-lines of Python Code! | Hi All:
I recently posted about a project I was working on called PyMacApp. I just released a ton of updates that brings full support for building, packaging, and code-signing in as little as just 10 lines of code (2 import statements, 4 for the app, and 4 for the package; it supports function chaining, so you could even accomplish this in less than 10 lines)!
Get started with ```pip3 install pymacapp```
GH: https://github.com/The-Nicholas-R-Barrow-Company-LLC/PyMacApp
A more-detailed starter is available below.
```
# build.py
from pymacapp import App, Package
from pymacapp.helpers import get_first_application_hash, get_first_installer_hash
# Apple Account Information
# You can get rid of the input(...) functions and instead enter the strings directly so you do not have to enter them each time.
APPLE_DEVELOPER_ACCOUNT_EMAIL = input("Apple Developer ID Email (str): ")
APPLE_DEVELOPER_ACCOUNT_APP_SPECIFIC_PASSWORD = input("Apple Developer ID App-Specific Password (str): ")
app = App("My New App", "com.identifier")
app.setup("./app/main.py", overwrite=True)
app.build()
app.sign(get_first_application_hash())
package = Package(app, "0.0.1", "com.identifier.pkg")
package.build(get_first_installer_hash())
package.sign(get_first_installer_hash())
package.notorize(APPLE_DEVELOPER_ACCOUNT_EMAIL, APPLE_DEVELOPER_ACCOUNT_APP_SPECIFIC_PASSWORD).wait()
``` | 0.68 | t3_ti4ztb | 1,647,724,308 |
Python | Small Line Counter Script | I made a command line tool that lets you specify a file/directory path on the command line and will count the lines of code in a file or all files within a directory or directories recursively. I plan to add more features. I am a systems dev by trade and have worked with python in the past but not very much and that was a couple years ago, so I didn't know if I should flag this as beginner or intermediate but let me know if I should change it. Please feel free to contribute. If you do read the code (its short) I would love feedback.
[https://www.github.com/carterdugan/LineCounter](https://www.github.com/carterdugan/LineCounter) | 0.81 | t3_ti4zcz | 1,647,724,271 |
Python | Is pygame still worth it in 2022?? | 0.85 | t3_thzhqp | 1,647,709,018 |
|
Python | What do you think is the most valuable Python package? | In the spirit of March Madness, we created a tournament to choose the MVP Python package. This is just meant to be fun, but it might jumpstart an interesting discussion about your choices and the kind of work you're doing.
[https://deephaven.io/community/experiments/python-bracket/](https://deephaven.io/community/experiments/python-bracket/) | 0.14 | t3_thw2h9 | 1,647,699,262 |
Python | Build a Hash Table in Python With TDD – Real Python | 0.75 | t3_thvrq5 | 1,647,698,366 |
|
Python | How to Shortlist the Best Python Development Company ? | 0.2 | t3_thvj46 | 1,647,697,596 |
|
Python | DeepForSpeed: A self driving car in Need For Speed Most Wanted built with python + pytorch | [video here](https://youtu.be/t0iqfM36mRc)
[code here](https://github.com/edilgin/DeepForSpeed)
So i built a self driving car with python in need for speed most wanted(2005). I was really impressed when i saw nvidia build their own self driving car with just a single algorithm(cnn) so i decided to try it myself. Basically i record training data while i'm playing the game (i played around 2 hours i think) my key presses associated with every frame are recorded. Later i process this training data and train the algorithm (which is almost the same as the nvidia's). Latest step is just running the algo. Important hings i've used are: numpy, opencv, matplotlib and pytorch.
Please take a look at the code i tried to document everything and i would appreciate any pull requests and advice in general :) | 0.97 | t3_thsp8c | 1,647,686,990 |
Python | Python for beginners from Harvard CS50x. Starting April 1st. Free course, awesome teacher, explains how computer thinks in terms of programming. 11 weeks 3-9 hours per week! Sign up now, highly recommended. | 0.94 | t3_ths5wg | 1,647,684,560 |
|
Python | Red Mail: All you need from an email sender | Hi all,
I have made a couple of posts about Red Mail in the past but I recently received some comments feeling this being underrated compared to how useful it really is. So, I hope you don't mind an update, I also just released a new version.
So what is Red Mail? It's an email library that aims for simplicity without compromising features. You will find a bunch of email senders from Pypi but there is nothing quite like this.
So what can it do?
* [Supports sending HTML, text, attachments](https://red-mail.readthedocs.io/en/latest/tutorials/sending.html)
* [Send to regular receivers, cc (carbon copy) or bcc (blind carbon copy)](https://red-mail.readthedocs.io/en/latest/tutorials/sending.html)
* [Attachments from various types: paths, bytes, Pandas dataframes, etc.](https://red-mail.readthedocs.io/en/latest/tutorials/attachments.html)
* [Emails with embedded images in HTML](https://red-mail.readthedocs.io/en/latest/tutorials/body_content.html#embedding-content)
* [Embedded images from various types: Matplotlib plots or PIL images](https://red-mail.readthedocs.io/en/latest/tutorials/body_content.html#embedding-content)
* [Emails with embedded (prettified) tables from Pandas dataframes](https://red-mail.readthedocs.io/en/latest/tutorials/body_content.html#embedded-tables)
* [Templated emails using Jinja](https://red-mail.readthedocs.io/en/latest/tutorials/jinja_support.html)
* [Gmail and Outlook pre-configured](https://red-mail.readthedocs.io/en/latest/tutorials/config.html)
* [Logging handlers!](https://red-mail.readthedocs.io/en/latest/extensions/logging.html)
* [Flask integration](https://flask-redmail.readthedocs.io/en/stable/index.html)
A minimal example for Gmail users:
from redmail import gmail
gmail.username = "[email protected]"
gmail.password = "<MY PASSWORD>"
gmail.send(
sender="[email protected]",
receivers=["[email protected]"],
subject="An example email",
html="""
<h1>Hi,</h1>
<p>nice to meet you.</p>
""",
)
More advanced features:
from redmail import EmailSender
email = EmailSender(host="smtp.myhost.com", port=0)
email.send(
sender="[email protected]",
receivers=["[email protected]"],
subject="An example email",
html="""
<h1>Hi {{ friend }},</h1>
<p>look at this image:</p>
{{ nice_image }}
""",
body_params={"friend": "Jack"},
body_images={"nice_image": 'path/to/image.png'},
attachments={"file.csv": pd.DataFrame({"col": [1, 2, 3]})}
)
So it's pretty clean and does everything you wished from an email sender. There are alternatives for email sending but nothing quite like this. It is also well tested and documented.
Resources:
* Source code: [https://github.com/Miksus/red-mail](https://github.com/Miksus/red-mail)
* Documentation: [https://red-mail.readthedocs.io/en/latest/](https://red-mail.readthedocs.io/en/latest/)
* Releases: [https://pypi.org/project/redmail/](https://pypi.org/project/redmail/)
If you need to integrate it to a Flask application:
* Source code: [https://github.com/Miksus/flask-redmail](https://github.com/Miksus/flask-redmail)
* Documentation: [https://flask-redmail.readthedocs.io/en/latest/](https://flask-redmail.readthedocs.io/en/latest/)
* Releases: [https://pypi.org/project/Flask-Redmail/](https://pypi.org/project/Flask-Redmail/)
So what has changed? Now the email structures are more structured and more likely gets rendered across email providers, fixed a bug related to embedded emails and aliases and improved documentation.
If you found it useful, leave it a star on Github. That's the way to get visibility and it lets me know I'm building useful things in my free time. Thanks again for all the support! | 0.88 | t3_thrdr9 | 1,647,681,015 |
Python | I created a super simple customizable desktop clock with python | Have you ever wanted to program a simple clock for your desktop? This [Simple Desktop Clock](https://github.com/underpig1/simplest-desktop-clock) uses python's tkinter to create a desktop clock for cleaner layouts. The best part is, you can customize how it looks and where it appears on your screen really easily, and it will change colors based on your wallpaper colors. I created this program a few weeks back because I was annoyed with the tiny clock in the bottom right of my screen and wanted something like the big clock on the lock screen. I decided to share it when I heard others were encountering a similar problem. The clock functions just as a part of your wallpaper--as in, you can't drag it or click on it, and it by default stays behind your windows. Let me know if you enjoy it or find it useful!
https://preview.redd.it/0thaq2fkzao81.png?width=1674&format=png&auto=webp&s=f00ab6723f9de61dc72fe1fc4adfb36fd814301d | 0.89 | t3_thqxd6 | 1,647,678,891 |
Python | 3 Things You Might Not Know About Numbers in Python | 0.5 | t3_thqu6i | 1,647,678,482 |
|
Python | The Zen Of Python, One-Liners and Being Pythonic | 0.83 | t3_thqfid | 1,647,676,626 |
|
Python | What extension is useful when doing Python in VS code? | Hi! I'm new to using VS code. Before this I was using Spyder and found that VS code to be more complicated (for me). Please do recommend me necessary extension :D | 0.67 | t3_thpx8i | 1,647,674,284 |
Python | Solution to Ramanujan equations | [https://todaymylearn.blogspot.com/2022/03/solution-to-ramanujan-equations.html](https://todaymylearn.blogspot.com/2022/03/solution-to-ramanujan-equations.html)
I made a small program in python to solve Ramanujan equations. | 0.46 | t3_thplm6 | 1,647,672,828 |
Python | PEP 686: Make UTF-8 mode default | 0.97 | t3_thnk4l | 1,647,664,164 |
|
Python | Complete Guide to PyGame Setup in 14 mins! | 0.7 | t3_thmkk7 | 1,647,660,554 |
|
Python | What Python GitHub repos are good examples of best practices? | I've been writing more packages and recently enjoyed looking through Perfect's GitHub. It felt like a good example of code structuring, they implemented their cli well. I even started to look at how they were branching and what they were putting in commit messages.
I very frequently work on islands without the oversight of more senior engineers and wanted to know if there were other GitHub repos you guys recommend looking at to learn how to learn to write good software. | 0.85 | t3_thmbi1 | 1,647,659,670 |
Python | Euporie: a terminal app for working with Jupyter notebooks | 1 | t3_thlcky | 1,647,656,373 |
|
Python | A Happy Success Story and Python! | Hi everyone!
&#x200B;
I just wanted to share some exciting events, as well as a good story for those maybe demotivated learning Python.
&#x200B;
Like many of you, I started learning Python (around 3-4 months ago), and quickly felt overwhelmed by just the huge mass of tutorials, libraries, and posts. However, I pushed through it, and have made some real progress!
&#x200B;
Today I launched v1 of my AI/startup business [https://finned.tech](https://finned.tech) \- selling a (Python) solution for personalized marketing on digital billboards, a solution now patent-pending. In addition to this, I built a licensing solution from the ground up, again using Python, and finally a Python webserver (using FastAPI) to handle auth, license checks, and payments.
&#x200B;
What I learned from all of this (besides that it's hard to start a business), is that if you keep persevering, watching those tutorials, and building those things you think no one will ever use, that, before you know it, you'll be creating things you never thought possible before!
&#x200B;
Hopefully this post has inspired some of you to put a bit more effort into learning and building some projects, as I know many posts here did with me.
&#x200B;
(Ok, now I'm done with my story, go build some cool things and learn more!) | 0.85 | t3_thlata | 1,647,656,210 |
Python | Elden Ring Open Source API | Good night tarnished guys and gals. Do we have some developers among us? I made this open-source API that contains all kinds of data scraped from Elden Ring that can be used for all sorts of student projects. So if you're new to programming/web development, loves Elden Ring, and want to build a cool app, feel free to use and abuse this API.
This is an Open Source project, so feel free to contribute. All the data and media can be found in the GitHub repository. Also, since the game came out not long ago, there are still some missing data and gaps here and there. If you find any issues, feel free to open an issue or open a PR that I will gladly merge into the codebase.
The API is available in both REST and GraphQL formats. Get started at [https://eldenring.fanapis.com/](https://eldenring.fanapis.com/)
&#x200B;
Source code available at: [https://github.com/deliton/eldenring-api](https://github.com/deliton/eldenring-api) | 0.93 | t3_thl39l | 1,647,655,499 |
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! | 1 | t3_thiqqa | 1,647,648,010 |
Python | *UPDATED* Random numbers generator list with Mean, Median, Mode and frequency of each number | import random
import numpy
from statistics import mode
import csv
import collections
#create list
list=[]
##random numbers
for i in range (100):
number= (random.randint(0,10))
#add to list
list.append(number)
print("Random numbers: "+(str(list)))
list.sort()
print("Numbers sorted: "+(str(list)))
#Mean, median and mode of list
mean1=numpy.mean(list)
median1=numpy.median(list)
mode1=mode(list)
print("The mean of the numbers is "+(str(mean1)))
print("The median of the numbers is "+(str(median1)))
print("The mode of the numbers is "+(str(mode1)))
##frequency method
##dictionary
frequency = {}
###using collections.Counter for number frequency
frequency=collections.Counter(list)
# printing the frequency
print(frequency)
##Export dictionary to CSV file
with open('numbers.csv', 'w') as f:
for key in frequency.keys():
f.write("%s,%s\n"%(key,frequency[key]))
#df.to_csv("numbers.csv", header=["Number", "Frequency"], index=False) | 0.6 | t3_thgvms | 1,647,642,439 |
Python | Random numbers generator list with Mean, Median, Mode and frequency of each number | import random
import numpy
from statistics import mode
import csv
#create list
list=[]
##random numbers
for i in range (100):
number= (random.randint(0,10))
#add to list
list.append(number)
print("Random numbers: "+(str(list)))
list.sort()
print("Numbers sorted: "+(str(list)))
#Mean, median and mode of list
mean1=numpy.mean(list)
median1=numpy.median(list)
mode1=mode(list)
print("The mean of the numbers is "+(str(mean1)))
print("The median of the numbers is "+(str(median1)))
print("The mode of the numbers is "+(str(mode1)))
##frequency method
##dictionary
frequency = {}
# iterating over the list
for item in list:
# checking the element in dictionary
if item in frequency:
# incrementing the counr
frequency[item] += 1
else:
# initializing the count
frequency[item] = 1
# printing the frequency
print(frequency)
##Export dictionary to CSV file
with open('numbers.csv', 'w') as f:
for key in frequency.keys():
f.write("%s,%s\n"%(key,frequency[key])) | 0.33 | t3_thdm72 | 1,647,633,270 |
Python | I've heard that "if a class is just a constructor and one method, then it should be a function". What is your opinion on this and what are counter examples? | I watched a seminar a few years ago about someone talking about the misuses of OOP in python and talked extensively about the case where people write a class, implement the `__init__()` method and one extra method and that's it.
He provided examples and showed functional code that simplifies the solution to a few lines and he said:
> "If a class is just a constructor and one method, then it shouldn't be a class at all. It should be a function."
I can't find the video anymore, but I was just wondering what reddit thinks about this statement and if you have any counter examples or in what cases it could be useful.
I'm also interested in the cases where if it is true, how would that functional implementation look like when I need some sort of a state to persist.
EDIT: Awesome discussion in the comments. Thanks for everyone's input! | 0.97 | t3_th6ztt | 1,647,623,696 |
Python | Resume Generation With Python | 0.33 | t3_th6lvy | 1,647,623,183 |
|
Python | Latest Python for Debian GNU/Linux | 0.43 | t3_th3oai | 1,647,616,559 |
|
Python | what's sentiment analysis methodology | * Discuss sentimental analysis.
* Describe the Python download and installation process.
* Define polarity and subjectivity.
* Explain the use of textBlobs.
* Contrast lemmatization to tokenization
* Discuss the POS Tag language.
* Explain Bigrams, Trigrams and Ngrams.
* List the various Anaconda applications.
* Summarize capitalizations, pluralizations and singularizations.
* Outline loops in Ngrams.
* Describe TextBlob classification.
* Relate data frame to the classification of sentiments.
[https://alison.com/topic/learn/129326/sentimental-analysis-methodology-learning-outcomes](https://alison.com/topic/learn/129326/sentimental-analysis-methodology-learning-outcomes) | 0.2 | t3_th3fc7 | 1,647,615,880 |
Python | Python Cybersecurity — Build your own python tools (PortScanner, Visual Network Tracker and Anonymous FTP Scanner) | **Python Cybersecurity — PortScanner**
Build a simple Port Scanner using the Python Programming language. Port Scanner is an application designed to probe a server or host for open ports. Such an application may be used by administrators to verify security policies of their networks and by attackers to identify network services running on a host and exploit vulnerabilities.
**YouTube Link**: [https://youtu.be/bH-3PuQC\_n0](https://youtu.be/bH-3PuQC_n0)
**Medium Link:** [https://medium.com/vinsloev-academy/python-cybersecurity-build-a-port-scanner-13b798a1b654](https://medium.com/vinsloev-academy/python-cybersecurity-build-a-port-scanner-13b798a1b654)
**Python Cybersecurity — Visual Network Tracker**
Dive into Network Traffic visualization using the Python programming language, Wireshark and Google Maps. This tutorial covers the implementation steps needed to take a file of network traffic and convert it into a visual presentation using Google Maps.
**YouTube Link**: [https://youtu.be/xuNuy8n8u-Y](https://youtu.be/xuNuy8n8u-Y)
**Medium Link:** [https://medium.com/vinsloev-academy/python-cybersecurity-network-tracking-using-wireshark-and-google-maps-2adf3e497a93](https://medium.com/vinsloev-academy/python-cybersecurity-network-tracking-using-wireshark-and-google-maps-2adf3e497a93)
**Python Cybersecurity — Anonymous FTP Scanner**
Build a simple FTP Scanner using the Python Programming language. Anonymous FTP is a means by which archive sites allow general access to their archives of information. These sites create a special account called “anonymous”
**YouTube Link**: [https://youtu.be/BIZfRodSW9w](https://youtu.be/BIZfRodSW9w)
**Medium Link:** [https://medium.com/vinsloev-academy/python-cybersecurity-for-beginners-build-anonymous-ftp-scanner-a62f0534fcf5](https://medium.com/vinsloev-academy/python-cybersecurity-for-beginners-build-anonymous-ftp-scanner-a62f0534fcf5) | 0.8 | t3_th30u3 | 1,647,614,790 |
Python | Business logic in Django and Django REST Framework applications | 0.69 | t3_th2zll | 1,647,614,691 |
|
Python | Python finally offloads some batteries | 0.57 | t3_th2ezh | 1,647,613,112 |
|
Python | Proposed Addition to Python ASYNC. | I'm a big fan of using Python for distributed computing. I have used the Twisted framework for years and the process level support. I love that we now have Future, Async, and Await as a standard part of the language.
I've been thinking that the next step has to be merging together the threading and process level into a single langauge. This got me thinking with little change why not support the following language syntax/semantics:
&#x200B;
typeOfEnttity := 'process' | 'thread';
func := \[async \[typeOfEntity\]\] def ....
&#x200B;
The idea is that if I say
def foo() ... it is the Python standard.
&#x200B;
If I say
async def foo() or async thread def foo() ...
we have the asyncio stuff we have today.
&#x200B;
If I say
async process def foo() ....
I have it using the multiprocess support of Python. I think this movies python in the "right" direction. I'm wondering what you all think about this proposal? | 0.5 | t3_th04ho | 1,647,606,312 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.