Skip to content

Conversation

@goanpeca
Copy link
Collaborator

@goanpeca goanpeca commented Jun 11, 2025

Remove the use of setup.py and migrate all to pyproject.toml and hatch.

The source of truth for the version of the package remains on ignite/__init__.py.

[build-system]
requires = ["hatchling>=1.24.2"]
build-backend = "hatchling.build"

[project]
name = "pytorch-ignite"
authors = [
    {name = "PyTorch-Ignite Team", email = "[email protected]"},
]
...

Depends on:

@goanpeca goanpeca force-pushed the enh/use-pyproject branch 2 times, most recently from 789176b to 601ed5e Compare June 11, 2025 01:58
@github-actions github-actions bot added the ci CI label Jun 11, 2025
@goanpeca goanpeca marked this pull request as ready for review June 11, 2025 02:58
@vfdev-5
Copy link
Collaborator

vfdev-5 commented Jun 11, 2025

We may need to change here the conditions when unit tests are triggered:

paths:
- "ignite/**"
- "tests/ignite/**"
- "tests/run_cpu_tests.sh"
- "tests/run_code_style.sh"
- "examples/**.py"
- "requirements-dev.txt"
- ".github/workflows/unit-tests.yml"
pull_request:
paths:
- "ignite/**"
- "tests/ignite/**"
- "tests/run_cpu_tests.sh"
- "tests/run_code_style.sh"
- "examples/**.py"
- "requirements-dev.txt"
- ".github/workflows/unit-tests.yml"

@goanpeca goanpeca requested a review from vfdev-5 June 11, 2025 19:51
@goanpeca goanpeca closed this Jun 11, 2025
@goanpeca goanpeca reopened this Jun 11, 2025
@goanpeca goanpeca marked this pull request as draft June 11, 2025 21:54
@goanpeca goanpeca force-pushed the enh/use-pyproject branch 3 times, most recently from 3a47ded to add9c54 Compare June 12, 2025 14:00
@goanpeca goanpeca marked this pull request as ready for review June 12, 2025 14:41
@goanpeca
Copy link
Collaborator Author

goanpeca commented Jun 12, 2025

@vfdev-5 could we change the netlify command to use so we can check this PR runs ok?

pip install . instead of python setup.py install ?

npm install katex && katex --version && pip install -U "networkx<3.2" numpy && pip install torch --extra-index-url https://download.pytorch.org/whl/cpu && python setup.py install && cd docs && pip install -r requirements.txt && make html

Besides the nigthly builds, which seem to be unrelated to this PR and related to precision differences, this one is ready for review.

@goanpeca goanpeca force-pushed the enh/use-pyproject branch 2 times, most recently from efc806d to d9fc9c6 Compare June 12, 2025 16:16
@goanpeca goanpeca force-pushed the enh/use-pyproject branch from 321c3e9 to 4087972 Compare June 12, 2025 16:25
@goanpeca goanpeca force-pushed the enh/use-pyproject branch 2 times, most recently from b0ed4b5 to b29b972 Compare June 12, 2025 16:48
@goanpeca goanpeca force-pushed the enh/use-pyproject branch from b29b972 to 1a23abb Compare June 12, 2025 16:49
@goanpeca goanpeca force-pushed the enh/use-pyproject branch 2 times, most recently from 4d1dcbe to 96de3ac Compare June 13, 2025 02:37
@goanpeca goanpeca force-pushed the enh/use-pyproject branch from 96de3ac to 7873405 Compare June 13, 2025 02:38
@goanpeca goanpeca requested a review from vfdev-5 June 13, 2025 02:41
@goanpeca
Copy link
Collaborator Author

goanpeca commented Jun 13, 2025

I know setuptools was more convenient with respect to the conda build meta yaml, cause we could load the setup.py data. Conda build should provide something similar for pyproject.toml but it does not 🤦🏼 .

I could create a small pre-commit local hook so that we make sure the meta.yaml file is always up to date from the pyproject.toml (in a separate PR). Let me know what you think @vfdev-5


I tested the rest of the conda and pypi package creation locally step by step, to make sure all was working as expected.

@@ -1,27 +1,29 @@
{% set data = load_setup_py_data() %}
{% set __version__ = "0.6.0" %}
Copy link
Collaborator

@vfdev-5 vfdev-5 Jun 13, 2025

Choose a reason for hiding this comment

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

OK, I understand now what you were talking about when saying that conda recipe stuff support less pyproject. Can we write some bash or python script in this field {% set variable = script() %} to fetch the version from __init__.py ?
Maybe, we can provide this in a follow-up PR.

Copy link
Collaborator

@vfdev-5 vfdev-5 left a comment

Choose a reason for hiding this comment

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

Thanks a lot for the PR, Gonzalo!
Let's land it and see how it works

@vfdev-5 vfdev-5 enabled auto-merge June 13, 2025 08:26
@vfdev-5 vfdev-5 disabled auto-merge June 13, 2025 13:52
@vfdev-5 vfdev-5 merged commit 30a3f14 into pytorch:master Jun 13, 2025
15 of 19 checks passed
@goanpeca goanpeca deleted the enh/use-pyproject branch June 13, 2025 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants