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

Define the dependencies in only one place using setup.py #81

Merged
merged 3 commits into from
May 21, 2024

Conversation

ue-sho
Copy link
Contributor

@ue-sho ue-sho commented May 7, 2024

This PR (#66) introduced pipenv, but the documentation and GitHub Actions use venv, so developers are confused as to which to use.
Therefore, I modified it to use pipenv.
In addition, the name of the GitHub Actions was changed from tester.yml to ci.yml because I will introduce Ruff to check lint and format (#75).
After this PR is merged, I intend to create a PR that will introduce Ruff.

@ue-sho ue-sho force-pushed the fix-github-actions-with-pipenv branch 3 times, most recently from 7dd5bde to 1b178e9 Compare May 7, 2024 07:17
@ue-sho ue-sho changed the title Fix GitHub Actions to use pipenv Change to use pipenv May 7, 2024
@ue-sho ue-sho force-pushed the fix-github-actions-with-pipenv branch 2 times, most recently from c5c5264 to e6d963a Compare May 7, 2024 07:25
@pchoisel
Copy link
Collaborator

Hi, thanks for your contribution !
To be fair, I'm not fond of pipenv. Because of it, we now have a third place where we have to define the dependencies: setup.py (for Python3.6 compat), pyproject.toml (for Python3.12 support) and Pipfile.
This is likely to create problems when we want to change the dependencies...
Apart from being a bit easier to easier to use than venv, is there really a good reason to use this ?
(I know I should have asked that question in #66...)
@smjoshiatglobus Do you have an opinion on this ?

Apart from that, the rest of you contributions (renaming tester.yaml to ci.yaml and adding cache in the CI) are good for me.

@smjoshiatglobus
Copy link
Contributor

Hi, thanks for your contribution ! To be fair, I'm not fond of pipenv. Because of it, we now have a third place where we have to define the dependencies: setup.py (for Python3.6 compat), pyproject.toml (for Python3.12 support) and Pipfile. This is likely to create problems when we want to change the dependencies... Apart from being a bit easier to easier to use than venv, is there really a good reason to use this ? (I know I should have asked that question in #66...) @smjoshiatglobus Do you have an opinion on this ?

Apart from that, the rest of you contributions (renaming tester.yaml to ci.yaml and adding cache in the CI) are good for me.

I agree that defining dependencies in three places is not a good idea. Duplicating dependencies is worse! To be fair to pipenv, the dependencies in pipenv are optional and meant for developers of this package while those in pyproject.toml are for others who only import the package. I switched to pyproject.toml after observing that pydicom had switched to it. When I created PR #66, the supported version of python was >= 3.7. That has moved to 3.6 now.

It makes sense to define the dependencies in only one place. Since setup.py will work for all versions of python, I support dropping both pyproject.toml and Pipfile and sticking to only setup.py.

@ue-sho
Copy link
Contributor Author

ue-sho commented May 13, 2024

Given that setup.py supports all versions of Python you are dealing with, I too think it would be wise to consolidate dependency management there.
I am going to change the installation to using setup.py.

@ue-sho
Copy link
Contributor Author

ue-sho commented May 13, 2024

On second thought, I think it would be better to use pyproject.toml.
The pyproject.toml file provides a more modern and simplified management of the build system instead of using setup.py.

Since setuptools supports pyproject.toml, I think it should also work with python 3.6.
pypa/setuptools#2970

So I will try to find a way to implement it using pyproject.toml.

@ue-sho ue-sho force-pushed the fix-github-actions-with-pipenv branch from e6d963a to 504853a Compare May 14, 2024 09:15
@ue-sho ue-sho changed the title Change to use pipenv Define the dependencies in only one place using setup.py May 14, 2024
Copy link
Contributor Author

@ue-sho ue-sho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I will try to find a way to implement it using pyproject.toml.

When Python version is 3.6, the installation of editable mode (pip install -e .[dev]) fails due to low version of setuptools.
Therefore, I decided to define it in setup.py.

@pchoisel @smjoshiatglobus
Please review when you have time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have confirmed that CI works fine using act.
Screenshot 2024-05-14 at 18 21 17

Copy link
Contributor

@smjoshiatglobus smjoshiatglobus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor comment on a dead link in setup.py. Otherwise LGTM.

setup.py Outdated
@@ -27,4 +44,13 @@
# For an analysis of "install_requires" vs pip's requirements files see:
# https://packaging.python.org/en/latest/requirements.html
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# https://packaging.python.org/en/latest/requirements.html
# https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/

The link on line 45 is now dead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed it.

@ue-sho ue-sho force-pushed the fix-github-actions-with-pipenv branch from 504853a to 0ad9ea4 Compare May 15, 2024 00:44
Copy link
Contributor

@smjoshiatglobus smjoshiatglobus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ue-sho
Copy link
Contributor Author

ue-sho commented May 20, 2024

@pchoisel
If you merge this PR, I will immediately create a PR that will check the format and lint of the code by ruff.

@pchoisel pchoisel merged commit 9389e6a into KitwareMedical:master May 21, 2024
4 checks passed
@pchoisel
Copy link
Collaborator

Thank you !

@ue-sho ue-sho deleted the fix-github-actions-with-pipenv branch May 21, 2024 23:39
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 this pull request may close these issues.

None yet

3 participants