51
92

TL;DR: uv is an extremely fast Python package manager, written in Rust.

52
19
submitted 2 months ago* (last edited 2 months ago) by Bimo@lemmy.world to c/python@programming.dev

First thing first, while I started to build this package I've made an error with the word that I've misspelled in I'm not a native english speaker. I'm planning to change the name and correct it. So don't be mad with me about it. Ok now let me introduce my first python package.

aba-cli-scrapper** i'ts a cli tool to easily build a dataset from Alibaba.

look at the repo to know more about this project : https://github.com/poneoneo/Alibaba-CLI-Scraper

I'm excited to share the latest release of my first Python package, aba-cli-scrapper designed to facilitate data extraction from Alibaba. This command-line tool enables users to build a comprehensive dataset containing valuable information on products and suppliers associated . The extracted data can be stored in either a MySQL or SQLite database, with the option to convert it into CSV files from the SQLite file.

The latest feature will be an ai agent to chat with about data saved. I'm working on this. Its should be release very a soon.

Key Features:

--Asynchronous mode for faster scraping of page results using Bright-Data API key (configuration required)

--Synchronous mode available for users without an API key (note: proxy limitations may apply)

--Supports data storage in MySQL or SQLite databases

--Text mode for thoses who are not comfortable with cli app

--Converts data to CSV files from SQLite database

Seeking Feedback and Contributions:

I'd love to hear your thoughts on this project and encourage you to test it out. Your feedback and suggestions on the package's usefulness and potential evolution are invaluable. Future plans include adding a RAG feature to enhance database interactions.

Feel free to try out aba-cli-scrapper and share your experiences! Leave a start if you liked .

53
5
submitted 2 months ago* (last edited 2 months ago) by darshit7@me.dm to c/python@programming.dev

Read about how Python 3.13 will open door for new ear for python community.

https://medium.com/@darshit7/beyond-the-gil-future-of-parallel-computing-in-python-38ef2a80555c

@python

54
11
dht11 sensor with arduino (www.slyautomation.com)
submitted 2 months ago by slyuser@lemmy.ml to c/python@programming.dev
55
16

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

56
70
submitted 2 months ago* (last edited 2 months ago) by pnutzh4x0r@lemmy.ndlug.org to c/python@programming.dev

The Python Steering Council has decided to suspend a core Python developer for three months for alleged Code of Conduct violations.

Citing the recommendation of the Code of Conduct Working Group, Python developer Thomas Wouters revealed on behalf of the Steering Council that the unidentified developer was deemed to have repeatedly violated the Python Software Foundation (PSF) Code of Conduct.

The suspended developer is Tim Peters, who told The Register it was fine to name him but declined to comment – beyond observing that one of his objections to the governance process is the secrecy involved.

57
63

GIL or Global Interpreter Lock can be disabled in Python version 3.13. This is currently experimental.

Python 3.13 brings major new features compared to Python 3.12 and one of them is free-threaded mode, which disables the Global Interpreter Lock, allowing threads to run more concurrently.

The GIL will be disabled when you configure the Python with the --disable-gil option which is nothing but a build configuration (free threading build) at the time of installation.

This will allow optionally enabling and disabling GIL using the environment variable PYTHON_GIL which can be set to 1 and 0 respectively.

It will also provide a command-line option -X gil which can also be set to 0 (disable) and 1 (enable).

58
12
submitted 2 months ago* (last edited 2 months ago) by SpongeB0B@programming.dev to c/python@programming.dev

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.

59
26
Convert HEIC to JPG (www.slyautomation.com)
submitted 2 months ago by slyuser@lemmy.ml to c/python@programming.dev
60
13
submitted 3 months ago* (last edited 3 months ago) by batmaniam@lemmy.world to c/python@programming.dev

Hi All,

I'm screening a large media library (20TB) wherein some files got corrupted when I did a transfer via filezilla (by my guess ~10%). The corrupted files display with a green "filter" over every frame (when played via plex and a number of local video players playing the file directly).

I'd like to screen the library, and want to write a script to get an average color reading.

Are there any libraries that would let me return a value AND specify how many frames I want it to take the average of? Because of how consistent and defined the issue is, it's really not necessary to average the whole file.

It would also be great if it automatically skipped non-video files, but I imagine a simple "try/except" would be fine.

My skill level here is best described as "high level hobbyist". I'm familiar with what I need to do iterating over the folder etc, but would prefer not to learn how to pull specific frames from a video container unless I have to.

Thanks for any help!

61
61
submitted 3 months ago by mac@programming.dev to c/python@programming.dev
62
39
63
16
submitted 3 months ago by Zara@lemmy.ml to c/python@programming.dev

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

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.

64
32
submitted 3 months ago* (last edited 3 months ago) by Berin@discuss.tchncs.de to c/python@programming.dev

cross-posted from: https://mastodon.social/users/Berin/statuses/112836125469155607

New Ren'Py Lemmy Community!

Heyo, I made a community for Ren'Py developers to ask for help and share their projects! Feel free to tag it to crosspost your mastodon posts, just like this post here. (But read the rules first, please)

https://discuss.tchncs.de/c/renpy

@renpy

#RenPy #GameDev #VNDev #IndieDev #VisualNovel

Hello Python community! I wanted to present the newly-made Ren'Py community on here.

Ren'Py is a Python-based game engine for visual novel development aimed at beginner developers with little prior programming experience. It uses a simple movie script-like syntax and provides both must-have visual novel components and tons of quality-of-life features out of the box. Capable Python programmers can easily extend the framework via custom components.

If you ever wanted to create an interactive fiction game, feel free to take a look!

!renpy@discuss.tchncs.de

65
32

I wrote a TUI application to help you practice Python regular expressions. There are more than 100 exercises covering both the builtin re and third-party regex module.

If you have pipx, use pipx install regexexercises to install the app. See the repo for source code and other details.

66
12
67
30
An HTMX success story (www.sheenaoc.com)
submitted 3 months ago by rimu@piefed.social to c/python@programming.dev

Porting from Django+React to a Django+HTMX based stack

68
51
69
73
70
10
submitted 4 months ago by s12@sopuli.xyz to c/python@programming.dev

I have a repository that contains multiple programs:

.
└── Programs
    ├── program1
    │   └── Generic_named.py
    └── program2
        └── Generic_named.py

I would like to add testing to this repository.

I have attempted to do it like this:

.
├── Programs
│   ├── program1
│   │   └── Generic_named.py
│   └── program2
│       └── Generic_named.py
└── Tests
    ├── mock
    │   ├── 1
    │   │   └── custom_module.py
    │   └── 2
    │       └── custom_module.py
    ├── temp
    ├── test1.py
    └── test2.py

Where temp is a folder to store each program temporarily with mock versions of any required imports that can not be stored directly with the program.

Suppose we use a hello world example like this:

cat Programs/program1/Generic_named.py
import custom_module

def main():
    return custom_module.out()


cat Programs/program2/Generic_named.py
import custom_module

def main():
    return custom_module.out("Goodbye, World!")


cat Tests/mock/1/custom_module.py
def out():return "Hello, World!"


cat Tests/mock/2/custom_module.py
def out(x):return x

And I were to use these scripts to test it:

cat Tests/test1.py
import unittest
import os
import sys
import shutil

if os.path.exists('Tests/temp/1'):
    shutil.rmtree('Tests/temp/1')

shutil.copytree('Tests/mock/1', 'Tests/temp/1/')
shutil.copyfile('Programs/program1/Generic_named.py', 'Tests/temp/1/Generic_named.py')

sys.path.append('Tests/temp/1')
import Generic_named
sys.path.remove('Tests/temp/1')

class Test(unittest.TestCase):
    def test_case1(self):
            self.assertEqual(Generic_named.main(), "Hello, World!")

if __name__ == '__main__':
    unittest.main()



cat Tests/test2.py
import unittest
import os
import sys
import shutil

if os.path.exists('Tests/temp/2'):
    shutil.rmtree('Tests/temp/2')

shutil.copytree('Tests/mock/2', 'Tests/temp/2')
shutil.copyfile('Programs/program2/Generic_named.py', 'Tests/temp/2/Generic_named.py')

