1
3
submitted 1 month ago by daco@lemm.ee to c/python@lemmy.ml

cross-posted from: https://lemm.ee/post/48031022

Hi,

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:

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.

You can install this using

pip install d2-python-wrapper

Here is a short post with more context.

Just in case It's useful for anyone. ๐Ÿ˜

2
1
submitted 2 months ago by DevCuber@sh.itjust.works to c/python@lemmy.ml

cross-posted from: https://sh.itjust.works/post/27097438

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.

Here are the logs

  • OS : Fedora 40
  • pip version: 23.3.2 updating to 24.2
  • python version: 3.12.7

I already made a bug report on the github

Does anyone know a temporary workaround for this ?

3
4
submitted 2 months ago by cypherpunks@lemmy.ml to c/python@lemmy.ml

cross-posted from: https://lemmy.ml/post/21461907

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. ๐Ÿ™ƒ

4
4
submitted 4 months ago by SpongeB0B@programming.dev to c/python@lemmy.ml

cross-posted from: https://programming.dev/post/17866168

Hi,

I use gunicorn in my venv

I have quite few venv that run gunicorn.

I would like to reuse gunicorn for other venv

I launch my web application like this

#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 ?

Thanks.

5
10
submitted 4 months ago by Zara@lemmy.ml to c/python@lemmy.ml

Hi,

I'm looking for a software similar to ZoneMinder
https://lemmy.ml/post/18530232

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 !?

Do you know any ?

Thanks.

6
13
submitted 8 months ago by martinn@programming.dev to c/python@lemmy.ml

cross-posted from: https://programming.dev/post/13395352

Would love to hear any suggestions, feedback or comments.

7
5
submitted 8 months ago by MichelDesmoulin@lemmy.ml to c/python@lemmy.ml
8
18
submitted 8 months ago by MichelDesmoulin@lemmy.ml to c/python@lemmy.ml
9
2
submitted 8 months ago by ylai@lemmy.ml to c/python@lemmy.ml
10
13
submitted 8 months ago by ylai@lemmy.ml to c/python@lemmy.ml
11
9
submitted 8 months ago by ylai@lemmy.ml to c/python@lemmy.ml
12
4
submitted 9 months ago by slyuser@lemmy.ml to c/python@lemmy.ml

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

13
5
submitted 9 months ago* (last edited 9 months ago) by Communist@lemmy.ml to c/python@lemmy.ml

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.

14
8
submitted 9 months ago by bluestarshield@lemmy.ml to c/python@lemmy.ml

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.

15
3
submitted 9 months ago by slyuser@lemmy.ml to c/python@lemmy.ml

Developed a script to perform mm to inches conversions, which was conveniently transformed into a web app using Streamlit.

16
19
submitted 9 months ago by cypherpunks@lemmy.ml to c/python@lemmy.ml
17
17
Python 3.13 gets a JIT (tonybaloney.github.io)
submitted 11 months ago by ylai@lemmy.ml to c/python@lemmy.ml
18
3
submitted 1 year ago by cypherpunks@lemmy.ml to c/python@lemmy.ml
19
7
submitted 1 year ago by Xer0@lemmy.ml to c/python@lemmy.ml

Just wondering if anyone is part of any Python chats, communities, forums etc, and which ones are good to join?

20
7
submitted 1 year ago by xiffu@kbin.social to c/python@lemmy.ml

Join chat rooms and explore programming content on Chat-to.dev.

21
9
submitted 1 year ago by ylai@lemmy.ml to c/python@lemmy.ml
22
9
submitted 1 year ago by ylai@lemmy.ml to c/python@lemmy.ml
23
7
submitted 1 year ago* (last edited 1 year ago) by makeasnek@lemmy.ml to c/python@lemmy.ml

I am working on a new django project which will use a MySQL database. Obviously there are several tables and attributes items in those tables have. I realize I could just document those attributes in the code itself, but more than one codebase may be accessing this database. I would rather have a more comprehensive solution to document relationships, expected CASEing of the text, allowed characters, etc.

I know UML exists, but it seems there are 1,000+ tools which do UML modeling, not all of which will gracefully do an SQL database.

Examples of things I want to document:

  • For a "user profile" there are various attributes: username (primary key), friendly name, etc
  • For a "task" - id (primary key), name (letters numbers and spaces only, max 56 characters), owner (a single username (foreign key(), assignees (zero or more usernames (list of foreign keys)), etc

Here's what I need:

  • GUI for building flowchart/model/whatever you call it showing each table and each attribute in each table, with ability to add notes to table or attribute. Attributes must have ability to be relational just like in a database.
  • FOSS only, must run on Linux. No "free" web-based garbage that will end up behind a paywall 5 years from now ie draw.io
  • Must store source files for this model in a text/xml/json/something file which can easily be put into our git repo
  • Must not be so tightly coupled to MySQL that is requires a database connection to work or couldn't be used if we switch to a non-MySQL backent. If it has templates for and knowledge about MySQL databases that's great but it shouldn't require them to be useful.

What do you suggest for this?

24
12
submitted 1 year ago by loki@lemmy.ml to c/python@lemmy.ml
25
39
The fraud was in the code (newsletter.mollywhite.net)
submitted 1 year ago by ylai@lemmy.ml to c/python@lemmy.ml
view more: next โ€บ

Python

3244 readers
1 users here now

News and discussions about the programming language Python


founded 5 years ago
MODERATORS