Python

6617 readers
62 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 2 years ago
MODERATORS
1
2
3
4
5
 
 

MicroPie is a small and very fast Python web framework. It is designed with flexability and simplicity in mind. Check out the website or the GitHub project.


from MicroPie import App  

class MyApp(App):  

    async def index(self):  
        return 'Hello ASGI World!'  

app = MyApp()  # Run with `uvicorn app:app`  
6
 
 
>>> from kenobi import KenobiDB  

>>> db = KenobiDB('example.db')  

>>> db.insert({'name': 'Yoda', 'lightsaber': 'green'})  
True  

>>> db.search('lightsaber', 'green')  
[{'name': 'Yoda', 'lightsaber': 'green'}]  
7
8
9
 
 

https://xcancel.com/charliermarsh/status/1884651482009477368

We’re building a new static type checker for Python, from scratch, in Rust.

From a technical perspective, it’s probably our most ambitious project yet. We’re about 800 PRs deep!

Like Ruff and uv, there will be a significant focus on performance.

The entire system is designed to be highly incremental so that it can eventually power a language server (e.g., only re-analyze affected files on code change).

Performance is just one of many goals, though.

For example: we're investing heavily in strong theoretical foundations and a consistent model of Python's typing semantics.

(We're lucky to have @carljm and @AlexWaygood on the team for many reasons, this is one of them.)

Another goal: minimizing false positives, especially on untyped code, to make it easier for projects to adopt a type checker and expand coverage gradually over time, without being swamped in bogus type errors from the start.

We haven't publicized it to-date, but all of this work has been happening in the open, in the Ruff repository.

All driven by a uniquely great team: @carljm, @AlexWaygood, @sharkdp86, @MichaReiser, @DhruvManilawala, @ibraheemdev, @dcreager.

I'm learning so much from them.

Warning: this project is not ready for real-world user testing, and certainly not for production use (yet). The core architecture is there, but we're still lacking support for some critical features.

Right now, I'd only recommend trying it out if you're looking to contribute.

For now, we're working towards an initial alpha release. When it's ready, I'll make sure you know :)

10
14
Whats in a Python tarball (programming.dev)
submitted 1 week ago* (last edited 1 week ago) by [email protected] to c/[email protected]
 
 

From helping other projects have run across a fundamental issue which web searches have not given appropriate answers.

What should go in a tarball and what should not?

Is it only the build files, python code, and package data and nothing else?

Should it include tests/ folder?

Should it include development and configuration files?

Have seven published packages which include almost all the files and folders. Including:

.gitignore,

.gitattributes,

.github folder tree,

docs/,

tests/,

Makefile,

all config files,

all tox files,

pre-commit config file

My thinking is that the tarball should have everything needed to maintain the package, but this belief has been challenged. That the tarball is not appropriate for that.

Thoughts?

11
12
13
 
 

Hello!

I recently published a new version of my Understanding Python re(gex)? ebook.

This book will help you learn Python Regular Expressions step-by-step from beginner to advanced levels with hundreds of examples and exercises. In addition to the standard library re, the third-party regex module is also covered in this book.

Release offers

To celebrate the new release, you can download the PDF/EPUB versions for free till 31-Jan-2025:

Interactive TUI app

I wrote a TUI app to help you solve exercises from this book interactively. See PyRegexExercises repo for installation steps and app_guide.md for instructions on using this app.

See my blog post Python regex cheatsheet for a quick reference.

Web version and GitHub repo

You can read the book online here: https://learnbyexample.github.io/py_regular_expressions/

Visit https://github.com/learnbyexample/py_regular_expressions for markdown source, example files, exercise solutions, sample chapters and other details related to the book.

Feedback and Errata

I would highly appreciate it if you'd let me know how you felt about this book. It could be anything from a simple thank you, rating/review, pointing out a typo, mistakes in code snippets, which aspects of the book worked for you (or didn't!) and so on. Reader feedback is essential and especially so for self-published authors.

Happy learning :)

14
15
 
 

PEP 735 what is it's goal? Does it solve our dependency hell issue?

A deep dive and out comes this limitation

The mutual compatibility of Dependency Groups is not guaranteed.

-- https://peps.python.org/pep-0735/#lockfile-generation

Huh?! Why not?

mutual compatibility or go pound sand!

pip install -r requirements/dev.lock
pip install -r requirements/kit.lock -r requirements/manage.lock

The above code, purposefully, does not afford pip a fighting chance. If there are incompatibilities, it'll come out when trying randomized combinations.

Without a means to test for and guarantee mutual compatibility, end users will always find themselves in dependency hell.

Any combination of requirement files (or dependency groups), intended for the same venv, MUST always work!

What if this is scaled further, instead of one package, a chain of packages?!

16
17
 
 

Hi. I'm trying to install libtorrent but I'm getting an error that I don't know how to resolve. Am I being dumb or is something up?

ERROR: Could not find a version that satisfies the requirement libtorrent (from versions: none) ERROR: No matching distribution found for libtorrent

18
 
 

I'm pretty new to Python because I haven't used it much for many projects over the years, but i decided to use it to make a web app recently with flask to practice. It calls a simple python program that does some file conversion. There's no database.

I'm hosting it on Python Anywhere for free right now. It's for an old TTRPG, so useful for a niche community, but probably not big enough to be worth hosting fees. Just in case, I'd also like to be able to keep an installer on my github or a Dropbox. The hope is others can still grab it, spread it, and install it long after I've lost interest or gotten hit by a bus.

From my googling, I see 3 main options:

  • Path 1: Keep the basic structure of a web app and use one of the frameworks that let me run it in a computer's browser offline.
    • The options here seem to be Flaskwebgui, Electron, or NW.js.
    • This seems the simplest and most straightforward way.
    • Web GUI is ubiquitous nowadays.
    • Part of me also doesn't like that everything has become a web app. I don't even know why. Maybe I don't like the idea of Google controlling everything.
  • Path 2: Keep the basic backend logic but rewrite the web GUI with a desktop GUI, making it more of a true native desktop app.
    • The options here seem to involve using pyinstaller and then some python GUI library/framework like Tkinter, PyQt, PySide, or Dearpygui.
    • I feel this will be slightly more work but it's a super simple UI so remaking it isn't a huge deal.
    • My instincts tell me the end result might be faster, since it won't have to deal with a browser middleman or web routes and such. But, I might be wrong, it might just be my old-ass not used to everything being an electron app nowadays.
    • Might also be more self-contained from carrying it's own libraries and not relying on browser compatibility? Idk.
    • Probably more OS dependent, though. Not sure how easy it is to make it work with PC, Mac, and Linux users.
  • Path 3: There seems to be some way to combine flask and pyinstaller so sounds like a combination of the two is an option, too. Haven't looked into this too much though since most of my search results talked about the above two paths.

So which way is best? And which framework/library/tool in that path?

19
20
21
22
23
24
25
7
UV tricks (www.bitecode.dev)
submitted 1 month ago by [email protected] to c/[email protected]
view more: next ›