From 31071aae01b0b41001643dac649b4270d5bfed30 Mon Sep 17 00:00:00 2001 From: Robsdedude Date: Thu, 24 Apr 2025 17:55:21 +0200 Subject: [PATCH] Remove `neo4j-driver` package alias --- CHANGELOG.md | 3 +- bin/check-dist | 21 ++++++----- bin/dist-functions | 26 +++----------- bin/release | 41 +++++++++++---------- pyproject.toml | 7 ++-- setup.py | 84 ------------------------------------------- src/neo4j/__init__.py | 10 ------ src/neo4j/_meta.py | 1 - 8 files changed, 38 insertions(+), 155 deletions(-) delete mode 100755 setup.py diff --git a/CHANGELOG.md b/CHANGELOG.md index e15d2d1a..0f173b2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,8 @@ See also https://github.com/neo4j/neo4j-python-driver/wiki for a full changelog. ## NEXT RELEASE -- No breaking or major changes. +- Remove deprecated package alias `neo4j-driver`. Use `pip install neo4j` instead. +- Remove `setup.py`. Please use a recent enough packaging/build tool that supports `pyproject.toml` ## Version 5.28 diff --git a/bin/check-dist b/bin/check-dist index 8573eafe..54e96b78 100755 --- a/bin/check-dist +++ b/bin/check-dist @@ -13,17 +13,16 @@ then exit 1 else source "${ROOT}/bin/dist-functions" - for PACKAGE in "neo4j-driver" "neo4j"; do - NORMALIZED_PACKAGE="$(normalize_dist_name "$PACKAGE")" - if ! (check_file "${DIST}/${NORMALIZED_PACKAGE}-${VERSION}.tar.gz" \ - || check_file "${DIST}/${PACKAGE}-${VERSION}.tar.gz"); then - STATUS=1 - fi - if ! (check_file "${DIST}/${NORMALIZED_PACKAGE}-${VERSION}-py3-none-any.whl" \ - || check_file "${DIST}/${PACKAGE}-${VERSION}-py3-none-any.whl"); then - STATUS=1 - fi - done + PACKAGE="neo4j" + NORMALIZED_PACKAGE="$(normalize_dist_name "$PACKAGE")" + if ! (check_file "${DIST}/${NORMALIZED_PACKAGE}-${VERSION}.tar.gz" \ + || check_file "${DIST}/${PACKAGE}-${VERSION}.tar.gz"); then + STATUS=1 + fi + if ! (check_file "${DIST}/${NORMALIZED_PACKAGE}-${VERSION}-py3-none-any.whl" \ + || check_file "${DIST}/${PACKAGE}-${VERSION}-py3-none-any.whl"); then + STATUS=1 + fi fi exit ${STATUS} diff --git a/bin/dist-functions b/bin/dist-functions index 40122897..27a20bf4 100644 --- a/bin/dist-functions +++ b/bin/dist-functions @@ -29,16 +29,6 @@ function set_version sed -i 's/^version = .*/version = "'$1'"/g' "${SRC}/neo4j/_meta.py" } -function get_deprecated { - cd "${SRC}" - python -c "from neo4j._meta import deprecated_package; print(deprecated_package)" - cd - > /dev/null -} - -function set_deprecated { - sed -i 's/^deprecated_package = .*/deprecated_package = '$1'/g' "${SRC}/neo4j/_meta.py" -} - # distribution normalization according to PEP 625 https://peps.python.org/pep-0625/ function normalize_dist_name { @@ -62,7 +52,6 @@ function check_file function set_metadata_and_setup { PACKAGE="$1"; shift - DEPRECATED="$1"; shift VERSION="$1"; shift cd "${ROOT}" @@ -70,24 +59,20 @@ function set_metadata_and_setup # Capture original package metadata ORIGINAL_PACKAGE=$(get_package) ORIGINAL_VERSION=$(get_version) - ORIGINAL_DEPRECATED=$(get_deprecated) - echo "Source code originally configured for package ${ORIGINAL_PACKAGE}/${ORIGINAL_VERSION}/deprecated=${ORIGINAL_DEPRECATED}" + echo "Source code originally configured for package ${ORIGINAL_PACKAGE}/${ORIGINAL_VERSION}" echo "----------------------------------------" grep "package\s\+=" "${SRC}/neo4j/_meta.py" grep "version\s\+=" "${SRC}/neo4j/_meta.py" - grep "deprecated_package\s\+=" "${SRC}/neo4j/_meta.py" echo "----------------------------------------" function cleanup() { # Reset to original package metadata set_package "${ORIGINAL_PACKAGE}" set_version "${ORIGINAL_VERSION}" - set_deprecated "${ORIGINAL_DEPRECATED}" - echo "Source code reconfigured back to original package ${ORIGINAL_PACKAGE}/${ORIGINAL_VERSION}/deprecated=${ORIGINAL_DEPRECATED}" + echo "Source code reconfigured back to original package ${ORIGINAL_PACKAGE}/${ORIGINAL_VERSION}" echo "----------------------------------------" grep "package\s\+=" "${SRC}/neo4j/_meta.py" grep "version\s\+=" "${SRC}/neo4j/_meta.py" - grep "deprecated_package\s\+=" "${SRC}/neo4j/_meta.py" echo "----------------------------------------" } trap cleanup EXIT @@ -95,12 +80,10 @@ function set_metadata_and_setup # Temporarily override package metadata set_package "${PACKAGE}" set_version "${VERSION}" - set_deprecated "${DEPRECATED}" - echo "Source code reconfigured for package ${PACKAGE}/${VERSION}/deprecated=${DEPRECATED}" + echo "Source code reconfigured for package ${PACKAGE}/${VERSION}" echo "----------------------------------------" grep "package\s\+=" "${SRC}/neo4j/_meta.py" grep "version\s\+=" "${SRC}/neo4j/_meta.py" - grep "deprecated_package\s\+=" "${SRC}/neo4j/_meta.py" echo "----------------------------------------" # Create source distribution @@ -121,6 +104,5 @@ function setup { ARGS="$*" rm -rf ${DIST} 2> /dev/null - set_metadata_and_setup "neo4j-driver" "True" ${ARGS} # Legacy package; can be removed in 2.0 - set_metadata_and_setup "neo4j" "False" ${ARGS} + set_metadata_and_setup "neo4j" ${ARGS} } diff --git a/bin/release b/bin/release index 5ee1933b..d161b0e5 100755 --- a/bin/release +++ b/bin/release @@ -20,28 +20,27 @@ then fi source "${ROOT}/bin/dist-functions" -for PACKAGE in "neo4j-driver" "neo4j"; do - NORMALIZED_PACKAGE="$(normalize_dist_name "$PACKAGE")" +PACKAGE="neo4j" +NORMALIZED_PACKAGE="$(normalize_dist_name "$PACKAGE")" - if check_file "${DIST}/${NORMALIZED_PACKAGE}-${VERSION}.tar.gz" - then - TWINE_ARGS="${TWINE_ARGS} ${DIST}/${NORMALIZED_PACKAGE}-${VERSION}.tar.gz" - elif check_file "${DIST}/${PACKAGE}-${VERSION}.tar.gz"; then - TWINE_ARGS="${TWINE_ARGS} ${DIST}/${PACKAGE}-${VERSION}.tar.gz" - else - echo "Source distribution file for ${PACKAGE} not found" - exit 1 - fi +if check_file "${DIST}/${NORMALIZED_PACKAGE}-${VERSION}.tar.gz" +then + TWINE_ARGS="${TWINE_ARGS} ${DIST}/${NORMALIZED_PACKAGE}-${VERSION}.tar.gz" +elif check_file "${DIST}/${PACKAGE}-${VERSION}.tar.gz"; then + TWINE_ARGS="${TWINE_ARGS} ${DIST}/${PACKAGE}-${VERSION}.tar.gz" +else + echo "Source distribution file for ${PACKAGE} not found" + exit 1 +fi - if check_file "${DIST}/${NORMALIZED_PACKAGE}-${VERSION}-py3-none-any.whl" - then - TWINE_ARGS="${TWINE_ARGS} ${DIST}/${NORMALIZED_PACKAGE}-${VERSION}-py3-none-any.whl" - elif check_file "${DIST}/${PACKAGE}-${VERSION}-py3-none-any.whl"; then - TWINE_ARGS="${TWINE_ARGS} ${DIST}/${PACKAGE}-${VERSION}-py3-none-any.whl" - else - echo "Wheel distribution file for ${PACKAGE} not found" - exit 1 - fi -done +if check_file "${DIST}/${NORMALIZED_PACKAGE}-${VERSION}-py3-none-any.whl" +then + TWINE_ARGS="${TWINE_ARGS} ${DIST}/${NORMALIZED_PACKAGE}-${VERSION}-py3-none-any.whl" +elif check_file "${DIST}/${PACKAGE}-${VERSION}-py3-none-any.whl"; then + TWINE_ARGS="${TWINE_ARGS} ${DIST}/${PACKAGE}-${VERSION}-py3-none-any.whl" +else + echo "Wheel distribution file for ${PACKAGE} not found" + exit 1 +fi twine upload ${TWINE_ARGS} diff --git a/pyproject.toml b/pyproject.toml index 2cb07945..7f8acce1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,8 +17,7 @@ name = "neo4j" description = "Neo4j Bolt driver for Python" license = {text = "Apache License, Version 2.0"} -#TODO: 6.0 - static readme -#readme = "README.rst" +readme = "README.rst" authors = [ {name = "Neo4j, Inc.", email = "drivers@neo4j.com"}, ] @@ -42,7 +41,7 @@ classifiers = [ "Topic :: Software Development", "Typing :: Typed", ] -dynamic = ["version", "readme"] +dynamic = ["version"] [project.urls] Homepage = "https://neo4j.com/" @@ -68,8 +67,6 @@ requires = [ "setuptools == 68.0.0; python_version <= '3.7'", # dropped support for Python 3.7 in 68.1.0 "setuptools == 75.3.0; python_version == '3.8'", # dropped support for Python 3.8 in 75.4.0 "setuptools == 75.6.0; python_version >= '3.9'", - # TODO: 6.0 - can be removed once `setup.py` is simplified - "tomlkit == 0.12.5", # dropped support (at least CI testing) for Python 3.7 in 0.13.0 ] build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py deleted file mode 100755 index 1c043d11..00000000 --- a/setup.py +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) "Neo4j" -# Neo4j Sweden AB [https://neo4j.com] -# -# Licensed 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 -# -# https://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. - -# TODO: 6.0 - the whole deprecation and double naming shebang can be removed - - -import pathlib -import sys -from contextlib import contextmanager - -import tomlkit -from setuptools import setup - - -THIS_DIR = pathlib.Path(__file__).parent - -sys.path.insert(0, str(THIS_DIR / "src")) - -from neo4j._meta import ( # noqa: E402 import has to happen after sys path manipulation - deprecated_package as deprecated, - package, -) - - -readme_path = THIS_DIR / "README.rst" -readme = readme_path.read_text(encoding="utf-8") - -if deprecated: - readme = ( - """\ -.. warning:: - - This package is deprecated and will stop receiving updates starting with - version 6.0.0. Please install ``neo4j`` instead (which is an alias, i.e., - a drop-in replacement). See https://pypi.org/project/neo4j/ . - -""" - + readme - ) - - -pyproject_path = THIS_DIR / "pyproject.toml" - - -def change_project_name(new_name): - with pyproject_path.open("a+", encoding="utf-8") as fd: - fd.seek(0) - pyproject = tomlkit.parse(fd.read()) - old_name = pyproject["project"]["name"] - if old_name == new_name: - return None - pyproject["project"]["name"] = new_name - fd.seek(0) - fd.truncate() - tomlkit.dump(pyproject, fd) - return old_name - - -@contextmanager -def changed_package_name(new_name): - old_name = change_project_name(new_name) - try: - yield - finally: - if old_name is not None: - change_project_name(old_name) - - -with changed_package_name(package): - setup(long_description=readme) diff --git a/src/neo4j/__init__.py b/src/neo4j/__init__.py index f881e3c3..292a84f4 100644 --- a/src/neo4j/__init__.py +++ b/src/neo4j/__init__.py @@ -47,7 +47,6 @@ ) from ._data import Record from ._meta import ( - deprecated_package as _deprecated_package, deprecation_warn as _deprecation_warn, ExperimentalWarning, get_user_agent, @@ -227,12 +226,3 @@ def __getattr__(name) -> _t.Any: def __dir__() -> _t.List[str]: return __all__ - - -if _deprecated_package: - _deprecation_warn( - "The neo4j driver was installed under the package name `noe4j-driver` " - "which is deprecated and will stop receiving updates starting with " - "version 6.0.0. Please install `neo4j` instead (which is an alias, " - "i.e., a drop-in replacement). See https://pypi.org/project/neo4j/ ." - ) diff --git a/src/neo4j/_meta.py b/src/neo4j/_meta.py index c3d04b02..461c68dc 100644 --- a/src/neo4j/_meta.py +++ b/src/neo4j/_meta.py @@ -34,7 +34,6 @@ # Can be automatically overridden in builds package = "neo4j" version = "5.28.dev0" -deprecated_package = False def _compute_bolt_agent() -> dict[str, str]: