Last week, two versions of litellm package (3.4M downloads/day) contains malicious code due to previous compromise of maintainer's PyPI credentials.
This seems as a cool trick to be less vulnerable to such attacks (found on LinkedIn / Hacker news) ๐
I just discovered Behind the Commit podcast! ๐ง (hosted by Mia Bajiฤ ๐๏ธ)
First two episodes feature Python release managers Hugo van Kemenade (3.14&3.15), Pablo Galindo Salgado (3.10&3.11), ลukasz Langa (3.8&3.9)
and
FastAPI creator Sebastiรกn Ramรญrez
https://t.co/zeV1KbKUbH
I once told at a conference dinner: "Iโve got a PhD, but 90% of my work is just applying @fastdotai stuff"
A senior researcher nodded: "Same" ๐
So when the new course dropped, I needed ~60s to subscribe (2-wk refund)
https://t.co/HFTjy6uJ7f
15% off (and yes, I get 15% too)
@heysoymarvin Not quite the same! With this approach you can import your Django models, run queries on your local DB or use other functions of your app
from myapp.models import User User.objects.filter(created__gte='2024-01-01').count()
Try doing that in Colab ๐ (Otherwise, I โค๏ธ Colab)
Need pandas + Jupyter for quick analysis but don't want them in your production dependencies?
uv run --with pandas --with jupyter jupyter lab
One command. Zero environment pollution. โจ
#uv#jupyter#DevTips
Two Python gems Iโve been playing with:
๐ Tenacity โ painless retry logic for anything. No more rolling your own loops + sleeps
https://t.co/2uB7TzHYah
โก DumPy โ a bold rethink of NumPy: โdonโt make me think, just run (fast, on GPUs)โ
https://t.co/eZmy0S8akM
Both worth a ๐
Today I learned... `uv init` now not only creates a new Python environment but also creates
โโโ .gitignore
โโโ https://t.co/5YvRzH2H49
โโโ https://t.co/QnZWl1sVHO
โโโ pyproject.toml
โโโ .python-version
https://t.co/RB8U6HQOO6
marimo = Jupyter for serious Python work ๐ฅ
- Pure .py files (git-friendly!)
- No more restart & run all
- Deploy as scripts OR interactive web apps
- Built-in SQL support
- Reactive cells that auto-update dependencies
https://t.co/9wEcj8Qt3E
When I started with Python, I was confused by the murky difference between variables and references. ๐ค
This ๐ explains it brilliantly:
Why Python has No Variables?
https://t.co/2CvDPJBnVW
If you want to automatically scrape a website with Python, use `autoscraper` ๐ก
Its almost magical ๐ช - Instead of writing the scraping logic manually, you provide a few sample values you'd like to scrape, and `autoscraper` will deduce the scraping rules for you.
It learns the scraping rules and returns the similar elements. Then you can use this learned object with new urls to get similar content or the exact same element of those new pages.
`autoscraper` doesn't require detailed XPath or CSS selectors like traditional scraping libraries. Instead, it automates the pattern recognition process by learning from the example you provide.
Let's design an example where we'll scrape the latest headlines from a popular news website. (Disclaimer: Make sure you have the legal right to scrape the desired website; scraping some sites might be against their terms of service).
Suppose we want to scrape the latest headlines from "BBC News" (for demonstration purposes only).
Remember to replace the "BBC News headline example" with an actual headline from the BBC News page so that the model can learn from it. After running the script, you should see a list of scraped headlines.
Automate your virtualenv activation!
Using autoenv (https://t.co/Mi9JZLp2J0), you can:
1. Automatically activate virtualenv when entering a directory
2. Run ANY command when cd-ing into a folder
Example:
# Set up autoenv
echo "source venv/bin/activate" > .env
# Or run custom commands
echo "echo 'Project: $(pwd)'" >> .env
cd ./project # Triggers .env automatically! ๐ช
AI is changing how we code, but should it change how we teach Python? I've embraced LLMs for coding, especially with pandas, but I'm unsure if beginners should start this way.
Anyway, curious about the AI way? Try Andrew Ng's 'AI Python for Beginners': https://t.co/KiPiw4QOyV
"Tired of scrolling through Jupyter notebooks on GitHub? Try https://t.co/YRPCps1rn7:
๐ Just replace 'github' with 'nbsanity' in the URL to get much cleaner view
๐ For example https://t.co/8jDQNWiOhh
#JupyterNotebook
#EuroPython2024 videos are live! ๐บ My top 3 ML talks:
1) "From Text to Context..." about combining semantic & traditional search
https://t.co/NB0x4BuGDw
2) "Scikit-LLM..." because of beginner-friendly NLP with dynamic few-shots
https://t.co/3pmOVpa2yf
3) "Representation is King": quality dialog embeddings by Adam Zika
https://t.co/iGY17UAJ76