Wakatime with Jupyter (Not in VSCode)
I can see that in wakatime’s leader boards you can sort by “Jupyter”. But I can’t seem to figure out how Wakatime tracks Jupyter if I use Jupyter on a local server outside of VSCode. Any tips?
/r/JupyterNotebooks
https://redd.it/12hnesp
I can see that in wakatime’s leader boards you can sort by “Jupyter”. But I can’t seem to figure out how Wakatime tracks Jupyter if I use Jupyter on a local server outside of VSCode. Any tips?
/r/JupyterNotebooks
https://redd.it/12hnesp
Reddit
r/JupyterNotebooks on Reddit: Wakatime with Jupyter (Not in VSCode)
Posted by u/Normanras - 1 vote and no comments
Introducing Markdown Code Runner: Automatically execute code blocks in your Markdown files! 🚀
Hey r/Python!
I recently developed a Python package called Markdown Code Runner (
GitHub Repository: https://github.com/basnijholt/markdown-code-runner
Key Features:
- Automatically execute code blocks, including hidden code blocks, within a Markdown file
- Allows hidden code blocks to generate content like tables, plots, etc.
- Works with Python and Bash code blocks
- Keeps the output of the code blocks up-to-date
- Easily integrates with GitHub Actions
- No external dependencies and works with Python 3.7+
Why Markdown Code Runner?
When creating Markdown files with code examples, it's essential to keep the output of these code snippets accurate and up-to-date. Manually updating the output can be time-consuming and error-prone, especially when working with large files or multiple collaborators. In addition, there might be cases where hidden code blocks are needed to generate content such as tables, plots, and other visualizations without displaying the code itself in the Markdown file.
/r/Python
https://redd.it/12iupj2
Hey r/Python!
I recently developed a Python package called Markdown Code Runner (
markdown-code-runner) that allows you to automatically execute code blocks within a Markdown file, including hidden code blocks, and updates the output in-place. This can be super useful for maintaining Markdown files with embedded code snippets, ensuring that the output displayed is always up-to-date and accurate. It also enables generating content like tables, plots, and other visualizations directly from the code.GitHub Repository: https://github.com/basnijholt/markdown-code-runner
Key Features:
- Automatically execute code blocks, including hidden code blocks, within a Markdown file
- Allows hidden code blocks to generate content like tables, plots, etc.
- Works with Python and Bash code blocks
- Keeps the output of the code blocks up-to-date
- Easily integrates with GitHub Actions
- No external dependencies and works with Python 3.7+
Why Markdown Code Runner?
When creating Markdown files with code examples, it's essential to keep the output of these code snippets accurate and up-to-date. Manually updating the output can be time-consuming and error-prone, especially when working with large files or multiple collaborators. In addition, there might be cases where hidden code blocks are needed to generate content such as tables, plots, and other visualizations without displaying the code itself in the Markdown file.
markdown-code-runner solves this problem by/r/Python
https://redd.it/12iupj2
GitHub
GitHub - basnijholt/markdown-code-runner: Automatically execute code blocks within a Markdown file and update the output in-place
Automatically execute code blocks within a Markdown file and update the output in-place - basnijholt/markdown-code-runner
New release of FastKafka improves testability
We were searching for something like FastAPI for Kafka-based service we were developing, but couldn’t find anything similar. So we shamelessly made one by reusing beloved paradigms from FastAPI and we shamelessly named it FastKafka. The point was to set the expectations right - you get pretty much what you would expect: function decorators for consumers and producers with type hints specifying Pydantic classes for JSON encoding/decoding, automatic message routing to Kafka brokers and documentation generation.
https://github.com/airtai/fastkafka
The new release adds in-memory Kafka broker that can be used for testing without the need to install Java and start a broker. It allows you to write a simple-to-understand tests such as this one:
/r/Python
https://redd.it/12isl07
We were searching for something like FastAPI for Kafka-based service we were developing, but couldn’t find anything similar. So we shamelessly made one by reusing beloved paradigms from FastAPI and we shamelessly named it FastKafka. The point was to set the expectations right - you get pretty much what you would expect: function decorators for consumers and producers with type hints specifying Pydantic classes for JSON encoding/decoding, automatic message routing to Kafka brokers and documentation generation.
https://github.com/airtai/fastkafka
The new release adds in-memory Kafka broker that can be used for testing without the need to install Java and start a broker. It allows you to write a simple-to-understand tests such as this one:
from fastkafka.testing import Tester
msg = IrisInputData(
sepal_length=0.1,
sepal_width=0.2,
petal_length=0.3,
petal_width=0.4,
)
# Start Tester app and create InMemory Kafka broker for testing
async with Tester(kafka_app) as tester:
# Send IrisInputData message to input_data topic
await tester.to_input_data(msg)
# Assert that the kafka_app responded with IrisPrediction in predictions topic
await tester.awaited_mocks.on_predictions.assert_awaited_with(
IrisPrediction(species="setosa"), timeout=2
)
/r/Python
https://redd.it/12isl07
GitHub
GitHub - airtai/fastkafka: FastKafka is a powerful and easy-to-use Python library for building asynchronous web services that interact…
FastKafka is a powerful and easy-to-use Python library for building asynchronous web services that interact with Kafka topics. Built on top of Pydantic, AIOKafka and AsyncAPI, FastKafka simplifies ...
I used Python to make a BizBuySell web scraper to get businesses for sale in a given state. I used aiohttp to fetch requests asynchronously. The code has a rate limiter as well!
Hey friends! Back again with another python web scraping project.
A founder reached out to me to know if it was possible to scrape BizBuySell for businesses for sale in a specific state. They needed the data for business development. I never scraped this site so I was up for a new challenge.
At first I ran into issues with bot blocking. They use Akamai CDN. However, with a bit more research, I managed to get the data. The site was not too difficult compared to others. No dynamic javascript which means no need to use selenium. I only fetched the first 12 pages to keep the demo short. Happy to answer any web scraping questions.
Youtube demo: How to scrape BizBuySell with Python
Source code on Github: How to scrape BizBuySell with python
/r/Python
https://redd.it/12ixw47
Hey friends! Back again with another python web scraping project.
A founder reached out to me to know if it was possible to scrape BizBuySell for businesses for sale in a specific state. They needed the data for business development. I never scraped this site so I was up for a new challenge.
At first I ran into issues with bot blocking. They use Akamai CDN. However, with a bit more research, I managed to get the data. The site was not too difficult compared to others. No dynamic javascript which means no need to use selenium. I only fetched the first 12 pages to keep the demo short. Happy to answer any web scraping questions.
Youtube demo: How to scrape BizBuySell with Python
Source code on Github: How to scrape BizBuySell with python
/r/Python
https://redd.it/12ixw47
YouTube
I made a web scraper to get all businesses for sale on BizBuySell with Python and aiohttp
Hey friends! Back again with another python web scraping project.
A founder reached out to me to know if it was possible to scrape BizBuySell for businesses for sale in a specific state. They needed the data for business development.
At first I ran into…
A founder reached out to me to know if it was possible to scrape BizBuySell for businesses for sale in a specific state. They needed the data for business development.
At first I ran into…
Nested LDAP groups for Flask not working
Hello!
I am currently using flask_appbuilder.security.manager in order to provide LDAP authentication for my Airflow instance(Version 2.5.0) . When doing the AUTH_ROLES_MAPPING
I have noticed that it only works for direct members of the active directory groups I am calling out. Has anyone been able to get this to work for nested groups?
Example:
in my current set up
AUTH_ROLES_MAPPING =
User A: member of ADMINACTIVEDIRECTORYGROUP
User B: member of ROLEGROUP which is a member of ADMINACTIVEDIRECTORYGROUP
Only User A would be able to login to my airflow instance as Admin since flask is not recognizing nested group membership
I have tried multiple variations of
member:1.2.840.113556.1.4.1941:=
memberof:1.2.840.113556.1.4.1941:=
to no avail.
Thank you for the help or insight if others have gotten nested AD groups working. This would be extremely helpful.
/r/flask
https://redd.it/12ipw2z
Hello!
I am currently using flask_appbuilder.security.manager in order to provide LDAP authentication for my Airflow instance(Version 2.5.0) . When doing the AUTH_ROLES_MAPPING
I have noticed that it only works for direct members of the active directory groups I am calling out. Has anyone been able to get this to work for nested groups?
Example:
in my current set up
AUTH_ROLES_MAPPING =
{"CN=ADMINACTIVEDIRECTORYGROUP,OU=ResourceAirflow,OU=ResourceGroups,OU=!!sample,DC=sample,DC=sample" : ["admin"]User A: member of ADMINACTIVEDIRECTORYGROUP
User B: member of ROLEGROUP which is a member of ADMINACTIVEDIRECTORYGROUP
Only User A would be able to login to my airflow instance as Admin since flask is not recognizing nested group membership
I have tried multiple variations of
member:1.2.840.113556.1.4.1941:=
memberof:1.2.840.113556.1.4.1941:=
to no avail.
Thank you for the help or insight if others have gotten nested AD groups working. This would be extremely helpful.
/r/flask
https://redd.it/12ipw2z
Reddit
r/flask on Reddit: Nested LDAP groups for Flask not working
Posted by u/No_Wasabi2200 - 5 votes and 2 comments
Wednesday Daily Thread: Beginner questions
New to Python and have questions? Use this thread to ask anything about Python, there are no bad questions!
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 where you stand a better chance of receiving a response.
/r/Python
https://redd.it/12j2rz4
New to Python and have questions? Use this thread to ask anything about Python, there are no bad questions!
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 where you stand a better chance of receiving a response.
/r/Python
https://redd.it/12j2rz4
Discord
Join the Python Discord Server!
We're a large community focused around the Python programming language. We believe that anyone can learn to code. | 412982 members
If you're a beginner interested in data science and machine learning, I recently produced a video series that goes through all of the major algorithms and their implementations in Python! I put a lot of work into each tutorial, so hopefully this helps out!
https://www.youtube.com/playlist?list=PLvICEeb-TZEHKkojcv1_POKPrCwlsEnsI
/r/Python
https://redd.it/12j68f7
https://www.youtube.com/playlist?list=PLvICEeb-TZEHKkojcv1_POKPrCwlsEnsI
/r/Python
https://redd.it/12j68f7
Reddit
r/Python on Reddit: If you're a beginner interested in data science and machine learning, I recently produced a video series that…
Posted by u/RohakJain - 105 votes and 8 comments
Python Magic: How to do Screen Recording of a specific window and save it as animated GIF: Code included
Check this out!
https://medium.com/@neonforge/python-magic-how-to-do-screen-recording-of-a-specific-window-and-save-it-as-animated-gif-code-db8406f9aafd
/r/Python
https://redd.it/12j7hci
Check this out!
https://medium.com/@neonforge/python-magic-how-to-do-screen-recording-of-a-specific-window-and-save-it-as-animated-gif-code-db8406f9aafd
/r/Python
https://redd.it/12j7hci
Medium
Python Magic: How to do Screen Recording of a specific window and save it as animated GIF: Code included
Ah, technology! Don’t you just love it when you discover a new trick that makes your life a little bit easier? I know I do. So, let me…
Django Postgresql
django.db.utils.DataError: value too long for type character varying(7)
Since this error shows
I changed charfield max length value
But also couldn't debug it
What could be the solution??
/r/djangolearning
https://redd.it/12jdguq
django.db.utils.DataError: value too long for type character varying(7)
Since this error shows
I changed charfield max length value
But also couldn't debug it
What could be the solution??
/r/djangolearning
https://redd.it/12jdguq
Reddit
r/djangolearning on Reddit: Django Postgresql
Posted by u/suraj2501 - 1 vote and 3 comments
PSF expresses concerns about a proposed EU law that may make it impossible to continue providing Python and PyPI to the European public
https://pyfound.blogspot.com/2023/04/the-eus-proposed-cra-law-may-have.html
/r/Python
https://redd.it/12jbj6v
https://pyfound.blogspot.com/2023/04/the-eus-proposed-cra-law-may-have.html
/r/Python
https://redd.it/12jbj6v
Python Software Foundation Blog
The EU's Proposed CRA Law May Have Unintended Consequences for the Python Ecosystem
After reviewing the proposed Cyber Resilience Act and Product Liability Act , the PSF has found issues that put the mission of our organizat...
What are the possible ways to integrate react and django ?
I was looking through the internet and found django rest framework Web api. What are the other possible options for a large scale enterprise app?
/r/django
https://redd.it/12jghzi
I was looking through the internet and found django rest framework Web api. What are the other possible options for a large scale enterprise app?
/r/django
https://redd.it/12jghzi
Reddit
r/django on Reddit: What are the possible ways to integrate react and django ?
Posted by u/binge_redditor - 4 votes and 7 comments
🚀 Introducing GoRules: Open-Source Business Rules Engine
Hi r/Python,
We've recently developed and published an open-source business rules engine in Rust with native bindings for Python and Node.js. We're excited to share a new blog that describes serverless deployment using AWS S3 and Lambda. You can find it here: [https://gorules.io/blog/python-rules-engine-lambda](https://gorules.io/blog/python-rules-engine-lambda).
**What is GoRules?**
[GoRules](https://gorules.io) is a modern, open-source rules engine designed for high performance and scalability. Our mission is to democratise rules engines and drive early adoption. Rules engines are very useful as they allow business users to easily understand and modify core business logic with little help from developers. You can think of us as a modern, less memory-hungry version of [Drools](https://drools.org/) that will be available in many languages and on many platforms. We prioritise:
* High performance: You can execute thousands of decisions in a second
* Ease of use: We are obsessed with making the best experience for business users
* Flexible deployment: GoRules can be deployed on-premise, in serverless environments or embedded in existing service(s)
**Community**
We are very keen on listening to the community for suggestions and any issues you may face. Feel free to open issues and discuss them below if you have found the project to be useful or are excited about it.
**Relevant Links**
GitHub Repository: [https://github.com/gorules/zen](https://github.com/gorules/zen) (if you
/r/Python
https://redd.it/12je354
Hi r/Python,
We've recently developed and published an open-source business rules engine in Rust with native bindings for Python and Node.js. We're excited to share a new blog that describes serverless deployment using AWS S3 and Lambda. You can find it here: [https://gorules.io/blog/python-rules-engine-lambda](https://gorules.io/blog/python-rules-engine-lambda).
**What is GoRules?**
[GoRules](https://gorules.io) is a modern, open-source rules engine designed for high performance and scalability. Our mission is to democratise rules engines and drive early adoption. Rules engines are very useful as they allow business users to easily understand and modify core business logic with little help from developers. You can think of us as a modern, less memory-hungry version of [Drools](https://drools.org/) that will be available in many languages and on many platforms. We prioritise:
* High performance: You can execute thousands of decisions in a second
* Ease of use: We are obsessed with making the best experience for business users
* Flexible deployment: GoRules can be deployed on-premise, in serverless environments or embedded in existing service(s)
**Community**
We are very keen on listening to the community for suggestions and any issues you may face. Feel free to open issues and discuss them below if you have found the project to be useful or are excited about it.
**Relevant Links**
GitHub Repository: [https://github.com/gorules/zen](https://github.com/gorules/zen) (if you
/r/Python
https://redd.it/12je354
gorules.io
Building Python Rules Engine: Lambda and S3
Learn how to deploy and utilize a serverless rules engine.
Anyone using database-as-s-service with Django?
For my passion projects I have access to some simple SQL servers through friends, this served me allright in the past. However I had to do everything (security, backups, updates) myself.
I'm now working on a more serious project and I rather don't 'mess' with a database. So I looked for a DBAAS, and found PlanetScale to integrate with Django very easily. It allows me to have the database in the same AWS Datacenter as my app, it takes care of backups even branching and (as long as I pay) I get infinite scaling. For now I'm even getting by on their free tier, so whats the catch? Why ware we still running our own SQL?
I wonder: has anyone of you used Planetscale or any other database as a service tools? I view the costs rather pragmatic: I'm doing this project with just 1 friend, and I rather pay for a managed service. As it's cheaper than me hiring someone who actually knows his shit in regards to databases.
/r/django
https://redd.it/12jkapl
For my passion projects I have access to some simple SQL servers through friends, this served me allright in the past. However I had to do everything (security, backups, updates) myself.
I'm now working on a more serious project and I rather don't 'mess' with a database. So I looked for a DBAAS, and found PlanetScale to integrate with Django very easily. It allows me to have the database in the same AWS Datacenter as my app, it takes care of backups even branching and (as long as I pay) I get infinite scaling. For now I'm even getting by on their free tier, so whats the catch? Why ware we still running our own SQL?
I wonder: has anyone of you used Planetscale or any other database as a service tools? I view the costs rather pragmatic: I'm doing this project with just 1 friend, and I rather pay for a managed service. As it's cheaper than me hiring someone who actually knows his shit in regards to databases.
/r/django
https://redd.it/12jkapl
Reddit
r/django on Reddit: Anyone using database-as-s-service with Django?
Posted by u/Human-Possession135 - 7 votes and 5 comments
Help with storing data from back end to frontend
Hi guys, so basically I've made a web application and have completed most of the back-end. However, I'm now stuck on an element of the web application. I have a page on my web app that users can input information into and the back end does calculations and provides the user a summary based on the input.
I would like this summary to be permanently stored in a 'Reports' page in the web app so users can scroll through their summaries. How would I do this?
/r/django
https://redd.it/12jvfen
Hi guys, so basically I've made a web application and have completed most of the back-end. However, I'm now stuck on an element of the web application. I have a page on my web app that users can input information into and the back end does calculations and provides the user a summary based on the input.
I would like this summary to be permanently stored in a 'Reports' page in the web app so users can scroll through their summaries. How would I do this?
/r/django
https://redd.it/12jvfen
Reddit
r/django on Reddit: Help with storing data from back end to frontend
Posted by u/ReekoSWE - No votes and 2 comments
Flask-Session prevent session fixation attack
Hi im developing a web application and trying to make it not vulnerable to session fixation attacks (https://owasp.org/www-community/attacks/Session\_fixation) to prevent this i need to clear the session id when an user logins and assign a new one. I expected i would be able to to it using the same session.clear() that is used at logout but it doesnt seem to work when using it to log in.
​
# LOGIN PAGE
@app.route("/myapp/login", methods=['GET', 'POST'])
def login():
if request.method == 'GET':
return rendertemplate("login.html")
if request.method == 'POST':
args = request.form
if auth(args"username", args"password"):
session.clear()
session"user" = {}
session.get("user")"name" = args"username"
/r/flask
https://redd.it/12jgne0
Hi im developing a web application and trying to make it not vulnerable to session fixation attacks (https://owasp.org/www-community/attacks/Session\_fixation) to prevent this i need to clear the session id when an user logins and assign a new one. I expected i would be able to to it using the same session.clear() that is used at logout but it doesnt seem to work when using it to log in.
​
# LOGIN PAGE
@app.route("/myapp/login", methods=['GET', 'POST'])
def login():
if request.method == 'GET':
return rendertemplate("login.html")
if request.method == 'POST':
args = request.form
if auth(args"username", args"password"):
session.clear()
session"user" = {}
session.get("user")"name" = args"username"
/r/flask
https://redd.it/12jgne0
owasp.org
Session fixation | OWASP Foundation
Session fixation on the main website for The OWASP Foundation. OWASP is a nonprofit foundation that works to improve the security of software.
Why we dropped Docker for Python environments
TL;DR Docker is a great tool for managing software environments, but we found that it’s just too slow, especially for exploratory data workflows where users change their Python environments frequently.
We find that clusters depending on docker images often take 5+ minutes to launch. Ouch. In Coiled you can use a new system for creating software environments on the fly using only mamba instead. We’re seeing start times 3x faster, or about 1–2 minutes.
This article goes into the challenges we (Coiled) faced, the solution we chose, and the performance impacts of that choice.
https://medium.com/coiled-hq/just-in-time-python-environments-ade108ec67b6
/r/Python
https://redd.it/12jojj7
TL;DR Docker is a great tool for managing software environments, but we found that it’s just too slow, especially for exploratory data workflows where users change their Python environments frequently.
We find that clusters depending on docker images often take 5+ minutes to launch. Ouch. In Coiled you can use a new system for creating software environments on the fly using only mamba instead. We’re seeing start times 3x faster, or about 1–2 minutes.
This article goes into the challenges we (Coiled) faced, the solution we chose, and the performance impacts of that choice.
https://medium.com/coiled-hq/just-in-time-python-environments-ade108ec67b6
/r/Python
https://redd.it/12jojj7
Medium
Just in time Python environments
Authors: Samantha Hughes and Sarah Johnson
Thursday Daily Thread: Python Careers, Courses, and Furthering Education!
Discussion of using Python in a professional environment, getting jobs in Python as well as ask questions about courses to further your python education!
This thread is not for recruitment, please see r/PythonJobs or the thread in the sidebar for that.
/r/Python
https://redd.it/12k4o7f
Discussion of using Python in a professional environment, getting jobs in Python as well as ask questions about courses to further your python education!
This thread is not for recruitment, please see r/PythonJobs or the thread in the sidebar for that.
/r/Python
https://redd.it/12k4o7f
Reddit
r/Python on Reddit: Thursday Daily Thread: Python Careers, Courses, and Furthering Education!
Posted by u/Im__Joseph - 4 votes and no comments
A Python package written in Rust for email verification without sending any emails.
Hello everyone, I just released this package that allows for email verification without actually sending any emails.
check it out here.
https://github.com/Mng-dev-ai/pyrustify
/r/Python
https://redd.it/12k5uba
Hello everyone, I just released this package that allows for email verification without actually sending any emails.
check it out here.
https://github.com/Mng-dev-ai/pyrustify
/r/Python
https://redd.it/12k5uba
GitHub
GitHub - Mng-dev-ai/pyrustify: A Python package written in Rust for email verification without sending any emails.
A Python package written in Rust for email verification without sending any emails. - GitHub - Mng-dev-ai/pyrustify: A Python package written in Rust for email verification without sending any emails.
Large-Scale Datamining & Built a Reddit Bot for r/boardgames to reply with BGG Links
Disclaimer: I am in no way affiliated with BoardGameGeek aside from being a user of the site.
I was inspired by u/MTGCardFetcher who replies on the Magic: The Gathering subreddits with links to the card images and text when called with a card name in double brackets. I've often found myself replying to a thread on r/boardgames with the name of a game (or, more appropriately, reading others' suggestions) without a link, making it slightly more annoying to look the game up.
As a result, I built two Python scripts - one to discover the game pages on BoardGameGeek.com and extract the game name and year and another to serve as the reddit bot.
I'm used to crawling sites using Screaming Frog and had fully intended to use it to pull the game names and other details out, but it turns out BoardGameGeek uses a degree of client-side rendering, making a non-rendered request fall short of extracting data. My solution was to use Selenium to hit the pages, wait for
/r/Python
https://redd.it/12k5yfb
Disclaimer: I am in no way affiliated with BoardGameGeek aside from being a user of the site.
I was inspired by u/MTGCardFetcher who replies on the Magic: The Gathering subreddits with links to the card images and text when called with a card name in double brackets. I've often found myself replying to a thread on r/boardgames with the name of a game (or, more appropriately, reading others' suggestions) without a link, making it slightly more annoying to look the game up.
As a result, I built two Python scripts - one to discover the game pages on BoardGameGeek.com and extract the game name and year and another to serve as the reddit bot.
I'm used to crawling sites using Screaming Frog and had fully intended to use it to pull the game names and other details out, but it turns out BoardGameGeek uses a degree of client-side rendering, making a non-rendered request fall short of extracting data. My solution was to use Selenium to hit the pages, wait for
//h1/a to be discoverable, then extract the text. At the time of writing this, there are just over 174,000 board game and board game expansion pages on BoardGameGeek. It took several full days/r/Python
https://redd.it/12k5yfb
Boardgamegeek
The definitive source for board game and card game content. Find millions of ratings, reviews, videos, photos, and more from our community of experts.