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

chore: replace setuptools with hatchling, remove 'build' extra #2446

Merged
merged 1 commit into from
Feb 11, 2025

Conversation

mwtoews
Copy link
Contributor

@mwtoews mwtoews commented Feb 10, 2025

This PR does the following:

  • Changes the build backend from setuptools to hatch's hatchling. Why?
    • While both are PyPA projects, setuptools has some odd legacy concepts like MANIFEST.in and egg-info directories, that are not used with modern builds. It's an old system that is primarily maintained to maintain legacy behaviour and not to embrace modern enhancements.
    • Hatchling is a common and modern build backend, e.g. demonstrated as a default in guidelines. New features and plugins are actively developed for hatch and hatchling by Python core developers.
  • Use the hatch-fancy-pypi-readme plug-in to stitch content for the documentation in PyPI. (There is more potential to this plug-in, such as amending changelog info from each release). See preview via uvx hatch project metadata readme.
  • Remove the 'build' optional dependency (or extra), as this a prerequisite only for packaging builds, not an optional dependency. Builds can happen using several methods, e.g. python3 -m build or uv build or uvx hatch build etc.

I've done some comparisons of the sdist (.tar.gz) and bdist (.whl) outputs, and the contents are nearly identical.

Copy link

codecov bot commented Feb 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.3%. Comparing base (bb9824e) to head (6e732c0).
Report is 52 commits behind head on develop.

Additional details and impacted files
@@            Coverage Diff            @@
##           develop   #2446     +/-   ##
=========================================
+ Coverage     68.4%   76.3%   +7.8%     
=========================================
  Files          294     293      -1     
  Lines        59390   60120    +730     
=========================================
+ Hits         40652   45886   +5234     
+ Misses       18738   14234   -4504     

see 250 files with indirect coverage changes

Copy link
Member

@wpbonelli wpbonelli left a comment

Choose a reason for hiding this comment

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

The pypi fragments tool looks nice. Seems like we could improve on the current https://github.com/modflowpy/flopy/blob/develop/docs/PyPI_release.md.

@wpbonelli wpbonelli merged commit 2ba4010 into modflowpy:develop Feb 11, 2025
23 checks passed
@wpbonelli
Copy link
Member

@mwtoews any ideas on this? I can reproduce it locally too. maybe pixi doesn't support hatchling yet?

@mwtoews
Copy link
Contributor Author

mwtoews commented Feb 11, 2025

It is because pixi.toml has --no-build-isolation --no-deps, which means that all build deps must be installed prior. Are these options needed? I think they could be removed; see MODFLOW-USGS/modflow6#2218

@mwtoews mwtoews deleted the hatchling branch February 11, 2025 02:06
@wpbonelli
Copy link
Member

@mwtoews any idea what the original motivation to use those options might have been?

Looks mostly OK without them. The extended build fails now but that seems like the 3rd party 7zip action doesn't play nice with something that is now in the pixi env.

@mwtoews
Copy link
Contributor Author

mwtoews commented Feb 11, 2025

Is this resolved with #2220? It's possible that removing --no-deps could have interfered the installed packages in some unexpected way. If the issue persists, then this pip install option can be re-instated.

@wpbonelli
Copy link
Member

wpbonelli commented Feb 11, 2025

I think 2220 solves it.

wpbonelli pushed a commit to MODFLOW-USGS/modflow-devtools that referenced this pull request Feb 12, 2025
This PR changes the build backend from setuptools to hatchling. See background in modflowpy/flopy#2446

Other minor changes is to remove an unused .flake8 configuration file and unused tool.setuptools_scm option.
wpbonelli pushed a commit to MODFLOW-USGS/modflowapi that referenced this pull request Feb 12, 2025
This PR changes the build backend from setuptools to hatchling. See background in modflowpy/flopy#2446
wpbonelli pushed a commit to modflowpy/pymake that referenced this pull request Feb 12, 2025
This PR changes the build backend from setuptools to hatchling. See background in modflowpy/flopy#2446
jdhughes-usgs added a commit to modflowpy/pymake that referenced this pull request Feb 13, 2025
* ci(release): update version to 1.2.11.dev0

