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

build: Use hatchling as build backend #475

Merged
merged 2 commits into from
Nov 7, 2024
Merged

Conversation

matthewfeickert
Copy link
Member

@matthewfeickert matthewfeickert commented May 19, 2024

  • Migrate to using hatchling as the build backend.

    • Include all build metadata in pyproject.toml.
    • Remove setup.py, setup.cfg, and MANIFEST.in.
    • Remove package_data as not needed.
  • Add .flake8 as flake8 won't support pyproject.toml.

  • ci: Remove MANIFEST check from CI

    • Remove check-manifest install in CI workflow.
    • Remove MANIFEST check step from CI.

(Marked as draft as wrote from Munich airport and need to check some things)

@matthewfeickert matthewfeickert self-assigned this May 19, 2024
pyproject.toml Outdated Show resolved Hide resolved
Copy link

codecov bot commented May 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (8f78894) to head (cd0865e).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #475   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           22        22           
  Lines         2093      2093           
  Branches       346       346           
=========================================
  Hits          2093      2093           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@alexander-held
Copy link
Member

alexander-held commented May 19, 2024

Thanks for taking care of this! The CI issues are from a matplotlib update, I'll take care of that separately.

edit: see #476

@matthewfeickert matthewfeickert marked this pull request as ready for review May 21, 2024 03:59
pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Show resolved Hide resolved
setup.cfg Show resolved Hide resolved
@matthewfeickert matthewfeickert force-pushed the build/use-hatchling branch 2 times, most recently from 5cd0096 to c372840 Compare May 30, 2024 15:51
@matthewfeickert
Copy link
Member Author

matthewfeickert commented May 30, 2024

@alexander-held This is ready for review again. I think the easiest spot check for you to do on this is if you checkout this branch to then do

rm -rf dist && pipx run build --installer uv . && python -m tarfile --list dist/cabinetry-*.tar.gz && python -m zipfile --list dist/cabinetry-*.whl

as that will show you the contents of the sdist and wheel getting built. You can compare that to the wheels currently on PyPI

$ rm -rf cabinetry*.whl && python -m pip download --no-cache-dir --no-deps cabinetry && python -m zipfile --list cabinetry-*.whl
Doing that:
rm -rf dist && pipx run build --installer uv . && python -m tarfile --list dist/cabinetry-*.tar.gz && python -m zipfile --list dist/cabinetry-*.whl
* Creating isolated environment: venv+uv...
* Using external uv from /home/feickert/.pyenv/shims/uv
* Installing packages in isolated environment:
  - hatchling>=1.13.0
* Getting build dependencies for sdist...
* Building sdist...
* Building wheel from sdist
* Creating isolated environment: venv+uv...
* Using external uv from /home/feickert/.pyenv/shims/uv
* Installing packages in isolated environment:
  - hatchling>=1.13.0
