Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: pypa/hatch
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: hatchling-v1.24.2
Choose a base ref
...
head repository: pypa/hatch
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: hatchling-v1.25.0
Choose a head ref
Loading
Showing with 2,631 additions and 928 deletions.
  1. +1 −1 .github/workflows/auto-merge.yml
  2. +191 −0 .github/workflows/build-distributions.yml
  3. +154 −52 .github/workflows/build-hatch.yml
  4. +12 −1 .github/workflows/build-hatchling.yml
  5. +53 −0 .github/workflows/cli.yml
  6. +5 −5 .github/workflows/docs-dev.yml
  7. +5 −5 .github/workflows/docs-release.yml
  8. +5 −47 .github/workflows/test.yml
  9. +5 −5 README.md
  10. +1 −1 backend/src/hatchling/__about__.py
  11. +58 −0 backend/src/hatchling/builders/macos.py
  12. +2 −0 backend/src/hatchling/builders/sdist.py
  13. +9 −0 backend/src/hatchling/builders/utils.py
  14. +11 −23 backend/src/hatchling/builders/wheel.py
  15. +2 −2 backend/src/hatchling/dep/core.py
  16. +1 −1 backend/src/hatchling/licenses/parse.py
  17. +1 −1 backend/src/hatchling/version/source/code.py
  18. +244 −24 docs/.hooks/render_ruff_defaults.py
  19. +39 −27 docs/blog/posts/release-hatch-1100.md
  20. BIN docs/blog/posts/release-hatch-1100/run-script.gif
  21. BIN docs/blog/posts/release-hatch-1100/testing-jinja.gif
  22. BIN docs/blog/posts/release-hatch-1100/testing-rich.gif
  23. +29 −4 docs/community/users.md
  24. +1 −1 docs/config/dependency.md
  25. +4 −4 docs/config/environment/advanced.md
  26. +12 −4 docs/config/internal/static-analysis.md
  27. +1 −1 docs/config/internal/testing.md
  28. +16 −16 docs/environment.md
  29. +55 −3 docs/history/hatch.md
  30. +15 −0 docs/history/hatchling.md
  31. +1 −1 docs/how-to/environment/dependency-resolution.md
  32. +7 −10 docs/how-to/environment/select-installer.md
  33. +30 −0 docs/how-to/python/custom.md
  34. +2 −2 docs/how-to/run/python-scripts.md
  35. +1 −1 docs/how-to/static-analysis/behavior.md
  36. +2 −2 docs/index.md
  37. +24 −16 docs/install.md
  38. +8 −8 docs/meta/faq.md
  39. +1 −1 docs/plugins/builder/wheel.md
  40. +6 −3 docs/plugins/environment/virtual.md
  41. +4 −0 docs/plugins/publisher/reference.md
  42. +136 −0 docs/tutorials/python/manage.md
  43. +1 −1 docs/why.md
  44. +12 −12 hatch.toml
  45. +7 −3 mkdocs.yml
  46. +1 −1 pyoxidizer.bzl
  47. +4 −4 pyproject.toml
  48. +1 −1 release/macos/build_pkg.py
  49. +49 −0 release/unix/make_scripts_portable.py
  50. +92 −0 release/windows/make_scripts_portable.py
  51. +1 −1 ruff.toml
  52. +5 −0 ruff_defaults.toml
  53. +1 −1 scripts/install_mkdocs_material_insiders.py
  54. +35 −10 scripts/update_ruff.py
  55. +2 −6 src/hatch/cli/application.py
  56. +1 −3 src/hatch/cli/config/__init__.py
  57. +1 −0 src/hatch/cli/env/prune.py
  58. +6 −0 src/hatch/cli/env/run.py
  59. +40 −39 src/hatch/cli/env/show.py
  60. +0 −1 src/hatch/cli/fmt/__init__.py
  61. +5 −0 src/hatch/cli/fmt/core.py
  62. +1 −1 src/hatch/cli/python/find.py
  63. +7 −2 src/hatch/cli/python/install.py
  64. +7 −1 src/hatch/cli/run/__init__.py
  65. +23 −4 src/hatch/cli/terminal.py
  66. +6 −0 src/hatch/cli/test/__init__.py
  67. +6 −0 src/hatch/config/constants.py
  68. +1 −1 src/hatch/env/internal/build.py
  69. +2 −2 src/hatch/env/internal/static_analysis.py
  70. +1 −1 src/hatch/env/internal/test.py
  71. +1 −1 src/hatch/env/internal/uv.py
  72. +212 −296 src/hatch/env/plugin/interface.py
  73. +6 −2 src/hatch/env/virtual.py
  74. +18 −7 src/hatch/index/core.py
  75. +15 −15 src/hatch/python/distributions.py
  76. +76 −6 src/hatch/python/resolve.py
  77. +1 −1 src/hatch/template/default.py
  78. +1 −1 src/hatch/template/files_default.py
  79. +12 −3 src/hatch/utils/network.py
  80. +24 −19 src/hatch/utils/runner.py
  81. +13 −1 src/hatch/utils/shells.py
  82. +0 −1 tests/backend/builders/plugin/test_interface.py
  83. +3 −1 tests/backend/builders/test_binary.py
  84. +41 −0 tests/backend/builders/test_sdist.py
  85. +71 −22 tests/backend/builders/test_wheel.py
  86. +56 −0 tests/backend/utils/test_macos.py
  87. +2 −2 tests/cli/env/test_create.py
  88. +16 −6 tests/cli/env/test_show.py
  89. +125 −64 tests/cli/fmt/test_fmt.py
  90. +6 −1 tests/cli/publish/test_publish.py
  91. +3 −1 tests/cli/python/conftest.py
  92. +4 −3 tests/cli/python/test_find.py
  93. +2 −2 tests/cli/python/test_install.py
  94. +45 −1 tests/conftest.py
  95. +174 −84 tests/env/plugin/test_interface.py
  96. +1 −1 tests/helpers/templates/new/basic.py
  97. +1 −1 tests/helpers/templates/new/default.py
  98. +1 −1 tests/helpers/templates/new/feature_cli.py
  99. +1 −1 tests/helpers/templates/new/feature_no_src_layout.py
  100. +1 −1 tests/helpers/templates/new/licenses_empty.py
  101. +1 −1 tests/helpers/templates/new/licenses_multiple.py
  102. +1 −1 tests/helpers/templates/new/projects_urls_empty.py
  103. +1 −1 tests/helpers/templates/new/projects_urls_space_in_label.py
  104. +1 −1 tests/helpers/templates/sdist/standard_include.py
  105. +1 −1 tests/helpers/templates/sdist/standard_include_config_file.py
  106. +17 −1 tests/helpers/templates/wheel/utils.py
  107. +1 −1 tests/index/server/devpi/entrypoint.sh
  108. +0 −2 tests/index/server/docker-compose.yaml
  109. +8 −4 tests/index/test_core.py
  110. +17 −2 tests/python/test_core.py
  111. +79 −1 tests/python/test_resolve.py
  112. +100 −0 tests/utils/test_runner.py