sys.path.append('Tests/temp/2')
import Generic_named
sys.path.remove('Tests/temp/2')

class Test(unittest.TestCase):
    def test_case1(self):
            self.assertEqual(Generic_named.main(), "Goodbye, World!")

if __name__ == '__main__':
    unittest.main()

Both tests pass when run individually:

python3 -m unittest Tests/test1.py
.
----------------------------------------------------------------------
Ran 1 test in 0.000s

OK


python3 -m unittest Tests/test2.py
.
----------------------------------------------------------------------
Ran 1 test in 0.000s

OK

However, they fail when being run together:

python3 -m unittest discover -p test*.py -s Tests/
.F
======================================================================
FAIL: test_case1 (test2.Test)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/s/Documents/Coding practice/2024/Test Mess/1/Tests/test2.py", line 18, in test_case1
    self.assertEqual(Generic_named.main(), "Goodbye, World!")
AssertionError: 'Hello, World!' != 'Goodbye, World!'
- Hello, World!
+ Goodbye, World!


----------------------------------------------------------------------
Ran 2 tests in 0.001s

FAILED (failures=1)

If I try to use a different temporary name for one of the scripts I am trying to test,

cat Tests/test2.py
import unittest
import os
import sys
import shutil

if os.path.exists('Tests/temp/2'):
    shutil.rmtree('Tests/temp/2')

shutil.copytree('Tests/mock/2', 'Tests/temp/2')
shutil.copyfile('Programs/program2/Generic_named.py', 'Tests/temp/2/Generic_named1.py')

sys.path.append('Tests/temp/2')
import Generic_named1
sys.path.remove('Tests/temp/2')

class Test(unittest.TestCase):
    def test_case1(self):
            self.assertEqual(Generic_named1.main(), "Goodbye, World!")

if __name__ == '__main__':
    unittest.main()

Then I get a different error:

python3 -m unittest discover -p test*.py -s Tests/
.E
======================================================================
ERROR: test_case1 (test2.Test)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/s/Documents/Coding practice/2024/Test Mess/2/Tests/test2.py", line 18, in test_case1
    self.assertEqual(Generic_named1.main(), "Goodbye, World!")
  File "/home/s/Documents/Coding practice/2024/Test Mess/2/Tests/temp/2/Generic_named1.py", line 4, in main
    return custom_module.out("Goodbye, World!")
TypeError: out() takes 0 positional arguments but 1 was given

----------------------------------------------------------------------
Ran 2 tests in 0.001s

FAILED (errors=1)

It seems to be trying to import the same file, despite me using a different file from a different path with the same name. This seems strange, as I've been making sure to undo any changes to the Python Path after importing what I wish to test. Is there any way to mock the path? I can't change the name of the custom_module, as that would require changing the programs I wish to test.

How should I write, approach, or setup these tests such that they can be tested with unittest discover the same as they can individually?

71
5
submitted 4 months ago by slyuser@lemmy.ml to c/python@programming.dev

This is slyautomation and I am thrilled to welcome you to this in-depth tutorial where we will unravel the intricacies of training an aimbot using the cutting-edge YOLOv8.

72
44
73
27
74
14
75
8

This happens if I use set_time or set_position. Is this typical, or am I just not doing it right?

This is on a Pi Zero 2 W, so not the most powerful, but should be able to handle this.

These are the relevant bits of how I'm setting up the player:

    self._vlc = vlc.Instance()
    self._player = self._vlc.media_player_new()
    self._list_player = self._vlc.media_list_player_new()
    self._list_player.set_media_player(self._player)

    playlist = self._vlc.media_list_new()
    for index in self._play_order:
      playlist.add_media(self._vlc.media_new_path(self._songs[index]))

    self._list_player.stop()
    self._list_player.set_media_list(playlist)
    self._list_player.play()

And trying to seek is just this:

    self._player.set_time(_s_to_ms(seconds))

Any ideas would be greatly appreciated!

view more: ‹ prev next ›

Python

6331 readers
165 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

📅 Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

🐍 Python project:
💓 Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 1 year ago
MODERATORS