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

[WANTED FEATURE] Update scripts in setup.py to entry_points #365

Open
cmarshak opened this issue Jun 21, 2023 · 4 comments
Open

[WANTED FEATURE] Update scripts in setup.py to entry_points #365

cmarshak opened this issue Jun 21, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@cmarshak
Copy link
Collaborator

cmarshak commented Jun 21, 2023

This is a more modern approach, but also will align with our conda-recipe.

See this example: https://github.com/insarlab/MintPy/blob/main/setup.py#L95-L162

Supposedly also helps with better cross platform compatability (read Windows) as indicated here: https://stackoverflow.com/a/28119736

@cmarshak cmarshak added the enhancement New feature or request label Jun 21, 2023
@cmarshak cmarshak changed the title [WANTED FEATURE] Update scripts in setup.py to console_scripts [WANTED FEATURE] Update scripts in setup.py to entry_points Jun 21, 2023
@cmarshak
Copy link
Collaborator Author

cmarshak commented Jun 22, 2023

See Joe's Writeup linked below -- outlines all pieces that are required

@jhkennedy
Copy link
Collaborator

I described console script entry points in detail in this comment for MintPy, which may be helpful here.
insarlab/MintPy#652 (comment)

@sssangha
Copy link
Collaborator

More notes after discussion with the team:

It looks like the disutils.core.Extension isn't being used, so it should be pretty straight forward to migrate by translating between the two forms, which you can flip between here:
https://setuptools.pypa.io/en/latest/userguide/quickstart.html

Things that might be worth doing along the way would be using setuptools_scm to get the version number from the git tags instead of the custom code in the setup.py

And these should all be converted to actual console script entry-points:
https://setuptools.pypa.io/en/latest/userguide/entry_point.html#console-scripts

The script keyword is discouraged. E.g.:

Pyproject.toml: script-files
    Discouraged - equivalent to the `script` keyword in setup.py. Whenever possible, please use project.scripts instead.

and then actually listing dependencies would be nice, as well as the supported python version

@sssangha
Copy link
Collaborator

You can use the asf-hyp3 pyproject.tomls as templates e.g. https://github.com/ASFHyP3/hyp3-lib/blob/develop/pyproject.toml

A better starting point may be the cookiecutter template from the HyP3 folks: https://github.com/ASFHyP3/hyp3-cookiecutter/blob/develop/%7B%7Bcookiecutter.__project_name%7D%7D/pyproject.toml

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

No branches or pull requests

5 participants