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

Switch from setuptools to hatchling #1551

Merged
merged 4 commits into from
Aug 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .ci/variables.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"prerequisite_versions": {
"HATCH": "1.3.1",
"HATCHLING": "1.6.0",
"PIP": "22.2",
"WHEEL": "0.37.1"
},
Expand Down
12 changes: 0 additions & 12 deletions MANIFEST.in

This file was deleted.

6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ PIP_WRAPPER = $(PY_BIN) -m pip
export PY38 = $(shell jq -r '.python_versions.PY38' .ci/variables.json)
export PY39 = $(shell jq -r '.python_versions.PY39' .ci/variables.json)
export PY310 = $(shell jq -r '.python_versions.PY310' .ci/variables.json)
export HATCH_VERSION = $(shell jq -r '.prerequisite_versions.HATCH' .ci/variables.json)
export HATCHLING_VERSION = $(shell jq -r '.prerequisite_versions.HATCHLING' .ci/variables.json)
export PIP_VERSION = $(shell jq -r '.prerequisite_versions.PIP' .ci/variables.json)
export WHEEL_VERSION = $(shell jq -r '.prerequisite_versions.WHEEL' .ci/variables.json)
VIRTUAL_ENV ?= .venv
Expand Down Expand Up @@ -59,7 +61,7 @@ check-venv:
fi

install-user: venv-create
. $(VENV_ACTIVATE_FILE); $(PIP_WRAPPER) install --upgrade pip==$(PIP_VERSION) wheel==$(WHEEL_VERSION)
. $(VENV_ACTIVATE_FILE); $(PIP_WRAPPER) install --upgrade hatch==$(HATCH_VERSION) hatchling==$(HATCHLING_VERSION) pip==$(PIP_VERSION) wheel==$(WHEEL_VERSION)
. $(VENV_ACTIVATE_FILE); $(PIP_WRAPPER) install -e .

install: install-user
Expand Down Expand Up @@ -89,7 +91,7 @@ tox-env-clean:
rm -rf .tox

lint: check-venv
@. $(VENV_ACTIVATE_FILE); find esrally benchmarks scripts tests it setup.py -name "*.py" -exec pylint -j0 -rn --rcfile=$(CURDIR)/.pylintrc \{\} +
@. $(VENV_ACTIVATE_FILE); find esrally benchmarks scripts tests it -name "*.py" -exec pylint -j0 -rn --rcfile=$(CURDIR)/.pylintrc \{\} +
@. $(VENV_ACTIVATE_FILE); black --check --diff .
@. $(VENV_ACTIVATE_FILE); isort --check --diff .

Expand Down
4 changes: 1 addition & 3 deletions docker/Dockerfiles/Dockerfile-dev
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ RUN apt-get -y update && \
rm -rf /var/lib/apt/lists/*

RUN mkdir -p /rally/esrally
COPY setup.py /rally/
COPY pyproject.toml /rally/
COPY README.md /rally/
COPY MANIFEST.in /rally/
COPY esrally/ /rally/esrally/

RUN python3 -m venv /rally/venv
Expand All @@ -24,7 +22,7 @@ WORKDIR /rally
# Wipe away any lingering caches, copied over from the local machine
RUN find /rally -name "__pycache__" -exec rm -rf -- \{\} \; 2>/dev/null || true
RUN find /rally -name ".pyc" -exec rm -rf -- \{\} \; 2>/dev/null || true
RUN pip3 install --upgrade pip wheel
RUN pip3 install --upgrade hatch hatchling pip wheel
RUN pip3 install /rally

################################################################################
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfiles/Dockerfile-release
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN apt-get -y update && \
RUN groupadd --gid 1000 rally && \
useradd -d /rally -m -k /dev/null -g 1000 -N -u 1000 -l -s /bin/bash rally

RUN pip3 install --upgrade pip wheel
RUN pip3 install --upgrade hatch hatchling pip wheel
RUN pip3 install esrally==$RALLY_VERSION

WORKDIR /rally
Expand Down
2 changes: 1 addition & 1 deletion docs/create_scheduler_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import sys

# we don't include matplotlib in setup.py as it's just a development dependency
# we don't add matplotlib as a dependency as it's infrequently used and heavy
try:
import matplotlib
import matplotlib.pyplot as plt
Expand Down
10 changes: 7 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.version]
path = "esrally/_version.py"


[project]
name = "esrally"
Expand Down Expand Up @@ -93,7 +97,7 @@ develop = [
"sphinx==4.2.0",
"furo==2022.06.21",
"twine==1.15.0",
"wheel==0.33.6",
"wheel==0.37.1",
"github3.py==1.3.0",
"pylint==2.6.0",
"black==22.3.0",
Expand Down
8 changes: 3 additions & 5 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,17 @@ then
fi

echo "Updating changelog"
# For exit on error to work we have to separate
# For exit on error to work we have to separate
# CHANGELOG.md generation into two steps.
CHANGELOG="$(python3 changelog.py ${RELEASE_VERSION})"
printf "$CHANGELOG\n\n$(cat CHANGELOG.md)" > CHANGELOG.md
git commit -a -m "Update changelog for Rally release $RELEASE_VERSION"

# * Update version in `setup.py` and `docs/conf.py`
echo "Updating release version number"
printf '__version__ = "%s"\n' $RELEASE_VERSION > esrally/_version.py
git commit -a -m "Bump version to $RELEASE_VERSION"

# --upgrade is required for virtualenv
python3 setup.py develop --upgrade
pip install --editable .

# Check version
if ! [[ $(esrally --version) =~ "esrally ${RELEASE_VERSION} (git revision" ]]
Expand All @@ -68,7 +66,7 @@ then
fi

# Build new version
python3 setup.py bdist_wheel
hatch build -t wheel
# Upload to PyPI with retries in case of authentication failure
printf "\033[0;31mUploading to PyPI. Please enter your credentials ...\033[0m\n"
for i in 1 2 3 4 5; do twine upload dist/esrally-${RELEASE_VERSION}-*.whl && break || sleep 1; done
Expand Down
34 changes: 0 additions & 34 deletions setup.py

This file was deleted.