Skip to content

Add pyproject.toml to Improve CI/CD and Tooling#1108

Merged
githubnemo merged 19 commits intoskorch-dev:masterfrom
ParagEkbote:Add-Toml-File
Jun 26, 2025
Merged

Add pyproject.toml to Improve CI/CD and Tooling#1108
githubnemo merged 19 commits intoskorch-dev:masterfrom
ParagEkbote:Add-Toml-File

Conversation

@ParagEkbote
Copy link
Copy Markdown
Contributor

@ParagEkbote ParagEkbote commented Jun 15, 2025

Fixes #1106

As described in the issue, I have chosen to subsume 6 python tooling legacy into a single pyproject.toml file with minimal changes.

Motivation

As described in PEP 639, PEP 518 and PEP 621, the pyproject.toml file is a modern python tooling file which can manage multiple tasks of testing, linting, building of package, codecoverage ,etc. It has key-value configuration format.

Major Changes

  1. Building the source and wheels for the library
    This functionality does not have any breaking changes, I've tested it out with the python -m build command.

  2. Linting with pylint and flake8
    Linting with flake8 has no breaking changes. pylint has some changes. version 2.6 has deprecated no-space-check option with no_self_use being made optional. pylint options locally-enabled, super-on-old-class were deprecated in version 2.14. I've updated it with the relevant rules to make the lint efficient.

I've tested out both tools, they are working correctly.

  1. Using classifiers for PyPI
    When we publish packages on PyPI, classifers help categorize Python packages. These classifiers provide metadata about the package, such as its development status, intended audience, license, supported Python versions, and more. I've current added a standard set of packages for the library. Changes can be made to them as required.

  2. Testing and Code Coverage
    We can run the tests by running the pytest command with no breaking changes. Testing Code coverage has no breaking changes as well. You can check it with the pytest -v --cov=./skorch --cov-report=term-missing command.

  3. Deprecating Manifest.in, requirements.txt and requirements-dev.txt
    The functions of Manifest.in can be done by the .toml file as described in the setuptools docs here. The optional dependencies (prev. requirements-dev.txt) are listed in [project.optional-dependencies] and dependencies (prev requirements.txt) are listed in the project section.

Lastly, I have updated the gh-actions file to reflect these changes as well. I do know that the changes are a bit sweeping, but keeping the CI/CD and Python tooling up to date is quite essential and lead to less headaches as seen in #1081 . Could you please review the changes?
cc: @BenjaminBossan

@ParagEkbote ParagEkbote changed the title Add pyproject.toml to Improve CI/CD Jun 15, 2025
Copy link
Copy Markdown
Collaborator

@BenjaminBossan BenjaminBossan left a comment

Choose a reason for hiding this comment

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

Thank you for this fantastic PR, well done cleaning up all these different configs and adopting the new pyproject.toml.

I have a few smaller comments, but overall this looks very close to being finished.

There is a big difference for pylint, going from 809 lines of logs to 1536 on my machine, probably because the no_self_use rule is not disabled. But honestly, I think it's fine since I don't really use it anymore and I suspect others aren't either. We should move to a more modern linter like black or ruff eventually -- with string normalization disabled, skorch should already be quite close to what they expect.

Comment thread pyproject.toml Outdated
Comment thread pyproject.toml
Comment thread .github/workflows/testing.yml Outdated
Comment thread .github/workflows/testing.yml Outdated
Comment thread pyproject.toml Outdated
ParagEkbote and others added 2 commits June 18, 2025 00:13
Co-authored-by: Benjamin Bossan <BenjaminBossan@users.noreply.github.com>
Copy link
Copy Markdown
Collaborator

@BenjaminBossan BenjaminBossan 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 last few changes, the PR LGTM.

Before merging this big change, I'd like a second pair of eyes to check the PR, pinging @thomasjpfan @githubnemo

@ParagEkbote
Copy link
Copy Markdown
Contributor Author

Could you please review?

cc: @thomasjpfan, @githubnemo

Copy link
Copy Markdown
Collaborator

@githubnemo githubnemo left a comment

Choose a reason for hiding this comment

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

Thanks @ParagEkbote!

The changes LGTM except for minor comments and some questions regarding the dependency grouping.

Regardless of possible changes in the dependency grouping, let's not forget to update the README with the new instructions, e.g., instead of requirements-dev.txt we now need to install via pip install '.[full]'. This goes for docs/user/installation.rst as well.

Comment thread .github/workflows/testing.yml Outdated
Comment thread pyproject.toml
ParagEkbote and others added 4 commits June 24, 2025 22:39
Comment thread docs/user/installation.rst
@ParagEkbote ParagEkbote requested a review from githubnemo June 24, 2025 17:49
@githubnemo githubnemo merged commit d562403 into skorch-dev:master Jun 26, 2025
16 checks passed
@githubnemo
Copy link
Copy Markdown
Collaborator

Thanks a lot, @ParagEkbote, for the very thorough implementation.
This is a long overdue improvement!

@ParagEkbote ParagEkbote deleted the Add-Toml-File branch June 26, 2025 13:33
BenjaminBossan added a commit that referenced this pull request Jul 22, 2025
Due to #1108, pip install -r requirements.txt is no longer working.
Also, I took the liberty to bump the Python version used to 3.12.
BenjaminBossan added a commit that referenced this pull request Jul 22, 2025
Due to #1108, pip install -r requirements.txt is no longer working.
Also, I took the liberty to bump the Python version used to 3.12.
githubnemo pushed a commit that referenced this pull request Aug 8, 2025
# Version 1.2.0

This is a smaller release, most changes concern examples and development and thus don't affect users of skorch.

## Changed

- Loading of skorch nets using pickle: When unpickling a skorch net, you may come across a PyTorch warning that goes: "FutureWarning: You are using torch.load with weights_only=False [...]"; to avoid this warning, pickle the net again and use the new pickle file (#1092)

## Added

- Add Contributing Guidelines for skorch. (#1097)
- Add an example of hyper-parameter optimization using [Optuna](https://optuna.org/) [here](https://github.com/skorch-dev/skorch/tree/master/examples/optuna) (#1098)
- Add Example for Streaming Dataset(#1105)
- Add pyproject.toml to Improve CI/CD and Tooling (#1108)

Thanks @raphaelrubrice, @omahs, and @ParagEkbote for their contributions.

**Full Changelog**: v1.1.0...v1.2.0

Release commit specific:

* Bump verison to 1.2.0
* Update CHANGES.md
* Remove workarounds that have been fixed in sklearn
Only affects tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants