Skip to content

Remove neo4j-driver package alias #1161

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

Merged
merged 2 commits into from
Apr 28, 2025
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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ See also https://github.com/neo4j/neo4j-python-driver/wiki for a full changelog.

## NEXT RELEASE
- Python 3.7, 3.8, and 3.9 support has been dropped.
- 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
Expand Down
21 changes: 10 additions & 11 deletions bin/check-dist
Original file line number Diff line number Diff line change
Expand Up @@ -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}
26 changes: 4 additions & 22 deletions bin/dist-functions
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -62,45 +52,38 @@ function check_file
function set_metadata_and_setup
{
PACKAGE="$1"; shift
DEPRECATED="$1"; shift
VERSION="$1"; shift

cd "${ROOT}"

# 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

# 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
Expand All @@ -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}
}
41 changes: 20 additions & 21 deletions bin/release
Original file line number Diff line number Diff line change
Expand Up @@ -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}
7 changes: 2 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
]
Expand All @@ -39,7 +38,7 @@ classifiers = [
"Topic :: Software Development",
"Typing :: Typed",
]
dynamic = ["version", "readme"]
dynamic = ["version"]

[project.urls]
Homepage = "https://neo4j.com/"
Expand All @@ -63,8 +62,6 @@ pyarrow = ["pyarrow >= 1.0.0"]
[build-system]
requires = [
"setuptools == 75.6.0",
# 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"

Expand Down
84 changes: 0 additions & 84 deletions setup.py

This file was deleted.

10 changes: 0 additions & 10 deletions src/neo4j/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -227,12 +226,3 @@ def __getattr__(name) -> _t.Any:

def __dir__() -> 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/ ."
)
1 change: 0 additions & 1 deletion src/neo4j/_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down