I wanted to use d2 in an environment where I could only install python and npm packages.
Given that, and that I could not find any other solution, I made d2-python-wrapper, a small python wrapper that bundles the d2 binaries.
Now you can use d2 from python like this:
python
from d2_python import D2
d2 = D2()
# Simple diagram
with open("test.d2", "w") as f:
f.write("x -> y")
# Default SVG output
d2.render("test.d2", "output.svg")
# PDF output with specific theme
d2.render("test.d2", "output.pdf", format="pdf", theme="1")
The class just wraps the bin, so it works and supports the same as the bin. There is a GitHub Action that gets the bins for each platform (mac, win, linux) from the releases in this repo and publishes it to pip.
I store my programs in a cryptomator vault which uses a fuse virtual drive (The default on Linux), but when trying to update pip inside a venv I get an error, then any subsequent use of pip also throws an error and {path_to_venv}/lib/python3.12/site-packages/pip/ becomes empty.
I imagine this is an issue that would happen in any FUSE drive although I don't know how to test that.
So, this uses a macro, but if you're thinking anything is possible with a macro, it's actually not in Rust. The input does still need to parse as valid Rust tokens.
Which means the authors asked themselves at some point: Is the Rust syntax a superset of the Python syntax?
And well, it's not. In particular, some Python keywords will just be tokenized as an identifier (like a variable name).
But it is close enough that the authors decided against requiring a massive string to be passed in, which does amuse me. 🙃
#PWD = venv dir
source ./bin/activate
gunicorn A_WebApp:app
#A_WebApp is my python file A_WebApp.py
I supposes that gunicorn is a shell program ? if yes I should use $PATH ? \
or gunicorn is a Python program only ? and then what I should do to use gunicorn in another venv ?
But it seem that ZoneMinder become slowly outdated, php etc..
I've found a couples of alternatives ( hard choice as the limitations of use are often buried deep )
It seem that openCV is really famous for AI Computer vision, So I would be surprise if there were no Python program to manage cameras like a ZoneMinder !?
Since starting Wasmer five years ago we've been obsessed with empowering more languages to target the web and beyond through Webassembly.
One of the ...
Earlier this year, an experimental “just-in-time” compiler was merged into CPython’s main development branch. While recent CPython releases have included other substantial internal changes, this addition represents a particularly significant departure f...
Unleash Your Python Potential with Python IDLE: The Ultimate Beginner's Guide! From Installation Hacks to Secret Debugging Tricks, Master Python IDLE in Minutes! 💻🚀 #Python #Programming #BeginnerGuide
I've been struggling with this for hours, i'm not a python dev, i'm just trying to control my lights with my linux pc #!/usr/bin/env python import sys from lifxlan import LifxLAN def main (): lan =...
Link Actions
I'm just trying to control my smartlights with a script, it seems to be having a lot of problems, I really don't know what I'm doing, i'd appreciate any help I can get
Once I have a script that can individually turn lights on/off i can edit the rest myself, I just can't get the base functionality working.
Hey, I've been looking to learn Python for a while, tried as a kid but got bored before I did anything. I was wondering if anyone knew of any good Python self-study workbooks? The ones with exercises in addition to theory. I'm using Mint, in case that brings up any IDE issues.
In free-threaded builds, running with PYTHON_GIL=0 or -X gil=0 will now disable the GIL. #116322 and #116329 track follow-up work to re-enable the GIL when loading an incompatible extension, and to...