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

Fix deprecation warning regarding setup.py and pyproject.toml #1384

Open
kinow opened this issue Aug 7, 2024 · 13 comments · May be fixed by #2079
Open

Fix deprecation warning regarding setup.py and pyproject.toml #1384

kinow opened this issue Aug 7, 2024 · 13 comments · May be fixed by #2079
Assignees
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Milestone

Comments

@kinow
Copy link
Member

kinow commented Aug 7, 2024

While reviewing @naiaraAM 's code in !459 , I created a new Micromamba env on a new laptop, and doing everything over from scratch I got this warning with Py 3.9.12 running pip install -e .:

DEPRECATION: Legacy editable install of autosubmit==4.1.9 from file:///home/kinow/Development/python/workspace/autosubmit (setup.py develop) is deprecated. pip 25.0 will enforce this behaviour change. A possible replacement is to add a pyproject.toml or enable --use-pep517, and use setuptools >= 64. If the resulting installation is not behaving as expected, try using --config-settings editable_mode=compat. Please consult the setuptools documentation for more information. Discussion can be found at pypa/pip#11457

It's probably better that we fix this earlier, instead of waiting until they remove it which may prevent AS from working with newer versions of Python for a simple issue that can be fixed in under one hour.

@kinow
Copy link
Member Author

kinow commented Aug 12, 2024

In GitLab by @edgano on Aug 12, 2024, 13:53

Looking for more info about these. I found this info here: https://packaging.python.org/en/latest/discussions/setup-py-deprecated/

What commands should be used instead?

Deprecated Recomendation
python setup.py install python -m pip install .
... ...

But not sure which could be the best strategy

@kinow
Copy link
Member Author

kinow commented Aug 12, 2024

I think calling python setup.py install directly has been considered old/deprecated for a long time. Some scripts that I used in the past did not work correctly when called directly like that.

I think either python -m pip install . or just pip install . should be OK.

The error, I believe, is due to the missing pyproject.toml. Other projects have added or migrated to pyproject.toml. It would be hard for us to migrate, I think, as I don't know if the way we retrieve the project version would work.

But we can add a pyproject.toml and move part of the metadata, to see if the deprecation warning goes away. Then in the future we can move more things, and follow the PEP's and see which direction we need/want to follow.

WDYT?

@kinow
Copy link
Member Author

kinow commented Aug 12, 2024

In GitLab by @edgano on Aug 12, 2024, 14:25

A ok!
yes, that sounds good ;) a good way to test without breaking anything. IDK what the others thinks about it

@dbeltrankyl
Copy link
Contributor

In relation to this, we should also fix this:

https://autosubmit.readthedocs.io/en/master/installation/index.html#installation

The docs are still referring to the use

python3 setup.py install

Which won't work because it doesn't download the dependencies of Autosubmit.

git clone -b $current_display_version https://github.com/BSC-ES/autosubmit
cd autosubmit
pip install . 

Would be more appropriate.

I think this should be done for v4.1.13, to avoid external user issues which are always harder to track.

@dbeltrankyl
Copy link
Contributor

It may be a good issue for @isimo00 or @VindeeR

@dbeltrankyl dbeltrankyl added the documentation Improvements or additions to documentation label Jan 23, 2025
@dbeltrankyl dbeltrankyl modified the milestones: 4.1.12, 4.1.13 Jan 23, 2025
@kinow
Copy link
Member Author

kinow commented Jan 23, 2025

Yeah, and this is a really annoying one, because I see this warning every week, nearly every day when I pip install -e . Autosubmit 😆

@VindeeR VindeeR assigned VindeeR and unassigned VindeeR Jan 24, 2025
@isimo00
Copy link
Contributor

isimo00 commented Jan 27, 2025

@VindeeR I assigned us both so we can collaborate :) I think this should be fairly easy, based on How to modernize a setup.py based project? and the pyproject.toml specification
I will push an initial commit today

isimo00 added a commit that referenced this issue Jan 27, 2025
@isimo00
Copy link
Contributor

isimo00 commented Jan 27, 2025

I pushed a working first version of the file - I'm not very well versed on this type of files so it might be a rough draft, we'll see -.

To test, run python -m build and then pip install dist/autosubmit-4.1.12-py3-none-any.whl or pip install dist/autosubmit-4.1.12.tar.gz.

@kinow
Copy link
Member Author

kinow commented Jan 27, 2025

I pushed a working first version of the file - I'm not very well versed on this type of files so it might be a rough draft, we'll see -.

To test, run python -m build and then pip install dist/autosubmit-4.1.12-py3-none-any.whl or pip install dist/autosubmit-4.1.12.tar.gz.

I think there's no draft pull request yet? But looking at the commit, it's looking like a normal pyproject.toml to me 🙂 seems to be in the right direction.

We can remove things from setup.py once we move them to pyproject.toml. Then at some point we can have just an empty setup.py with an empty setup() call (saw that in some projects, not sure if still useful/recommended), or drop the setup.py file.

Great job, Irene!

@isimo00 isimo00 linked a pull request Jan 27, 2025 that will close this issue
@isimo00
Copy link
Contributor

isimo00 commented Jan 27, 2025

@kinow Just created the draft PR: #2079. I'll briefly work on some other issues to let @VindeeR have some time to look at this for now, and will come back to polish the content migration from setup,py to pypropject.toml later. Thanks Bruno!

@isimo00
Copy link
Contributor

isimo00 commented Jan 27, 2025

I forgot to mention; there's a few filler values for the author and member fields; I added Daniel's info but there's some extra random people in there. Besides eventually removing these placeholders, should we add other members of the team other than Daniel?

@kinow
Copy link
Member Author

kinow commented Jan 27, 2025

I forgot to mention; there's a few filler values for the author and member fields; I added Daniel's info but there's some extra random people in there. Besides eventually removing these placeholders, should we add other members of the team other than Daniel?

That may be hard to maintain. What I've seen in other projects is to use either the original creator of the project, or something like "Autosubmit Team" (so we don't have to update it when the team changes...)

@kinow
Copy link
Member Author

kinow commented Jan 27, 2025

That would be a good topic for the Thursday meeting, I think.

@isimo00 isimo00 linked a pull request Jan 30, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants