liblarch icon indicating copy to clipboard operation
liblarch copied to clipboard

PyPI packaging and distribution?

Open elsiehupp opened this issue 4 years ago • 14 comments

Could you submit liblarch to PyPI? It would make it a lot easier to use it as a dependency.

elsiehupp avatar Jul 26 '21 06:07 elsiehupp

What’s the procedure to submit liblarch to PyPi ?

ploum avatar Jul 29 '21 20:07 ploum

The PiPI website directs prospective developers to the Python.org packaging guide, specifically to the packaging tutorial.

My impression with Python distribution is that Poetry is increasingly popular for dependency management and packaging.

Poetry can be used for generating Python Wheel packages, though there are single-purpose tools available, as well.

(I’m currently working on learning this process myself, so I can’t really explain it from experience, yet.)

elsiehupp avatar Jul 31 '21 00:07 elsiehupp

There’s a “quick and dirty” tutorial available here.

elsiehupp avatar Jul 31 '21 00:07 elsiehupp

I will probably not be able to sit down to handle this for at least the next two months. But I would gladly review any proposal about this.

ploum avatar Jul 31 '21 14:07 ploum

I would say maybe reopen this, since it hasn’t quite happened, yet?

elsiehupp avatar Aug 11 '21 17:08 elsiehupp

it was closed automatically with the merge.

ploum avatar Aug 14 '21 13:08 ploum

What are the next steps expected from me then?

ploum avatar Aug 14 '21 13:08 ploum

it was closed automatically with the merge.

Yes, that was probably my fault by linking it in the description.

What are the next steps expected from me then?

First, I would say install the package I uploaded using pip install -i https://test.pypi.org/simple/ liblarch202107311843==3.1.0 and see if it works correctly in your existing development environment. (i.e. make sure it works in GTG if you install from pip.)

Then, create accounts on both test.pypi.org and pypi.org and let me know what your username is. (I’m 99% sure they’re separate registrations.) I just checked, and it looks like I can transfer you the liblarch namespace that I accidentally parked on test.pypi.org. (I haven’t done anything on the main pypi.org, yet, and it’s intentionally entirely separate.)

Once you’re set up with test.pypi.org, you can try a few test uploads to get the hang of it.

Use the following steps:

  1. Install build (if you haven’t already):
$ pip install build
  1. In the liblarch directory, run build:
$ python -m build .
  1. Upload the build with twine:
$ twine upload -r test dist/liblarch*

(The test keyword makes it use test.pypi.org rather than the regular pypi.org.)

The main caveats are that:

  1. Once you park a PyPI namespace, it’s yours until the end of time unless you deliberately transfer it to someone else.
  2. You can only upload a given version number once, and then that namespace + version is fixed until the end of time (though it can be stricken, just not overwritten).

Both the namespace (package name) and the version number come from setup.py, not from the upload command, so you need to temporarily modify setup.py if you’re uploading more than once.

For these reasons, you want to verify the process with test.pypi.org first, and if you’re testing with the main pypi.org, use a dummy version number before striking/withdrawing it.

I haven’t parked liblarch on the main pypi.org, because I didn’t realize it could be transferred, but I could do so if you want me to.

One other thing worth mentioning is that you can use two-factor authentication and/or GPG signing for PyPI uploads if you want to improve the security of your workflow. 2FA is fairly straightforward, but I haven’t fiddled around with PyPI GPG, yet.

elsiehupp avatar Aug 14 '21 16:08 elsiehupp

FWIW, you could almost certainly distribute Getting Things GNOME through PyPI, as well, just for shits and giggles. PyPI isn’t nearly as popular for GUI applications as it is for libraries (and, to some extent, simple CLI scripts), but you can upload pretty much anything, the main difficulty being determining the correct end-user installation method.

elsiehupp avatar Aug 14 '21 18:08 elsiehupp

An example of a GUI Python GTK application distributed through PyPI is Sublime Music [PyPI] [Gitlab], which I’ve never used, but which could potentially be a useful template for distributing GTG on PyPI.

elsiehupp avatar Aug 14 '21 19:08 elsiehupp

I do not longer actively develop Liblarch nor do I plan to do it (I’ve stopped all my programming activities and I do no longer have a dev environment on my computer). Does it make sense for me to own the namespace ?

I’m thinking that you could do it yourself. That would be a great contribution and you would have my blessing. Do you foresee any trouble ?

ploum avatar Aug 15 '21 10:08 ploum

asking @nekohayo and @izidormatusov if they have any opinion on this.

ploum avatar Aug 15 '21 10:08 ploum

I’m new enough to GTK that I wouldn’t feel comfortable with the responsibility for someone else’s namespace.

What seems like a better solution might be, first, putting a note like the following at the top of README.md:

Note: while this library is in active use by Getting Things GNOME, it is not under active development. If you would like to contribute to or help maintain liblarch, feel free to open an Issue at github.com/getting-things-gnome/liblarch.

Then, because PyPI allows for multiple owners and maintainers on a namespace, have the liblarch (and possibly also Getting Things GNOME) namespaces on PyPI mirror the permissions on the @getting-things-gnome GitHub team as much as possible.

Again, if you were to register on test.pypi.org and tell me your username, it would help me experiment with PyPI’s user-permissioning system.

elsiehupp avatar Aug 16 '21 14:08 elsiehupp

created account "ploum" on test.pypi.org.

ploum avatar Aug 16 '21 15:08 ploum