* ci: fix schedule for windows (#193)

* fix(requests): update available assets (#194)

Add macarm.zip asset

* chore: reformat Python code with line length = 88 (#198)

Reformat the code with a maximum line length of 88 characters to better represent the code.

See modflowpy/flopy#2362 for a related PR with rational and discussion.

Also change some of Ruff's configuration:

- Remove target-version, since it is automatically evaluated from pyproject.toml
- Remove include so that Ruff will work globally in this repo

* fix: cleanup _get_optlevel verbose param in pymake_base (#199)

Co-authored-by: mjreno <[email protected]>

* refactor: clean-up strings and Path related aspects, add a few Ruff rules (#200)

Refactor a few semi-related aspects:

- Revise strings and whitespace using a few methods with Ruff and manual edits
- Revise a few aspects of pathlib.Path -- these changes are added here to shorten some string formatting, but remain consistent throughout the code base
- Fix one more instance of removed verbose parameter in _get_optlevel(), similar to #199
- Apply Ruff pyupgrade (UP) rules
- Apply Ruff section-underline-matches-section-length (D409) rule
- Apply Ruff-specific rules (RUF)

* build(deps): bump dawidd6/action-download-artifact from 6 to 7 (#201)

* update for mf6.6.0 (#203)

* fix fortran submodule evaluation 
* update sutra and mfusg_gsi versions.
* update pixi version

* ci: fix release code.md path (#205)

* sync master and update version

* refactor(makefile): changes to makefile generation to limit changes (#208)

* ci: pin ubuntu-22.04 for now (#209)

Workaround oneAPI incompatibility with ubuntu-24.04

* chore: replace setuptools with hatchling (#210)

This PR changes the build backend from setuptools to hatchling. See background in modflowpy/flopy#2446

* build(deps): bump prefix-dev/setup-pixi from 0.8.1 to 0.8.2 (#211)

Bumps [prefix-dev/setup-pixi](https://github.com/prefix-dev/setup-pixi) from 0.8.1 to 0.8.2.
- [Release notes](https://github.com/prefix-dev/setup-pixi/releases)
- [Commits](prefix-dev/setup-pixi@v0.8.1...v0.8.2)

---
updated-dependencies:
- dependency-name: prefix-dev/setup-pixi
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* update mf6 and zbud6 version (#212)

* chore: fix typos and add codespell configuration (#213)

* ci: update scheduled workflow (#214)

* change ubuntu-latest to ubuntu-22.04 for intel-classic

* Trigger notification

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: wpbonelli <[email protected]>
Co-authored-by: Mike Taves <[email protected]>
Co-authored-by: mjreno <[email protected]>
Co-authored-by: mjreno <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
jdhughes-usgs added a commit to modflowpy/pymake that referenced this pull request Feb 13, 2025
* ci(release): update version to 1.2.11.dev0

* ci: fix schedule for windows (#193)

* fix(requests): update available assets (#194)

Add macarm.zip asset

* chore: reformat Python code with line length = 88 (#198)

Reformat the code with a maximum line length of 88 characters to better represent the code.

See modflowpy/flopy#2362 for a related PR with rational and discussion.

Also change some of Ruff's configuration:

- Remove target-version, since it is automatically evaluated from pyproject.toml
- Remove include so that Ruff will work globally in this repo

* fix: cleanup _get_optlevel verbose param in pymake_base (#199)

Co-authored-by: mjreno <[email protected]>

* refactor: clean-up strings and Path related aspects, add a few Ruff rules (#200)

Refactor a few semi-related aspects:

- Revise strings and whitespace using a few methods with Ruff and manual edits
- Revise a few aspects of pathlib.Path -- these changes are added here to shorten some string formatting, but remain consistent throughout the code base
- Fix one more instance of removed verbose parameter in _get_optlevel(), similar to #199
- Apply Ruff pyupgrade (UP) rules
- Apply Ruff section-underline-matches-section-length (D409) rule
- Apply Ruff-specific rules (RUF)

* build(deps): bump dawidd6/action-download-artifact from 6 to 7 (#201)

* update for mf6.6.0 (#203)

* fix fortran submodule evaluation 
* update sutra and mfusg_gsi versions.
* update pixi version

* ci: fix release code.md path (#205)

* sync master and update version

* refactor(makefile): changes to makefile generation to limit changes (#208)

* ci: pin ubuntu-22.04 for now (#209)

Workaround oneAPI incompatibility with ubuntu-24.04

* chore: replace setuptools with hatchling (#210)

This PR changes the build backend from setuptools to hatchling. See background in modflowpy/flopy#2446

* build(deps): bump prefix-dev/setup-pixi from 0.8.1 to 0.8.2 (#211)

Bumps [prefix-dev/setup-pixi](https://github.com/prefix-dev/setup-pixi) from 0.8.1 to 0.8.2.
- [Release notes](https://github.com/prefix-dev/setup-pixi/releases)
- [Commits](prefix-dev/setup-pixi@v0.8.1...v0.8.2)

---
updated-dependencies:
- dependency-name: prefix-dev/setup-pixi
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* update mf6 and zbud6 version (#212)

* chore: fix typos and add codespell configuration (#213)

* ci: update scheduled workflow (#214)

* change ubuntu-latest to ubuntu-22.04 for intel-classic

* Release v1.4.0

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: wpbonelli <[email protected]>
Co-authored-by: Mike Taves <[email protected]>
Co-authored-by: mjreno <[email protected]>
Co-authored-by: mjreno <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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.

2 participants