Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ecc5741

Browse files
authored
chore: update hatch version and remove hatch-containers (DataDog#10373)
Initially, started this PR to not use `pip install` to install hatch. hatch [docs](https://hatch.pypa.io/1.8/install/#pip) doesn't recommend installing hatch via `pip`, as it could modify the Python environment in which you choose to install. I addressed some of them but not all. Removing hatch-containers, which was used to build docs on local mac. It can now build docs natively by installing enchant, also running `hatch run docs:build` in `scripts/ddtest` works too. ## Checklist - [x] PR author has checked that all the criteria below are met - The PR description includes an overview of the change - The PR description articulates the motivation for the change - The change includes tests OR the PR description describes a testing strategy - The PR description notes risks associated with the change, if any - Newly-added code is easy to change - The change follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - The change includes or references documentation updates if necessary - Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [x] Reviewer has checked that all the criteria below are met - Title is accurate - All changes are related to the pull request's stated goal - Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - Testing strategy adequately addresses listed risks - Newly-added code is easy to change - Release note makes sense to a user of the library - If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)
1 parent 32c03d7 commit ecc5741

10 files changed

Lines changed: 43 additions & 25 deletions

File tree

.circleci/config.templ.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,12 @@ commands:
119119
setup_hatch:
120120
description: "Install hatch"
121121
steps:
122-
- run: pip3 install hatch~=1.8.0 hatch-containers==0.7.0
122+
- run:
123+
name: "Install hatch"
124+
command: |
125+
curl -L https://github.com/pypa/hatch/releases/download/hatch-v1.12.0/hatch-x86_64-unknown-linux-gnu.tar.gz | tar zx
126+
sudo install -t /usr/local/bin hatch
127+
hatch -q
123128
124129
start_docker_services:
125130
description: "Start Docker services"
@@ -1345,7 +1350,6 @@ jobs:
13451350
# build documentation and store as an artifact
13461351
executor: ddtrace_dev
13471352
steps:
1348-
- setup_hatch
13491353
- checkout
13501354
- run:
13511355
command: |

.github/workflows/generate-package-versions.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ name: Generate Package Versions
33
on:
44
workflow_dispatch: # can be triggered manually
55
schedule:
6-
- cron: '0 0 * * 0' # weekly on Sunday at midnight
7-
6+
- cron: "0 0 * * 0" # weekly on Sunday at midnight
87

98
jobs:
109
generate-package-versions:
@@ -32,7 +31,7 @@ jobs:
3231
uses: actions/setup-python@v5
3332
with:
3433
python-version: "3.10"
35-
34+
3635
- name: Setup Python 3.11
3736
uses: actions/setup-python@v5
3837
with:
@@ -57,18 +56,22 @@ jobs:
5756
5857
- name: Start docker service
5958
run: docker-compose up -d testagent
60-
59+
6160
- name: Install system dependencies
6261
run: |
6362
sudo apt-get update
6463
sudo apt-get install -y libmariadb-dev
65-
64+
65+
- name: Install hatch
66+
uses: pypa/hatch@install
67+
with:
68+
version: "1.12.0"
69+
6670
- name: Install Python dependencies
6771
run: |
6872
python -m pip install --upgrade pip
6973
pip install packaging
7074
pip install riot==0.19.1
71-
pip install hatch~=1.8.0 hatch-containers==0.7.0
7275
7376
- name: Run regenerate-riot-latest
7477
run: scripts/regenerate-riot-latest.sh

.github/workflows/unit_tests.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ jobs:
3838
run: rustup update stable && rustup default stable && rustup component add rustfmt clippy
3939

4040
- name: Install hatch
41-
run: pip install hatch
41+
uses: pypa/hatch@install
42+
with:
43+
version: "1.12.0"
4244

4345
- name: Run tests
4446
run: hatch run ddtrace_unit_tests:test

.readthedocs.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ build:
55
python: "3.10"
66
commands:
77
- git fetch --unshallow || true
8-
- pip install hatch~=1.8.0 hatch-containers==0.7.0
8+
- curl -L https://github.com/pypa/hatch/releases/download/hatch-v1.12.0/hatch-x86_64-unknown-linux-gnu.tar.gz | tar zx
9+
- install -t /usr/local/bin hatch
10+
- hatch -q
911
- curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y
1012
- echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> "$BASH_ENV"
1113
- hatch -v run docs:sphinx-build -W -b html docs docs/_build/html

docker/Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
FROM debian:buster-20221219-slim
55

66
ARG TARGETARCH
7-
ARG HATCH_VERSION=1.8.1
7+
ARG HATCH_VERSION=1.12.0
88

99
# http://bugs.python.org/issue19846
1010
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
@@ -76,10 +76,9 @@ RUN git clone --depth 1 --branch v2.4.2 https://github.com/pyenv/pyenv "${PYENV_
7676
&& cd -
7777

7878
RUN if [ "$TARGETARCH" = "amd64" ]; \
79-
then curl -L https://github.com/pypa/hatch/releases/download/hatch-v${HATCH_VERSION}/hatch-${HATCH_VERSION}-x86_64-unknown-linux-gnu.tar.gz | tar zx; \
80-
else curl -L https://github.com/pypa/hatch/releases/download/hatch-v${HATCH_VERSION}/hatch-${HATCH_VERSION}-aarch64-unknown-linux-gnu.tar.gz | tar zx; \
79+
then curl -L https://github.com/pypa/hatch/releases/download/hatch-v${HATCH_VERSION}/hatch-x86_64-unknown-linux-gnu.tar.gz | tar zx; \
80+
else curl -L https://github.com/pypa/hatch/releases/download/hatch-v${HATCH_VERSION}/hatch-aarch64-unknown-linux-gnu.tar.gz | tar zx; \
8181
fi \
82-
&& mv hatch-${HATCH_VERSION}-* hatch \
8382
&& install -t /usr/local/bin hatch \
8483
&& hatch -q
8584

docs/contributing-testing.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ In addition, you will need `riot <https://ddriot.readthedocs.io/en/latest/>`_ an
3636
.. code-block:: bash
3737
3838
$ pip install riot==0.19.1
39-
$ pip install hatch~=1.8.0 hatch-containers==0.7.0
39+
40+
Refer `hatch install <https://hatch.pypa.io/latest/install/>`_ for installation instructions
4041

4142
Some of our test environments are managed with Riot, others with Hatch.
4243

hatch.toml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
[env]
2-
requires = [
3-
"hatch-containers==0.7.0",
4-
]
5-
61
[envs.lint]
72
detached = true
83
python = "3.10"
@@ -114,10 +109,6 @@ build = [
114109
"scripts/docs/build.sh",
115110
]
116111

117-
[envs.docs.overrides]
118-
# Local MacOS development requires Docker containers
119-
platform.macos.type = { value = "container" }
120-
121112
[envs.slotscheck]
122113
template = "slotscheck"
123114
python = "3.10"

scripts/ddtest

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ fi
1212
# retry docker pull if fails
1313
for i in {1..3}; do docker-compose pull -q testrunner && break || sleep 3; done
1414

15-
FULL_CMD="pip install -q --disable-pip-version-check riot==0.19.1 hatch && $CMD"
15+
# DEV: Removing hatch==1.12.0 from this command results in weird failure
16+
# in which building dd-trace-py fails as it can't find clang compiler for some
17+
# venvs using Python 3.11.
18+
FULL_CMD="pip install -q --disable-pip-version-check riot==0.19.1 hatch==1.12.0 && $CMD"
1619

1720

1821
# install and upgrade riot in case testrunner image has not been updated

scripts/docs/build.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
#!/usr/bin/env bash
22
set -eux
33

4+
# DEV: unless it's built with editable, following sphinx-build fails
5+
if [ -z ${CIRCLECI+x} ]; then
6+
CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) pip install -v -e .
7+
fi
8+
9+
if [[ "$(uname)" == "Darwin" ]]; then
10+
export PYENCHANT_LIBRARY_PATH=/opt/homebrew/lib/libenchant-2.dylib
11+
fi
12+
413
reno lint
514
sphinx-build -vvv -W -b spelling docs docs/_build/html
615
sphinx-build -vvv -W -b html docs docs/_build/html

scripts/docs/install.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@ elif [[ "${READTHEDOCS}" = "True" ]]; then
88
# We skip here because we do not check spelling in RTD
99
echo "Skipping install"
1010
else
11+
if [[ "$(uname)" == "Darwin" ]]; then
12+
brew install enchant
13+
else
1114
export DEBIAN_FRONTEND="noninteractive"
1215
export DEBCONF_NOWARNINGS="yes"
1316

1417
apt-get -qq update
1518
apt-get -qy install --no-install-recommends libenchant-2-dev >/dev/null ||
1619
apt-get -qy install --no-install-recommends libenchant-dev >/dev/null
20+
fi
1721
fi

0 commit comments

Comments
 (0)