* Getting build dependencies for wheel...
* Building wheel...
Successfully built cabinetry-0.6.0.tar.gz and cabinetry-0.6.0-py3-none-any.whl
cabinetry-0.6.0/src/cabinetry/__init__.py 
cabinetry-0.6.0/src/cabinetry/configuration.py 
cabinetry-0.6.0/src/cabinetry/histo.py 
cabinetry-0.6.0/src/cabinetry/model_utils.py 
cabinetry-0.6.0/src/cabinetry/py.typed 
cabinetry-0.6.0/src/cabinetry/route.py 
cabinetry-0.6.0/src/cabinetry/smooth.py 
cabinetry-0.6.0/src/cabinetry/tabulate.py 
cabinetry-0.6.0/src/cabinetry/workspace.py 
cabinetry-0.6.0/src/cabinetry/cli/__init__.py 
cabinetry-0.6.0/src/cabinetry/contrib/__init__.py 
cabinetry-0.6.0/src/cabinetry/contrib/histogram_creator.py 
cabinetry-0.6.0/src/cabinetry/contrib/histogram_reader.py 
cabinetry-0.6.0/src/cabinetry/fit/__init__.py 
cabinetry-0.6.0/src/cabinetry/fit/results_containers.py 
cabinetry-0.6.0/src/cabinetry/schemas/config.json 
cabinetry-0.6.0/src/cabinetry/templates/__init__.py 
cabinetry-0.6.0/src/cabinetry/templates/builder.py 
cabinetry-0.6.0/src/cabinetry/templates/collector.py 
cabinetry-0.6.0/src/cabinetry/templates/postprocessor.py 
cabinetry-0.6.0/src/cabinetry/templates/utils.py 
cabinetry-0.6.0/src/cabinetry/visualize/__init__.py 
cabinetry-0.6.0/src/cabinetry/visualize/plot_model.py 
cabinetry-0.6.0/src/cabinetry/visualize/plot_result.py 
cabinetry-0.6.0/src/cabinetry/visualize/utils.py 
cabinetry-0.6.0/tests/__init__.py 
cabinetry-0.6.0/tests/conftest.py 
cabinetry-0.6.0/tests/test_backends.py 
cabinetry-0.6.0/tests/test_cabinetry.py 
cabinetry-0.6.0/tests/test_configuration.py 
cabinetry-0.6.0/tests/test_histo.py 
cabinetry-0.6.0/tests/test_integration.py 
cabinetry-0.6.0/tests/test_model_utils.py 
cabinetry-0.6.0/tests/test_route.py 
cabinetry-0.6.0/tests/test_smooth.py 
cabinetry-0.6.0/tests/test_tabulate.py 
cabinetry-0.6.0/tests/test_workspace.py 
cabinetry-0.6.0/tests/cli/test_cli.py 
cabinetry-0.6.0/tests/contrib/test_contrib_histogram_creator.py 
cabinetry-0.6.0/tests/contrib/test_contrib_histogram_reader.py 
cabinetry-0.6.0/tests/fit/test_fit.py 
cabinetry-0.6.0/tests/fit/test_fit_results_containers.py 
cabinetry-0.6.0/tests/templates/test_templates.py 
cabinetry-0.6.0/tests/templates/test_templates_builder.py 
cabinetry-0.6.0/tests/templates/test_templates_collector.py 
cabinetry-0.6.0/tests/templates/test_templates_postprocessor.py 
cabinetry-0.6.0/tests/templates/test_templates_utils.py 
cabinetry-0.6.0/tests/visualize/test_visualize.py 
cabinetry-0.6.0/tests/visualize/test_visualize_plot_model.py 
cabinetry-0.6.0/tests/visualize/test_visualize_plot_result.py 
cabinetry-0.6.0/tests/visualize/test_visualize_utils.py 
cabinetry-0.6.0/utils/config_histograms.yml 
cabinetry-0.6.0/utils/create_histograms.py 
cabinetry-0.6.0/utils/create_ntuples.py 
cabinetry-0.6.0/.gitignore 
cabinetry-0.6.0/LICENSE 
cabinetry-0.6.0/README.md 
cabinetry-0.6.0/pyproject.toml 
cabinetry-0.6.0/PKG-INFO 
File Name                                             Modified             Size
cabinetry/__init__.py                          2020-02-02 00:00:00         1237
cabinetry/configuration.py                     2020-02-02 00:00:00        10385
cabinetry/histo.py                             2020-02-02 00:00:00         9499
cabinetry/model_utils.py                       2020-02-02 00:00:00        32920
cabinetry/py.typed                             2020-02-02 00:00:00            0
cabinetry/route.py                             2020-02-02 00:00:00        14427
cabinetry/smooth.py                            2020-02-02 00:00:00         4243
cabinetry/tabulate.py                          2020-02-02 00:00:00        11682
cabinetry/workspace.py                         2020-02-02 00:00:00        20378
cabinetry/cli/__init__.py                      2020-02-02 00:00:00        12600
cabinetry/contrib/__init__.py                  2020-02-02 00:00:00           85
cabinetry/contrib/histogram_creator.py         2020-02-02 00:00:00         2863
cabinetry/contrib/histogram_reader.py          2020-02-02 00:00:00          602
cabinetry/fit/__init__.py                      2020-02-02 00:00:00        48872
cabinetry/fit/results_containers.py            2020-02-02 00:00:00         3706
cabinetry/schemas/config.json                  2020-02-02 00:00:00        16294
cabinetry/templates/__init__.py                2020-02-02 00:00:00         3302
cabinetry/templates/builder.py                 2020-02-02 00:00:00        14469
cabinetry/templates/collector.py               2020-02-02 00:00:00         6685
cabinetry/templates/postprocessor.py           2020-02-02 00:00:00         7079
cabinetry/templates/utils.py                   2020-02-02 00:00:00         2101
cabinetry/visualize/__init__.py                2020-02-02 00:00:00        30396
cabinetry/visualize/plot_model.py              2020-02-02 00:00:00        18745
cabinetry/visualize/plot_result.py             2020-02-02 00:00:00        15506
cabinetry/visualize/utils.py                   2020-02-02 00:00:00         1448
cabinetry-0.6.0.dist-info/METADATA             2020-02-02 00:00:00         9252
cabinetry-0.6.0.dist-info/WHEEL                2020-02-02 00:00:00           87
cabinetry-0.6.0.dist-info/entry_points.txt     2020-02-02 00:00:00           54
cabinetry-0.6.0.dist-info/licenses/LICENSE     2020-02-02 00:00:00         1528
cabinetry-0.6.0.dist-info/RECORD               2020-02-02 00:00:00         2527
$ rm -rf cabinetry*.whl && python -m pip download --no-cache-dir --no-deps cabinetry && python -m zipfile --list cabinetry-*.whl
Collecting cabinetry
  Downloading cabinetry-0.6.0-py3-none-any.whl.metadata (8.4 kB)
