Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyPI packaging and distribution? #24

Open
elsiehupp opened this issue Jul 26, 2021 · 14 comments · Fixed by #25
Open

PyPI packaging and distribution? #24

elsiehupp opened this issue Jul 26, 2021 · 14 comments · Fixed by #25

Comments

@elsiehupp
Copy link
Contributor

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

@ploum
Copy link
Contributor

ploum commented Jul 29, 2021

What’s the procedure to submit liblarch to PyPi ?

@elsiehupp
Copy link
Contributor Author

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
Copy link
Contributor Author

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

@ploum
Copy link
Contributor

ploum commented Jul 31, 2021

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.

@elsiehupp
Copy link
Contributor Author

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

@ploum
Copy link
Contributor

ploum commented Aug 14, 2021

it was closed automatically with the merge.

@ploum ploum reopened this Aug 14, 2021
@ploum
Copy link
Contributor

ploum commented Aug 14, 2021

What are the next steps expected from me then?

@elsiehupp
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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.

@ploum
Copy link
Contributor

ploum commented Aug 15, 2021

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
Copy link
Contributor

ploum commented Aug 15, 2021

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

@elsiehupp
Copy link
Contributor Author

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.

@ploum
Copy link
Contributor

ploum commented Aug 16, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants