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

pip-installable #112

Open
sigvaldm opened this issue Jul 18, 2019 · 3 comments
Open

pip-installable #112

sigvaldm opened this issue Jul 18, 2019 · 3 comments

Comments

@sigvaldm
Copy link

Cool library!

It would be nice if it were registered at PyPI so that it could be installed using pip. This would it more accessible, and perhaps also more popular.

@timduly4
Copy link
Owner

@sigvaldm Any guides on how to do this?

@sigvaldm
Copy link
Author

sigvaldm commented Jul 19, 2019

As I often find is the case with software in the Python-ecosystem, documentation is fragmented, irrelevant and/or outdated, but I'll give a few pointers, and hopefully you can glue it together.

Since you already have a setup.py file that successfully compiles the .so-files, I think most of the job is already done. There are two ways to go about: 1) upload to PyPI manually, or 2) have Travis CI auto-deploy to PyPI every time you push a new version tag to GitHub. Regardless, you will first have to register an account on PyPI and register your package. Unfortunately the name pyglow is already taken, so you would probably have to register it under another name. For instance pyglow-atmospheric-models or whatever you prefer.

There's some information on how to do it manually here.

Having Travis CI auto-deploy your package to PyPI is convenient and I recommend it. Take care not to expose your PyPI password in plain-text in the .travis.yml file as explained. Here's an example from one of my own projects:

deploy:
  provider: pypi
  user: sigvaldm
  on:
    tags: true
    python: 3.7-dev
  password:
    secure: B1Mha+......

If I remember correctly, the version number on PyPI is taken from your setup.py file. You can see that I only deploy tagged commits, and only when testing Python 3.7-dev on Travis CI. Otherwise it would lead to a conflict, since pyglow 1.0.0 may first be deployed when testing Python 3.6 and then again when testing Python 3.7-dev. PyPI fails if you try to upload an already existing version; you can not remove anything uploaded to PyPI and you can only upload things with higher version numbers.

I see you have not tagged any versions yet. I recommend the Semantic Versioning convention. When you feel you are ready to release a new version to PyPI, you first push the commit you think is ready for deployment and have Travis CI test it for you. If it passes, you add a version tag and push that too, for instance:

git commit -m 'Latest change'
git push # Success on Travis CI
git tag -a 1.0.0
git push --tags

Hope that's helpful.

@sigvaldm
Copy link
Author

It is probably also possible to do this using Semaphore CI, but I have no experience with that. Choose whichever you like best.

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

No branches or pull requests

2 participants