esa / tetra3

A fast lost-in-space plate solver for star trackers.
https://tetra3.readthedocs.io/en/latest/
Apache License 2.0
91 stars 22 forks source link

Enable package installation using setup.py #15

Closed cgobat closed 9 months ago

cgobat commented 9 months ago

Currently the "package" cannot really be installed as a true Python package, and users are expected to simply place the tetra3.py source file in whatever project they are using it in. This runs counter to the typical Python package management philosophy/workflow, and impedes ease of use.

This pull request adds a setup.py file to enable package installation using pip with the syntax python setup.py install (or alternatively, pip install .) so that users can use then do from tetra3 import Tetra3 (or similar) from anywhere. An added benefit of this is that pip also supports installation from remote Git repositories, which means users can simply do pip install git+https://github.com/esa/tetra3.git once this setup.py exists, without having to separately download the source zip or clone the repository.

This installation method also means that manual dependency installation (pip install -r requirements.txt) ahead of time is no longer necessary, as the requirements.txt file is automatically read by setup.py and used during the installation process.

A few lines on the installation.rst documentation page have also been tweaked to provide instructions using this new method.


Edit: I actually hadn't noticed it when I made these changes, but coincidentally it looks like this PR will resolve #14. :slightly_smiling_face:

cgobat commented 9 months ago

Note that the one thing missing from the current setup.py is a version number. This would be good to have, but as far as I could tell, the project is currently not versioned.

cgobat commented 9 months ago

Hi @gustavmpettersson, let me know when you get a chance to look through these PRs, and if you would like to see any changes on any of them.

gustavmpettersson commented 9 months ago

Hi,

The PRs are good. Thank you for contributing. It's difficult for me to find time to work on this. There has recently been a lot of interest in tetra3 so I think it's appropriate to get it up to spec to act like a typical Python package.

I've made a new branch, hopefully we can work on that to quickly get something ready to push into master. I'd like to see the following:

I'll start checking items as I have time

Gustav

cgobat commented 9 months ago

Great, thanks! I am happy to start on some of these things on my own copy of the new branch (cgobat/tetra3@package_prep). I have a couple questions:

  • The current API and installation method needs to not be broken

What do you mean by this? Are there parts that are broken currently?

  • Update docs for readthedocs deprecation of "use system packages"

Does tetra3 currently use/rely on this feature? Do we just need to add a .readthedocs.yaml file?