2 changes: 1 addition & 1 deletion .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ jobs:

steps:
- name: Wait for tests to succeed
uses: lewagon/wait-on-check-action@v1.3.3
uses: lewagon/wait-on-check-action@v1.3.4
with:
ref: ${{ github.ref }}
check-name: check
191 changes: 191 additions & 0 deletions .github/workflows/build-distributions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
name: build distributions

on:
workflow_call:
inputs:
version:
required: false
type: string

defaults:
run:
shell: bash

env:
DIST_URL: "https://github.com/indygreg/python-build-standalone/releases/download"
DIST_VERSION: "20240415"
DIST_PYTHON_VERSION: "3.12.3"
PYTHONDONTWRITEBYTECODE: "1"
PIP_ONLY_BINARY: ":all:"
# Some pip environment variables are weird, this means do not compile
PIP_NO_COMPILE: "0"

jobs:
ensure-installable:
name: Ensure Hatch is installable
runs-on: ubuntu-22.04

steps:
- name: Set up Python ${{ env.DIST_PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.DIST_PYTHON_VERSION }}

- name: Install UV
run: curl -LsSf https://github.com/astral-sh/uv/releases/latest/download/uv-installer.sh | sh

- name: Install Hatch
if: inputs.version
# Try to install the specific version of Hatch that was just released until successful
run: |-
for i in {1..20}; do
uv pip install --system hatch==${{ inputs.version }} && break || sleep 5
done
linux:
name: Distribution ${{ matrix.job.target }}
needs: ensure-installable
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
job:
- target: x86_64-unknown-linux-gnu
image: quay.io/pypa/manylinux2014_x86_64
target-override: x86_64_v3-unknown-linux-gnu
- target: aarch64-unknown-linux-gnu
image: quay.io/pypa/manylinux_2_28_aarch64
emulation: arm64

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: ${{ inputs.version && 1 || 0 }}

- name: Set up QEMU
if: matrix.job.emulation
uses: docker/setup-qemu-action@v3

