Pixel-map: A Python CLI tool for plotting geo files in the terminal
# What My Project Does
[**Pixel-map**](https://github.com/RaczeQ/pixel-map) displays geo data in the terminal. It can be used to quickly look into the geospatial data without opening generating HTML maps or using tools like [kepler.gl](https://kepler.gl/).
GitHub: [https://github.com/RaczeQ/pixel-map](https://github.com/RaczeQ/pixel-map)
PyPI: [https://pypi.org/project/pixel-map/](https://pypi.org/project/pixel-map/)
Since I can't embed images in this post, I can only show you the Black and White modes of the library.
ASCII renderer `ascii-bw`:
$ pixel-map arc-de-triomphe.parquet -r ascii-bw --width 82 --height 43 --no-bg
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━ arc-de-triomphe.parquet ━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ ┃
┃ ┃
┃ @@L_ jr
/r/Python
https://redd.it/1gc3a1k
# What My Project Does
[**Pixel-map**](https://github.com/RaczeQ/pixel-map) displays geo data in the terminal. It can be used to quickly look into the geospatial data without opening generating HTML maps or using tools like [kepler.gl](https://kepler.gl/).
GitHub: [https://github.com/RaczeQ/pixel-map](https://github.com/RaczeQ/pixel-map)
PyPI: [https://pypi.org/project/pixel-map/](https://pypi.org/project/pixel-map/)
Since I can't embed images in this post, I can only show you the Black and White modes of the library.
ASCII renderer `ascii-bw`:
$ pixel-map arc-de-triomphe.parquet -r ascii-bw --width 82 --height 43 --no-bg
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━ arc-de-triomphe.parquet ━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ ┃
┃ ┃
┃ @@L_ jr
/r/Python
https://redd.it/1gc3a1k
GitHub
GitHub - RaczeQ/pixel-map: Python CLI tool for plotting geo files in the terminal
Python CLI tool for plotting geo files in the terminal - RaczeQ/pixel-map
Anyone working on or with a great but little-known test framework?
If you're developing or enjoying a less popular testing framework with Python, I'd love to hear about it!
I don't love pytest, some of its complexities, tall decorator stacks, and function naming conventions.
I do love ward, with its unusual non-function-naming test names, and unusual defining-functions-in-loops for parameterization. Unfortunately it's now archived, as the developer is busy at Textualize.
Maintaining it myself is probably beyond my abilities and bandwidth, so I plan to migrate some projects to pytest soon, but wanted to check if anyone can show off some fun alternative with something special to offer.
Thanks for any contribution!
/r/Python
https://redd.it/1gbxrho
If you're developing or enjoying a less popular testing framework with Python, I'd love to hear about it!
I don't love pytest, some of its complexities, tall decorator stacks, and function naming conventions.
I do love ward, with its unusual non-function-naming test names, and unusual defining-functions-in-loops for parameterization. Unfortunately it's now archived, as the developer is busy at Textualize.
Maintaining it myself is probably beyond my abilities and bandwidth, so I plan to migrate some projects to pytest soon, but wanted to check if anyone can show off some fun alternative with something special to offer.
Thanks for any contribution!
/r/Python
https://redd.it/1gbxrho
GitHub
GitHub - darrenburns/ward: Ward is a modern test framework for Python with a focus on productivity and readability.
Ward is a modern test framework for Python with a focus on productivity and readability. - darrenburns/ward
Saturday Daily Thread: Resource Request and Sharing! Daily Thread
# Weekly Thread: Resource Request and Sharing 📚
Stumbled upon a useful Python resource? Or are you looking for a guide on a specific topic? Welcome to the Resource Request and Sharing thread!
## How it Works:
1. Request: Can't find a resource on a particular topic? Ask here!
2. Share: Found something useful? Share it with the community.
3. Review: Give or get opinions on Python resources you've used.
## Guidelines:
Please include the type of resource (e.g., book, video, article) and the topic.
Always be respectful when reviewing someone else's shared resource.
## Example Shares:
1. Book: "Fluent Python" \- Great for understanding Pythonic idioms.
2. Video: Python Data Structures \- Excellent overview of Python's built-in data structures.
3. Article: Understanding Python Decorators \- A deep dive into decorators.
## Example Requests:
1. Looking for: Video tutorials on web scraping with Python.
2. Need: Book recommendations for Python machine learning.
Share the knowledge, enrich the community. Happy learning! 🌟
/r/Python
https://redd.it/1gc8ekm
# Weekly Thread: Resource Request and Sharing 📚
Stumbled upon a useful Python resource? Or are you looking for a guide on a specific topic? Welcome to the Resource Request and Sharing thread!
## How it Works:
1. Request: Can't find a resource on a particular topic? Ask here!
2. Share: Found something useful? Share it with the community.
3. Review: Give or get opinions on Python resources you've used.
## Guidelines:
Please include the type of resource (e.g., book, video, article) and the topic.
Always be respectful when reviewing someone else's shared resource.
## Example Shares:
1. Book: "Fluent Python" \- Great for understanding Pythonic idioms.
2. Video: Python Data Structures \- Excellent overview of Python's built-in data structures.
3. Article: Understanding Python Decorators \- A deep dive into decorators.
## Example Requests:
1. Looking for: Video tutorials on web scraping with Python.
2. Need: Book recommendations for Python machine learning.
Share the knowledge, enrich the community. Happy learning! 🌟
/r/Python
https://redd.it/1gc8ekm
YouTube
Data Structures and Algorithms in Python - Full Course for Beginners
A beginner-friendly introduction to common data structures (linked lists, stacks, queues, graphs) and algorithms (search, sorting, recursion, dynamic programming) in Python. This course will help you prepare for coding interviews and assessments.
🔗 Course…
🔗 Course…
one year of peer review D
My manuscript has been in peer review for 10 and half months to ieee. The last time I contacted the journal to ask about the situation, they told me that they were looking for reviewers. It's been two months since the last email. I have no response from the journal. The manuscript is still in peer review. My question is, is it normal for it to take so long? Is this a good sign that my paper will be accepted? If it were the opposite, would they not hesitate to reject it directly or is it normal for it to take so long and then reject it in the end? The paper is about natural language peocessing
/r/MachineLearning
https://redd.it/1gbzxbf
My manuscript has been in peer review for 10 and half months to ieee. The last time I contacted the journal to ask about the situation, they told me that they were looking for reviewers. It's been two months since the last email. I have no response from the journal. The manuscript is still in peer review. My question is, is it normal for it to take so long? Is this a good sign that my paper will be accepted? If it were the opposite, would they not hesitate to reject it directly or is it normal for it to take so long and then reject it in the end? The paper is about natural language peocessing
/r/MachineLearning
https://redd.it/1gbzxbf
Reddit
From the MachineLearning community on Reddit
Explore this post and more from the MachineLearning community
How do I solve this circular import error between two models ?
Here's a simplified to the maximum version of my code:
from app2.models import Model2
class Model1(models.Model):
model2 = models.OneToOneField(Model2, ondelete=models.CASCADE, null=True)
# In another app
from app1.models import Model1
class Model2(models.Model):
field1 = models.CharField(maxlength=90)
def save(self):
super().save()
objectmodel1 = Model1.objects.filter()
# Process on objectmodel1
In there, there are two models. One in each of two apps. Model1 needs to import Model2 to define a One To One relationship and Model2 needs to import Model1 because it needs to use it in its save method hence the circular import error I get. I could import Model1 in the save method of Model2 directly but I've read it is not recommended for multiple understandable reasons.
I also heard I could put the name of the model "Model2" in
/r/djangolearning
https://redd.it/1gcbct4
Here's a simplified to the maximum version of my code:
from app2.models import Model2
class Model1(models.Model):
model2 = models.OneToOneField(Model2, ondelete=models.CASCADE, null=True)
# In another app
from app1.models import Model1
class Model2(models.Model):
field1 = models.CharField(maxlength=90)
def save(self):
super().save()
objectmodel1 = Model1.objects.filter()
# Process on objectmodel1
In there, there are two models. One in each of two apps. Model1 needs to import Model2 to define a One To One relationship and Model2 needs to import Model1 because it needs to use it in its save method hence the circular import error I get. I could import Model1 in the save method of Model2 directly but I've read it is not recommended for multiple understandable reasons.
I also heard I could put the name of the model "Model2" in
/r/djangolearning
https://redd.it/1gcbct4
Reddit
From the djangolearning community on Reddit
Explore this post and more from the djangolearning community
Build a 'Chat with Wikipedia' App Using Flask and Gemini API (Demo + Code)
Hey Community,
I’m excited to share how quick and easy it is to bring your apps and ideas to life using Flask—the learning curve is really user-friendly! I recently built a "Chat with Wikipedia" app using Flask, powered by the Gemini API.
You can check out a demo on my YouTube channel (link provided in the video description), where you’ll also find the code.
Here’s a quick overview: this app lets you enter a Wikipedia page title and chat with the page to ask questions about it.
Next on my list is to develop a Chrome extension to extend this concept, making it possible to chat with any website directly.
Let me know what you think!
https://www.youtube.com/watch?v=1mxTvmpDV-I
/r/flask
https://redd.it/1gbrfs2
Hey Community,
I’m excited to share how quick and easy it is to bring your apps and ideas to life using Flask—the learning curve is really user-friendly! I recently built a "Chat with Wikipedia" app using Flask, powered by the Gemini API.
You can check out a demo on my YouTube channel (link provided in the video description), where you’ll also find the code.
Here’s a quick overview: this app lets you enter a Wikipedia page title and chat with the page to ask questions about it.
Next on my list is to develop a Chrome extension to extend this concept, making it possible to chat with any website directly.
Let me know what you think!
https://www.youtube.com/watch?v=1mxTvmpDV-I
/r/flask
https://redd.it/1gbrfs2
YouTube
🚀🤖Chat with Wikipedia Demo | Interactive AI Chatbot for Wikipedia Pages 🚀🤖
📃 YouTube Video Description:
Welcome to the Chat with Wikipedia demo! In this video, we’ll show you how to use our app to chat directly with Wikipedia using AI! 🤩 You can search for any Wikipedia page, ask questions, and get instant, interactive responses.…
Welcome to the Chat with Wikipedia demo! In this video, we’ll show you how to use our app to chat directly with Wikipedia using AI! 🤩 You can search for any Wikipedia page, ask questions, and get instant, interactive responses.…
Project Open source video indexing/labelling/tag generation tool.
Guys, I'm looking for an open source tool or any repo that can help me generate tags for video to categorize multiple videos and do further analysis.
An equivalent of what I want is Azure AI clvideo inxer, but If there was such a open source tool, it will solve the problem.
/r/MachineLearning
https://redd.it/1gccyhp
Guys, I'm looking for an open source tool or any repo that can help me generate tags for video to categorize multiple videos and do further analysis.
An equivalent of what I want is Azure AI clvideo inxer, but If there was such a open source tool, it will solve the problem.
/r/MachineLearning
https://redd.it/1gccyhp
Reddit
From the MachineLearning community on Reddit
Explore this post and more from the MachineLearning community
A fun use of itertools in gamedev
For the last 3/4 years I've been working on this game in Python/Pygame
There's a lot of puzzling mechanics and tight movements required which got me to thinking of some hazards I could put in the game.
Anyway, fast forward a bit and I have one particular hazard which you can see here:
https://i.imgur.com/swY30rB.mp4
If that hurts your head, there's a simpler "up/down" version here
https://i.imgur.com/yE7LZGa.gif
While doing these I realised it was just cycling (a very obvious clue) through a list of different vectors. Which brought me to my favourite but often-unused module...
###
When I saw this pattern I realised I could finally indulge myself and use
For those not in the know, itertools.cycle describes itself as this (paraphrased for brevity)
> Make an iterator returning elements from the iterable. Repeats indefinitely
In the first example we're just cycling through a version of a circle
[1,0, # right
0, 1, # down
-1,0, # left
0, -1
/r/Python
https://redd.it/1gch0qm
For the last 3/4 years I've been working on this game in Python/Pygame
There's a lot of puzzling mechanics and tight movements required which got me to thinking of some hazards I could put in the game.
Anyway, fast forward a bit and I have one particular hazard which you can see here:
https://i.imgur.com/swY30rB.mp4
If that hurts your head, there's a simpler "up/down" version here
https://i.imgur.com/yE7LZGa.gif
While doing these I realised it was just cycling (a very obvious clue) through a list of different vectors. Which brought me to my favourite but often-unused module...
itertools!###
itertools.cycle to the rescue!When I saw this pattern I realised I could finally indulge myself and use
itertools.cycle. I love the itertools modules but usually never get to use them in my day-to-day. For those not in the know, itertools.cycle describes itself as this (paraphrased for brevity)
> Make an iterator returning elements from the iterable. Repeats indefinitely
In the first example we're just cycling through a version of a circle
[1,0, # right
0, 1, # down
-1,0, # left
0, -1
/r/Python
https://redd.it/1gch0qm
Steampowered
Mr Figs on Steam
Mr Figs is a challenging top-down action puzzler set in the ruins that created Mr Figs. Explore, collect, and bomb your way to your birthplace and bring it to ruin!
datamule: download, parse, and construct structured datasets from SEC filings
Link: https://github.com/john-friedman/datamule-python
# What my project does
1. Download SEC filings quickly. (Bulk downloads are also available, benchmark is \~2 min/year for every 10-K/10-Q since 2001
2. Parse SEC filings quickly. (Currently only 8-K, 13F-HR Information tables are implemented. 10-K/10-Q coming next week)
3. Convert SEC textual filings directly into structured datasets.
4. Watch for new filings.
5. Has a basic tool calling chatbot with artifacts. Doesn't do anything useful yet, but was fun to make.
# Target Audience
Grad students looking to save money on expensive datasets, quants with side projects, software engineers looking to build commercial projects, and WSB people trying fun new trading strategies. In the future I'd like to make the chatbot code a bit cleaner so it can be used as a tutorial project for masters students w/ finance but not programming experience.
# Comparison
Getting SEC data in bulk is surprisingly expensive. Parsed SEC data is even more expensive. Derived datasets such as board of directors data is also expensive (something like 35k/license).
# Contribution
Greatly appreciated. Also SEC feature requests + QoL suggestions are very useful.
Links: https://github.com/john-friedman/datamule-python
/r/Python
https://redd.it/1gc7yac
Link: https://github.com/john-friedman/datamule-python
# What my project does
1. Download SEC filings quickly. (Bulk downloads are also available, benchmark is \~2 min/year for every 10-K/10-Q since 2001
2. Parse SEC filings quickly. (Currently only 8-K, 13F-HR Information tables are implemented. 10-K/10-Q coming next week)
3. Convert SEC textual filings directly into structured datasets.
4. Watch for new filings.
5. Has a basic tool calling chatbot with artifacts. Doesn't do anything useful yet, but was fun to make.
# Target Audience
Grad students looking to save money on expensive datasets, quants with side projects, software engineers looking to build commercial projects, and WSB people trying fun new trading strategies. In the future I'd like to make the chatbot code a bit cleaner so it can be used as a tutorial project for masters students w/ finance but not programming experience.
# Comparison
Getting SEC data in bulk is surprisingly expensive. Parsed SEC data is even more expensive. Derived datasets such as board of directors data is also expensive (something like 35k/license).
# Contribution
Greatly appreciated. Also SEC feature requests + QoL suggestions are very useful.
Links: https://github.com/john-friedman/datamule-python
/r/Python
https://redd.it/1gc7yac
GitHub
GitHub - john-friedman/datamule-python: A package to work with SEC data. Incorporates datamule endpoints.
A package to work with SEC data. Incorporates datamule endpoints. - john-friedman/datamule-python
I created a Django rest framework package for MFA/2FA
I'm excited to announce the release of drf-totp, a package that brings Time-Based One-Time Password (TOTP) Multi-Factor Authentication (MFA) to the Django Rest Framework.
What My Project Does
drf-totp provides a simple and secure way to add an extra layer of authentication to your API endpoints, protecting your users' accounts from unauthorized access. With this package, you can easily integrate TOTP MFA into your Django Rest Framework project, supporting popular authenticator apps like Google Authenticator and Authy.
Key Features
1. Easy integration with Django Rest Framework
2. Supports popular authenticator apps like Google Authenticator and Authy
Target Audience
drf-totp is designed for developers and teams building secure API-based applications with Django Rest Framework. This package is suitable for production environments and can be used to add an extra layer of security to existing projects or new applications.
Comparison
While there are other MFA solutions available for Django, drf-totp is specifically designed for the Django Rest Framework and provides a seamless integration experience. Unlike other solutions that may require extensive configuration or customization, drf-totp is easy to set up and use, making it an ideal choice for developers who want to add TOTP MFA to their API endpoints quickly and securely.
Check out the GitHub repo for installation instructions and example
/r/Python
https://redd.it/1gcl0hk
I'm excited to announce the release of drf-totp, a package that brings Time-Based One-Time Password (TOTP) Multi-Factor Authentication (MFA) to the Django Rest Framework.
What My Project Does
drf-totp provides a simple and secure way to add an extra layer of authentication to your API endpoints, protecting your users' accounts from unauthorized access. With this package, you can easily integrate TOTP MFA into your Django Rest Framework project, supporting popular authenticator apps like Google Authenticator and Authy.
Key Features
1. Easy integration with Django Rest Framework
2. Supports popular authenticator apps like Google Authenticator and Authy
Target Audience
drf-totp is designed for developers and teams building secure API-based applications with Django Rest Framework. This package is suitable for production environments and can be used to add an extra layer of security to existing projects or new applications.
Comparison
While there are other MFA solutions available for Django, drf-totp is specifically designed for the Django Rest Framework and provides a seamless integration experience. Unlike other solutions that may require extensive configuration or customization, drf-totp is easy to set up and use, making it an ideal choice for developers who want to add TOTP MFA to their API endpoints quickly and securely.
Check out the GitHub repo for installation instructions and example
/r/Python
https://redd.it/1gcl0hk
Reddit
From the Python community on Reddit: I created a Django rest framework package for MFA/2FA
Explore this post and more from the Python community
Every unicode character can be a variable name in globals and locals
Hello. Reading about walrus operator I've seen φ used as a variable. That defied my knowledge (_, a-z, A-Z, 0-9), and I thought "if φ is valid, why 🍆 isn't?".
After a bit of try, I've come up with this.
initial = 127810
for i in range(10):
variable = chr(initial + i)
locals()variable = f"Value of {variable} is {ord(variable)}"
print(locals().get("🍆"))
Getting
Value of 🍆 is 127814
Therefore, 🍆 can be a variable in Python (in globals and locals). But also horizontal tab, backspace, null character, ... can be. Of course, they are not accessible in the code the same way than φ or hello_world, but still it's a nice gimmick. I hope you find it fun and/or useful.
But now the real thing. In this context, do you know if using backspace or null as a variable in globals could break the program in execution time? Thank you.
/r/Python
https://redd.it/1gc2gmg
Hello. Reading about walrus operator I've seen φ used as a variable. That defied my knowledge (_, a-z, A-Z, 0-9), and I thought "if φ is valid, why 🍆 isn't?".
After a bit of try, I've come up with this.
initial = 127810
for i in range(10):
variable = chr(initial + i)
locals()variable = f"Value of {variable} is {ord(variable)}"
print(locals().get("🍆"))
Getting
Value of 🍆 is 127814
Therefore, 🍆 can be a variable in Python (in globals and locals). But also horizontal tab, backspace, null character, ... can be. Of course, they are not accessible in the code the same way than φ or hello_world, but still it's a nice gimmick. I hope you find it fun and/or useful.
But now the real thing. In this context, do you know if using backspace or null as a variable in globals could break the program in execution time? Thank you.
/r/Python
https://redd.it/1gc2gmg
Realpython
The Walrus Operator: Python's Assignment Expressions – Real Python
In this tutorial, you'll learn about assignment expressions and the walrus operator. The biggest change back in Python 3.8 was the inclusion of the := operator, which you can use to assign variables in the middle of expressions. You'll see several examples…
Hosting my Flask application - selecting a provider?
I'm currently looking to host my Flask application that is completely finished and just needs to go online, but as it is my first project that is actually going online I'm looking for some guidance with selecting a provider.
The app is a statistics application that I built for a company. It's a fairly basic Flask application with upwards of 8 .py scripts, a .json dataset and and some web templates, images and .css files. Everything is running smoothly and perfectly on the built-in development server, so I'm hoping it will continue to do so once hosted properly.
Security is a concern (if that matters when it comes to selecting the provider) as the application uses developer keys and some other credentials (that I've done all I can to secure within the app itself). I will need to install a log-in system of some sort so if any provider can make that easy that would be a major advantage.
Hoping for some pointers or just to hear some experiences with different providers - and thanks in advance :-)
T
/r/flask
https://redd.it/1gay069
I'm currently looking to host my Flask application that is completely finished and just needs to go online, but as it is my first project that is actually going online I'm looking for some guidance with selecting a provider.
The app is a statistics application that I built for a company. It's a fairly basic Flask application with upwards of 8 .py scripts, a .json dataset and and some web templates, images and .css files. Everything is running smoothly and perfectly on the built-in development server, so I'm hoping it will continue to do so once hosted properly.
Security is a concern (if that matters when it comes to selecting the provider) as the application uses developer keys and some other credentials (that I've done all I can to secure within the app itself). I will need to install a log-in system of some sort so if any provider can make that easy that would be a major advantage.
Hoping for some pointers or just to hear some experiences with different providers - and thanks in advance :-)
T
/r/flask
https://redd.it/1gay069
Reddit
From the flask community on Reddit
Explore this post and more from the flask community
P Shape-restricted regression with neural networks
Some time ago at work we had to enforce that our model learns an increasing function of a feature. For example, the probability of winning an auction as a function of the bid should increase. Recently, I encountered the paper https://arxiv.org/abs/2209.04476 on regression with shape-restricted functions, and wanted to make it a bit more tangible, with actual code that trains such a model.
So it resulted in a blog post: https://alexshtf.github.io/2024/10/14/Shape-Restricted-Models.html
There's also a notebook with the accompanying code: https://github.com/alexshtf/alexshtf.github.io/blob/master/assets/shape\_constrained\_models.ipynb
I used to work on ads quite a lot .So such models seem useful in this industry - predicting the probability of winning an ad auction given the bid. I hope it's also useful elsewhere.
So I hope you'll enjoy it! It's a big 'mathy', but you know, it can't be otherwise.
/r/MachineLearning
https://redd.it/1gcpl03
Some time ago at work we had to enforce that our model learns an increasing function of a feature. For example, the probability of winning an auction as a function of the bid should increase. Recently, I encountered the paper https://arxiv.org/abs/2209.04476 on regression with shape-restricted functions, and wanted to make it a bit more tangible, with actual code that trains such a model.
So it resulted in a blog post: https://alexshtf.github.io/2024/10/14/Shape-Restricted-Models.html
There's also a notebook with the accompanying code: https://github.com/alexshtf/alexshtf.github.io/blob/master/assets/shape\_constrained\_models.ipynb
I used to work on ads quite a lot .So such models seem useful in this industry - predicting the probability of winning an ad auction given the bid. I hope it's also useful elsewhere.
So I hope you'll enjoy it! It's a big 'mathy', but you know, it can't be otherwise.
/r/MachineLearning
https://redd.it/1gcpl03
arXiv.org
Shape-constrained Estimation in Functional Regression with...
Shape restrictions on functional regression coefficients such as non-negativity, monotonicity, convexity or concavity are often available in the form of a prior knowledge or required to maintain a...
Why my Django Administration page looks like this
https://preview.redd.it/zq6i8sq825xd1.png?width=1920&format=png&auto=webp&s=accd043c3df996c0e52d4a4f380ff86063c72cab
/r/django
https://redd.it/1gcqq5d
https://preview.redd.it/zq6i8sq825xd1.png?width=1920&format=png&auto=webp&s=accd043c3df996c0e52d4a4f380ff86063c72cab
/r/django
https://redd.it/1gcqq5d