diff --git a/.ci/variables.json b/.ci/variables.json index 64e7ce3af..4bdd64342 100644 --- a/.ci/variables.json +++ b/.ci/variables.json @@ -1,5 +1,7 @@ { "prerequisite_versions": { + "HATCH": "1.3.1", + "HATCHLING": "1.6.0", "PIP": "22.2", "WHEEL": "0.37.1" }, diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index fe21ee43e..000000000 --- a/MANIFEST.in +++ /dev/null @@ -1,12 +0,0 @@ -include CHANGELOG.md -include CONTRIBUTING.md -include LICENSE -include MANIFEST.in -include README.md -include setup.py -include esrally/min-es-version.txt -recursive-include docs * -recursive-include esrally/resources * -# recursive-exclude * __pycache__ -# recursive-exclude * *.py[co] -# prune docs/_build diff --git a/Makefile b/Makefile index 5a0504bd9..53f18daf5 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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 @@ -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 . diff --git a/docker/Dockerfiles/Dockerfile-dev b/docker/Dockerfiles/Dockerfile-dev index efcb8482b..4eb52c924 100644 --- a/docker/Dockerfiles/Dockerfile-dev +++ b/docker/Dockerfiles/Dockerfile-dev @@ -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 @@ -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 ################################################################################ diff --git a/docker/Dockerfiles/Dockerfile-release b/docker/Dockerfiles/Dockerfile-release index 6f87b2668..22dc13f6c 100644 --- a/docker/Dockerfiles/Dockerfile-release +++ b/docker/Dockerfiles/Dockerfile-release @@ -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 diff --git a/docs/create_scheduler_plot.py b/docs/create_scheduler_plot.py index 4afeb95db..bcc9d57da 100644 --- a/docs/create_scheduler_plot.py +++ b/docs/create_scheduler_plot.py @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 3bec61c73..0c56dfb2f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" @@ -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", diff --git a/release.sh b/release.sh index d9a1de582..7e57ab4ff 100755 --- a/release.sh +++ b/release.sh @@ -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" ]] @@ -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 diff --git a/setup.py b/setup.py deleted file mode 100644 index a31441798..000000000 --- a/setup.py +++ /dev/null @@ -1,34 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -import os.path -import re - -from setuptools import find_packages, setup - -with open(os.path.join(os.path.dirname(__file__), "esrally/_version.py")) as f: - raw_version = f.read().strip() - version = re.match(r'__version__ = "(.+)"', raw_version).group(1) - - -setup( - version=version, - packages=find_packages(where=".", exclude=("tests*", "benchmarks*", "it*")), - include_package_data=True, - package_data={"": ["*.json", "*.yml"]}, - zip_safe=False, -)