GAM-team / got-your-back

Got Your Back (GYB) is a command line tool for backing up your Gmail messages to your computer using Gmail's API over HTTPS.
https://github.com/GAM-team/got-your-back/wiki
Apache License 2.0
2.56k stars 203 forks source link

Add setup.py to allow pip install #458

Open phistrom opened 3 months ago

phistrom commented 3 months ago

Clone this repository and use python setup.py install . After install, gyb can be used on the command line anywhere (client_secrets.json and oauth2service.json need to be in the current directory or use --config-folder).

For installation, you could also use pip install git+https://github.com/GAM-team/got-your-back.git if this PR is accepted. (pip install got-your-back might be possible if Mr. Lee wishes to use twine to upload the package to PyPI).

While I would have liked to import from gyb.py on line 4 of setup.py, the packages in that module may not have been installed yet, leading to an import error. In an effort to modify as little of the original code as possible, I copied the values of the __author__, __email__, __program_name__, and __version__ to get around this.

Line 56 of setup.py adds gyb to the PATH. Tested on Windows (Python 3.12), MacOS (Python 3.11), and the python:3.12-slim Docker container (Debian Linux).

The original gyb.py script was modified as minimally as possible to allow setup.py to make an entry point script. The behavior should be precisely the same whether or not it was installed with pip.

Relevant issues:

239

379