- name: Set up Docker container
run: >-
docker run --rm -d
--name builder
--workdir /home
--env PYTHONDONTWRITEBYTECODE
--env PIP_ONLY_BINARY
--env PIP_NO_COMPILE
--volume ${{ github.workspace }}:/home/hatch
${{ matrix.job.image }}
sleep infinity
- name: Download distribution
run: >-
docker exec builder
curl -LO
${{ env.DIST_URL }}/${{ env.DIST_VERSION }}/cpython-${{ env.DIST_PYTHON_VERSION }}+${{ env.DIST_VERSION }}-${{ matrix.job.target-override || matrix.job.target }}-install_only.tar.gz
- name: Unpack distribution
run: >-
docker exec builder
tar xzf cpython-${{ env.DIST_PYTHON_VERSION }}+${{ env.DIST_VERSION }}-${{ matrix.job.target-override || matrix.job.target }}-install_only.tar.gz
- name: Install Hatch
run: >-
docker exec builder
/home/python/bin/python -m pip install
${{ inputs.version && format('hatch=={0}', inputs.version) || '/home/hatch' }}
- name: Make scripts portable
run: >-
docker exec builder
/home/python/bin/python /home/hatch/release/unix/make_scripts_portable.py
- name: Strip debug symbols
run: >-
docker exec builder
sh -c "find /home/python -name '*.so' | xargs strip -S"
- name: Archive distribution
run: >-
docker exec builder
tar czf hatch-dist-${{ matrix.job.target }}.tar.gz python
- name: Move to host
run: docker cp builder:/home/hatch-dist-${{ matrix.job.target }}.tar.gz .

- name: Check original size
run: >-
docker exec builder
ls -lh cpython-${{ env.DIST_PYTHON_VERSION }}+${{ env.DIST_VERSION }}-${{ matrix.job.target-override || matrix.job.target }}-install_only.tar.gz
- name: Check final size
run: ls -lh hatch-dist-${{ matrix.job.target }}.tar.gz

- name: Upload archive
uses: actions/upload-artifact@v4
with:
name: distribution-${{ matrix.job.target }}
path: hatch-dist-${{ matrix.job.target }}.tar.gz

windows-macos:
name: Distribution ${{ matrix.job.target }}
needs: ensure-installable
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: false
matrix:
job:
- target: x86_64-pc-windows-msvc
os: windows-2019
- target: aarch64-apple-darwin
os: macos-14
- target: x86_64-apple-darwin
os: macos-12

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: ${{ inputs.version && 1 || 0 }}

- name: Download distribution
run: curl -LO ${{ env.DIST_URL }}/${{ env.DIST_VERSION }}/cpython-${{ env.DIST_PYTHON_VERSION }}+${{ env.DIST_VERSION }}-${{ matrix.job.target }}-install_only.tar.gz

- name: Unpack distribution
run: tar xzf cpython-${{ env.DIST_PYTHON_VERSION }}+${{ env.DIST_VERSION }}-${{ matrix.job.target }}-install_only.tar.gz

- name: Install Hatch
run: >-
${{ startsWith(matrix.job.os, 'windows-') && '.\\python\\python.exe' || './python/bin/python' }}
-m pip install
${{ inputs.version && format('hatch=={0}', inputs.version) || '.' }}
- name: Make scripts portable
run: >-
${{ startsWith(matrix.job.os, 'windows-') && '.\\python\\python.exe' || './python/bin/python' }}
release/${{ startsWith(matrix.job.os, 'windows-') && 'windows' || 'unix' }}/make_scripts_portable.py
- name: Strip debug symbols
if: startsWith(matrix.job.os, 'macos-')
run: find python -name '*.so' | xargs strip -S

- name: Remove debug symbols
if: startsWith(matrix.job.os, 'windows-')
run: Get-ChildItem -Path python -Filter "*.pdb" -Recurse | Remove-Item
shell: pwsh

- name: Archive distribution
run: tar czf hatch-dist-${{ matrix.job.target }}.tar.gz python

- name: Check original size
run: ls -lh cpython-${{ env.DIST_PYTHON_VERSION }}+${{ env.DIST_VERSION }}-${{ matrix.job.target }}-install_only.tar.gz

- name: Check final size
run: ls -lh hatch-dist-${{ matrix.job.target }}.tar.gz

- name: Upload archive
uses: actions/upload-artifact@v4
with:
name: distribution-${{ matrix.job.target }}
path: hatch-dist-${{ matrix.job.target }}.tar.gz
Loading