Downloading cabinetry-0.6.0-py3-none-any.whl (77 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 77.1/77.1 kB 4.1 MB/s eta 0:00:00
Saved ./cabinetry-0.6.0-py3-none-any.whl
Successfully downloaded cabinetry
File Name                                             Modified             Size
cabinetry/__init__.py                          2023-09-19 17:37:32         1237
cabinetry/configuration.py                     2023-09-19 09:49:18        10385
cabinetry/histo.py                             2023-09-19 13:56:40         9499
cabinetry/model_utils.py                       2023-09-19 13:56:50        32920
cabinetry/py.typed                             2022-01-31 16:15:36            0
cabinetry/route.py                             2023-07-17 17:58:42        14427
cabinetry/smooth.py                            2023-06-15 08:27:24         4243
cabinetry/tabulate.py                          2023-09-19 13:56:40        11682
cabinetry/workspace.py                         2023-09-19 09:50:26        18794
cabinetry/cli/__init__.py                      2023-06-11 09:07:32        12638
cabinetry/contrib/__init__.py                  2022-01-31 16:15:36           85
cabinetry/contrib/histogram_creator.py         2023-09-19 16:34:48         2863
cabinetry/contrib/histogram_reader.py          2023-09-19 16:34:48          602
cabinetry/fit/__init__.py                      2023-09-19 16:29:16        48628
cabinetry/fit/results_containers.py            2022-08-13 19:16:26         3706
cabinetry/schemas/config.json                  2023-08-07 11:56:22        16294
cabinetry/templates/__init__.py                2023-07-17 17:58:42         3302
cabinetry/templates/builder.py                 2023-09-19 16:34:48        14469
cabinetry/templates/collector.py               2023-09-19 16:34:48         6685
cabinetry/templates/postprocessor.py           2023-07-04 13:25:00         7079
cabinetry/templates/utils.py                   2023-05-16 19:10:52         2101
cabinetry/visualize/__init__.py                2023-09-19 13:56:40        30396
cabinetry/visualize/plot_model.py              2023-07-17 20:56:06        18357
cabinetry/visualize/plot_result.py             2023-05-16 19:10:52        15226
cabinetry/visualize/utils.py                   2022-09-25 19:53:22         1448
cabinetry-0.6.0.dist-info/LICENSE              2023-09-19 17:42:08         1528
cabinetry-0.6.0.dist-info/METADATA             2023-09-19 17:42:08         8427
cabinetry-0.6.0.dist-info/WHEEL                2023-09-19 17:42:08           92
cabinetry-0.6.0.dist-info/entry_points.txt     2023-09-19 17:42:08           54
cabinetry-0.6.0.dist-info/top_level.txt        2023-09-19 17:42:08           10
cabinetry-0.6.0.dist-info/RECORD               2023-09-19 17:42:08         2612

@matthewfeickert
Copy link
Member Author

@alexander-held bumping this, but we can probably both ignore this until next Friday once we've got most of the IRIS-HEP 2024 retreat finished. :)

* Migrate to using hatchling as the build backend.
   - Include all build metadata in pyproject.toml.
   - Remove setup.py, setup.cfg, and MANIFEST.in.
   - Remove package_data as not needed.
* Add .flake8 as flake8 won't support pyproject.toml.
* Remove check-manifest install in CI workflow.
* Remove MANIFEST check step from CI.
Copy link
Member

@alexander-held alexander-held 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 very much for taking care of this migration to hatchling! This all looks good.

@alexander-held alexander-held merged commit 5f96224 into master Nov 7, 2024
8 checks passed
@alexander-held alexander-held deleted the build/use-hatchling branch November 7, 2024 18:47
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