Using the UV hashbang and a few doc strings for dependencies so you can run full on python scripts as executables is fucking crack.
Python
Welcome to the Python community on the programming.dev Lemmy instance!
π Events
Past
November 2023
- PyCon Ireland 2023, 11-12th
- PyData Tel Aviv 2023 14th
October 2023
- PyConES Canarias 2023, 6-8th
- DjangoCon US 2023, 16-20th (!django π¬)
July 2023
- PyDelhi Meetup, 2nd
- PyCon Israel, 4-5th
- DFW Pythoneers, 6th
- Django Girls Abraka, 6-7th
- SciPy 2023 10-16th, Austin
- IndyPy, 11th
- Leipzig Python User Group, 11th
- Austin Python, 12th
- EuroPython 2023, 17-23rd
- Austin Python: Evening of Coding, 18th
- PyHEP.dev 2023 - "Python in HEP" Developer's Workshop, 25th
August 2023
- PyLadies Dublin, 15th
- EuroSciPy 2023, 14-18th
September 2023
- PyData Amsterdam, 14-16th
- PyCon UK, 22nd - 25th
π Python project:
- Python
- Documentation
- News & Blog
- Python Planet blog aggregator
π Python Community:
- #python IRC for general questions
- #python-dev IRC for CPython developers
- PySlackers Slack channel
- Python Discord server
- Python Weekly newsletters
- Mailing lists
- Forum
β¨ Python Ecosystem:
π Fediverse
Communities
- #python on Mastodon
- c/django on programming.dev
- c/pythorhead on lemmy.dbzer0.com
Projects
- PythΓΆrhead: a Python library for interacting with Lemmy
- Plemmy: a Python package for accessing the Lemmy API
- pylemmy pylemmy enables simple access to Lemmy's API with Python
- mastodon.py, a Python wrapper for the Mastodon API
Feeds
I have an idea of what this might look like, but do you have any examples I can crib from?
This article looks like it explains the process:
https://mathspp.com/blog/til/standalone-executable-python-scripts-with-uv
Cool. But for God's sake don't run python code from the internet, that's such a huge security risk,
Dont worry, I just vibe run it.
Thank you, this goes to the top of my reading pile for tomorrow! We've been doing a lot of uv conversions at work and I have a specific personal use for this as well
Does it allow differentiating between dependencies and dev dependencies though? I couldn't gather that from the article.
it does, I use it every day
this is the standard https://packaging.python.org/en/latest/specifications/dependency-groups/
UV has a shitload of features. I've only ever really used it for making virtualemvs for easier cross platform compatibility, but even just for that, there's tons of options related to which packages, from where, etc.
tl:dr probably, although differentiating between "deploy" and "dev" installs is the task of the package config which UV doesn't (to my knowledge) replace in any way.
wreck can. It's venv aware. Takes full advantage of hierarchical requirement files. Is intuitive. The learning curve is minimal. Written in Python.
[[tool.wreck.venvs]]
venv_base_path = '.venv'
reqs = [
'requirements/pip',
'requirements/pip-tools',
'requirements/prod',
'requirements/dev',
'requirements/manage',
'requirements/kit',
'requirements/mypy',
'requirements/tox',
]
[[tool.wreck.venvs]]
venv_base_path = '.doc/.venv'
reqs = [
'docs/requirements',
'docs/pip-tools',
]
[tool.setuptools.dynamic]
dependencies = { file = ['requirements/prod.unlock'] }
optional-dependencies.pip = { file = ['requirements/pip.lock'] }
optional-dependencies.pip_tools = { file = ['requirements/pip-tools.lock'] }
optional-dependencies.dev = { file = ['requirements/dev.lock'] }
optional-dependencies.manage = { file = ['requirements/manage.lock'] }
optional-dependencies.docs = { file = ['docs/requirements.lock'] }
reqs fix --venv-relpath='.venv'
reqs fix --venv-relpath='.doc/.venv'
From *.in requirements files would produce *.unlock and *.lock files for venv .venv. Package versions are sync'ed within all requirements files within that venv.
They kind of lost me at piping a script to sh. Is this the official way? Get your shit packaged into the popular distros. DevOps isn't that hard.