ivandokov / phockup

Media sorting tool to organize photos and videos from your camera in folders by year, month and day.
MIT License
856 stars 108 forks source link

Chg: convert as rye python package #241

Open inkhey opened 2 months ago

inkhey commented 2 months ago

related to https://github.com/ivandokov/phockup/discussions/124

Hello Folks. I'm trying to convert this project from raw python to python project using Rye.

Why ? Because python package is a kind of norm that make many things really easier. For my specific use case, I do want to generate a Debian package of phockup using wheel2deb, but no python package no wheel.

Why Rye ? The packaging state of python is a mess. I don't have a strong opinion on the tool, I do just know how to use Rye and it's seems really nice to me as soon as you don't expect to be in the same environment it operates.

Why are you broking stuff like this ? I try to break minimal stuff. normally all the build process should still work.

What is working/What is broken Now ?

inkhey commented 2 months ago

I updated the description, I may have found a good backward compatibility mechanism (not sure), but it will be better to update all stuff to work with wheel as a single source of truth.

inkhey commented 2 months ago

I did the modification in a way that normally, aside from an external project that may use this to build the package, the current built package should still work. I don't know how to test homebrew/snap and windows case, so please ask if it's broken.

The only drawback of this, normally, is that on python<3.11 with non packaged code, the software is not any more able to know his own version.

This is far for perfect as it's probably better to generate the python package and then apply it to all packaging to have one source of truth, but I don't want to break too many things for now.

This change also means you should use rye and pyproject.toml to update dependencies, with both "soft" dependencies in pyproject.toml and hard dependencies generated by "rye sync" to .lock files.

I just published a package on testpypi with this command line:

rye publish --repository testpypi --yes --token="$TOKEN" --verbose --repository-url https://test.pypi.org/

So you can test : https://test.pypi.org/project/phockup/1.13.0/.

@ivandokov What's your opinion about this change ? I don't modify much the GitHub action as I don't have a way to test it properly. But automating PyPI package publication should not be too complicated.