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.1
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.24.2
Choose a head ref
  • 17 commits
  • 33 files changed
  • 2 contributors

Commits on Apr 18, 2024

  1. Various dependency upgrades (#1398)

    ofek authored Apr 18, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    xuezhaojun xuezhao
    Copy the full SHA
    feebb85 View commit details
  2. Add blog post for v1.10.0 (#1399)

    ofek authored Apr 18, 2024
    Copy the full SHA
    28b1674 View commit details

Commits on Apr 19, 2024

  1. Upgrade Ruff (#1401)

    ofek authored Apr 19, 2024
    Copy the full SHA
    bec0529 View commit details
  2. Allow environment configuration for scripts (#1402)

    ofek authored Apr 19, 2024
    Copy the full SHA
    ba64500 View commit details
  3. Add more docs

    ofek committed Apr 19, 2024
    Copy the full SHA
    65517d3 View commit details
  4. Add link in docs

    ofek committed Apr 19, 2024
    Copy the full SHA
    60a2b3c View commit details
  5. Add VS Code guide (#1403)

    Co-authored-by: Ofek Lev <ofekmeister@gmail.com>
    flying-sheep and ofek authored Apr 19, 2024
    Copy the full SHA
    d6ddd32 View commit details
  6. Update docs dependencies (#1404)

    ofek authored Apr 19, 2024
    Copy the full SHA
    5b9a49c View commit details
  7. Update blog post regarding CMake plugin (#1405)

    ofek authored Apr 19, 2024
    Copy the full SHA
    d615fef View commit details

Commits on Apr 21, 2024

  1. Upgrade PyApp to 0.17.0 (#1410)

    ofek authored Apr 21, 2024
    Copy the full SHA
    a8a5dcf View commit details
  2. Never cross the streams (#1406)

    ofek authored Apr 21, 2024
    Copy the full SHA
    cc6eab7 View commit details
  3. Update docs (#1411)

    ofek authored Apr 21, 2024
    Copy the full SHA
    e0dafd3 View commit details
  4. Update default Python distributions (#1412)

    ofek authored Apr 21, 2024
    Copy the full SHA
    40a4bf0 View commit details
  5. Add .venv to the list of directories that cannot be traversed (#1413)

    ofek authored Apr 21, 2024
    Copy the full SHA
    e589887 View commit details

Commits on Apr 22, 2024

  1. Upgrade Ruff to 0.4.1 (#1414)

    ofek authored Apr 22, 2024
    Copy the full SHA
    ee1b883 View commit details
  2. Update users and known plugins

    ofek committed Apr 22, 2024
    Copy the full SHA
    fc82f45 View commit details
  3. release Hatchling v1.24.2

    ofek committed Apr 22, 2024
    Copy the full SHA
    9b51c8c View commit details
13 changes: 8 additions & 5 deletions .github/workflows/build-hatch.yml
Original file line number Diff line number Diff line change
@@ -87,8 +87,8 @@ jobs:
CARGO: cargo
CARGO_BUILD_TARGET: ${{ matrix.job.target }}
PYAPP_REPO: pyapp
PYAPP_VERSION: "0.15.1"
PYAPP_PIP_EXTERNAL: "true"
PYAPP_VERSION: "0.17.0"
PYAPP_UV_ENABLED: "true"
PYAPP_PASS_LOCATION: "true"

steps:
@@ -282,6 +282,7 @@ jobs:

env:
VERSION: ${{ needs.binaries.outputs.version }}
NOTARY_WAIT_TIME: "3600" # 1 hour

steps:
- name: Checkout code
@@ -297,10 +298,10 @@ jobs:

- name: Install rcodesign
env:
ARCHIVE_NAME: "apple-codesign-0.26.0-x86_64-apple-darwin"
ARCHIVE_NAME: "apple-codesign-0.27.0-x86_64-apple-darwin"
run: >-
curl -L
"https://github.com/indygreg/apple-platform-rs/releases/download/apple-codesign%2F0.26.0/$ARCHIVE_NAME.tar.gz"
"https://github.com/indygreg/apple-platform-rs/releases/download/apple-codesign%2F0.27.0/$ARCHIVE_NAME.tar.gz"
|
tar --strip-components=1 -xzf - -C /usr/local/bin "$ARCHIVE_NAME/rcodesign"
@@ -356,6 +357,7 @@ jobs:
cd ../notarize-bin
for f in *; do
rcodesign notary-submit -vv \
--max-wait-seconds ${{ env.NOTARY_WAIT_TIME }} \
--api-key-path /tmp/app-store-connect.json \
"$f"
done
@@ -418,7 +420,8 @@ jobs:
- name: Notarize PKG
run: >-
rcodesign notary-submit
rcodesign notary-submit -vv
--max-wait-seconds ${{ env.NOTARY_WAIT_TIME }}
--api-key-path /tmp/app-store-connect.json
--staple
"signed/${{ steps.pkg.outputs.path }}"
2 changes: 1 addition & 1 deletion backend/src/hatchling/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.24.1'
__version__ = '1.24.2'
5 changes: 3 additions & 2 deletions backend/src/hatchling/bridge/app.py
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ def verbosity(self) -> int:
@staticmethod
def display(message: str = '', **kwargs: Any) -> None: # noqa: ARG004
# Do not document
_display(message)
_display(message, always=True)

def display_info(self, message: str = '', **kwargs: Any) -> None: # noqa: ARG002
"""
@@ -107,4 +107,5 @@ def __init__(self, app: Application) -> None:
self.display_mini_header = app.display_mini_header


_display = print
def _display(message: str, *, always: bool = False) -> None:
print(message, file=None if always else sys.stderr)
2 changes: 2 additions & 0 deletions backend/src/hatchling/builders/constants.py
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@
EXCLUDED_DIRECTORIES = frozenset((
# Python bytecode
'__pycache__',
# Single virtual environment
'.venv',
# Git
'.git',
# Mercurial
4 changes: 4 additions & 0 deletions docs/blog/.authors.yml
Original file line number Diff line number Diff line change
@@ -3,3 +3,7 @@ authors:
name: Ofek Lev
description: Creator
avatar: https://avatars.githubusercontent.com/u/9677399
flying-sheep:
name: Phil A.
description: Contributor
avatar: https://avatars.githubusercontent.com/u/291575
126 changes: 126 additions & 0 deletions docs/blog/posts/release-hatch-1100.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
---
date: 2024-04-18
authors: [ofek,flying-sheep]
description: >-
Hatch v1.10.0 brings a test command, support for UV, and a Python script runner.
categories:
- Release
---

# Hatch v1.10.0

Hatch [v1.10.0](https://github.com/pypa/hatch/releases/tag/hatch-v1.10.0) brings a test command, support for UV, and a Python script runner.

<!-- more -->

## Test command

The new [`test`](../../cli/reference.md#hatch-test) command allows you to easily run tests for your project on multiple versions of Python. The default behavior follows best practices, using [pytest](https://github.com/pytest-dev/pytest) with select plugins for test execution and [coverage.py](https://github.com/nedbat/coveragepy) for code coverage measurement.

The command is designed to be both simple to use while also satisfying the needs of most projects. For example, running the following command:

```
hatch test -aprc
```

will run tests in all environments in the matrix, with parallelized test execution in each, with a randomized test order and will report the code coverage at the end.

See the [tutorial](../../tutorials/testing/overview.md) for a detailed walk-through and the [config reference](../../config/internal/testing.md) for options.

## UV

The package installer [UV](https://github.com/astral-sh/uv), brought to you by the same folks behind [Ruff](https://github.com/astral-sh/ruff), is now supported. In any environment, you can enable the `uv` option to use UV in place of [virtualenv](https://github.com/pypa/virtualenv) & [pip](https://github.com/pypa/pip) for virtual environment creation and dependency management, respectively. This often results in a significant performance benefit.

For example, if you wanted to enable this functionality for the [default](../../config/environment/overview.md#inheritance) environment, you could set the following:

```toml config-example
[tool.hatch.envs.default]
uv = true
```

Semi-internal environments like those used for [testing](../../config/internal/testing.md) and [static analysis](../../config/internal/static-analysis.md) have this option enabled by default.

See the [how-to guide](../../how-to/environment/select-installer.md) for more information about switching the installer.

## Python script runner

The [`run`](../../cli/reference.md#hatch-run) command now supports executing Python scripts with [inline metadata](https://packaging.python.org/en/latest/specifications/inline-script-metadata/) as standardized by [PEP 723](https://peps.python.org/pep-0723/).

As an example, consider the following script:

```python tab="script.py"
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "httpx",
# "rich",
# ]
# ///

import httpx
from rich.pretty import pprint

resp = httpx.get("https://peps.python.org/api/peps.json")
data = resp.json()
pprint([(k, v["title"]) for k, v in data.items()][:10])
```

If you run the script for the first time as follows:

```
hatch run /path/to/script.py
```

Hatch will create a dedicated environment for that script using a version of Python greater than or equal to 3.11 with dependencies `httpx` and `rich`. You should then see the following output:

```
[
│ ('1', 'PEP Purpose and Guidelines'),
│ ('2', 'Procedure for Adding New Modules'),
│ ('3', 'Guidelines for Handling Bug Reports'),
│ ('4', 'Deprecation of Standard Modules'),
│ ('5', 'Guidelines for Language Evolution'),
│ ('6', 'Bug Fix Releases'),
│ ('7', 'Style Guide for C Code'),
│ ('8', 'Style Guide for Python Code'),
│ ('9', 'Sample Plaintext PEP Template'),
│ ('10', 'Voting Guidelines')
]
```

See the [how-to guide](../../how-to/run/python-scripts.md) for more information.

## Static analysis

The environment used for static analysis is now [completely configurable](../../config/internal/static-analysis.md#customize-behavior) such that you can fully alter the underlying behavior of the [`fmt`](../../cli/reference.md#hatch-fmt) command (see the [how-to](../../how-to/static-analysis/behavior.md)).

Additionally, Ruff has been updated to version 1.4.0 and the rules selected by default have been updated accordingly. Check out their [blog post](https://astral.sh/blog/ruff-v0.4.0) about how the new hand-written parser has made it twice as fast!

## Community highlights

### Visual Studio Code

Visual Studio Code [announced support](https://code.visualstudio.com/updates/v1_88#_hatch-environment-discovery) for Hatch environments in their latest release. This means that you can now easily discover and select Hatch environments for your projects directly from the editor.

See the [how-to guide](../../how-to/integrate/vscode.md) detailed instructions.

### CMake build plugin

A [new release](https://github.com/scikit-build/scikit-build-core/releases/tag/v0.9.0) of the extension module builder [scikit-build-core](https://github.com/scikit-build/scikit-build-core) has introduced a [build plugin](https://scikit-build-core.readthedocs.io/en/stable/plugins/hatchling.html) for Hatchling. This means that you can use Hatchling as your build backend while also shipping extension modules built with CMake.

To get started, add the dependency to your [build requirements](../../config/build.md#build-system):

```toml tab="pyproject.toml"
[build-system]
requires = ["hatchling>=1.24.1", "scikit-build-core~=0.9.0"]
build-backend = "hatchling.build"
```

Then explicitly enable the `experimental` option (acknowledging that the plugin will move to a dedicated package in the future):

```toml config-example
[tool.hatch.build.targets.wheel.hooks.scikit-build]
experimental = true
```

At this point, you can create your `CMakeLists.txt` file as usual and start building your extension modules with CMake! Check out the dedicated [example project](https://github.com/scikit-build/scikit-build-sample-projects/tree/main/projects/hatchling-pybind11-hello) for a complete demonstration.
Loading