this post was submitted on 20 Nov 2024
28 points (93.8% liked)
Python
6467 readers
7 users here now
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
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Oh my... I'll eat my words about python maintainability. No unit tests, no emulation tests (with emulated services), no tests with a database, no formatter, no linter, no type hints, simple pip... The result is working, but I'm a little bit concerned about the nigh complete lack of testing and though they use an ORM (SQLAlchemy), I find the raw SQL therein (even if it's simple) concerning.
Besides that, the end result looks quite usable and it's nice to see an alternative to lemmy.
Anti Commercial-AI license
Yeah the lack of test suites really kicks our arse sometimes. I changed it from hard-deleting to soft-deleting stuff recently, and I forgot to check whether a post actually links to an external URL when restoring a post. The first time someone restored a post without one, it decided that it now had 189 cross-posts (i.e. all the other text posts that week). Whoops!
Yep, this Python-based project has no tests but not because it's written in Python, lol
Attempting to get something working first and possibly adding tests later? Or are there other reasons?
Anti Commercial-AI license
Pretty much.
It's a hobby project so we work on things we find fun or interesting. To me, tests are neither of those.
This was my experience with personal projects too.
Unit tests hinder progress so much. End-to-end/integration tests are often flaky.
The thing is, I still want to test my own project, because it's a good idea to validate whether or not your code works or not...
Rimu I love your approach to mod tools!
Sorry if I ask this but now that Lemmy has extism plugins, wouldnβt it be better if you tried to extend lemmy with your python skills rather than keeping to build from 0? Would help the fun even more I think (?)
π understandable. Are you open to one or more of the things I mentioned being added? Strict type checking, tests, formatter, linting?
Anti Commercial-AI license
BTW I recently added the database structure for post licenses and have PeerTube video licence information being saved into the DB when they federate to us. However there is no UI that will let people specify a license for their PieFed posts or comments. The UI needs to present a list of licenses to choose from and reading about all the different ones made my eyes glaze over.
You might like to start there as it seems to be an interest of yours!
I feel like I'm getting nerd-sniped π Believe it or not, writing tests, adding type hints, adding a formatter and linting, are actually more interesting to me than UI-work π
I'll see if I can make some time this week, but no guarantees!
Anti Commercial-AI license
Yes we could really do with all of those. Patches welcome. Other than a preference for PEP 8 I don't have strong opinions about particular linters or formatters.
I see the benefits of types but am not puritanical about it. I'm ok with the way we're using types at the moment. Most utility functions have types specified, especially those that return database objects so the type information flows up to the routes pretty well. I mostly see it as a way to help my IDE autocomplete work better than as a holy grail. I'm sure there are places where more types could be added but making it a policy that every function must have a type signature seems OTT.
To keep it simple
testing and static type checking -- catches all the bugs
linting and formatters -- so
git diff
isn't pure noise showing trailing and unnecessary whitespace and collaborators won't have to go back to correct things that coulda been automagically fixed.in code documentation -- Can be extracted by Sphinx as part of the documentation process. Hint: interrogate is your friend.
gh workflows -- to have the test suite run against various py versions, os, and maybe architectures. Without which not even confident it runs well on your own machine let alone anywhere else.
requirements.txt -- is an output file. Where is requirements.in ??
xz hacker sends his love
Makefile -- for people who like a ton of shell scripts in their Python packages. Up until realize that ya know which Python interpreter is being run, but can't have any level of confidence about the shell interpreter. Cuz it's a big unknown and unknowable. Gotta just take it on faith.