Skip to content

Commit

Permalink
Prepare project archival
Browse files Browse the repository at this point in the history
Final changes after moving the repository.
Fix some parts of the CI, disable others.
Add a script to prepare py2neo-archive distributions.
  • Loading branch information
robsdedude committed Oct 19, 2023
1 parent 7f57cbe commit d222682
Show file tree
Hide file tree
Showing 20 changed files with 2,146 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ jobs:
run: |
RELEASE=${{ steps.get_version.outputs.VERSION }} python setup.py sdist bdist_wheel
twine upload dist/*
READTHEDOCS_TOKEN="${{ secrets.READTHEDOCS_TOKEN }}" bin/publish-docs ${{ steps.get_version.outputs.VERSION }}
# READTHEDOCS_TOKEN="${{ secrets.READTHEDOCS_TOKEN }}" bin/publish-docs ${{ steps.get_version.outputs.VERSION }}
7 changes: 5 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ Py2neo

** **Please now consider this project to be EOL. There will be no more updates. It is recommended to use the official Neo4j drivers instead.** **

The version history of py2neo on PyPI got lost.
If you need an older version, you can install [`py2neo-archive`](https://pypi.org/project/py2neo-archive/) instead.

.. image:: https://img.shields.io/pypi/v/py2neo.svg
:target: https://pypi.python.org/pypi/py2neo
:alt: PyPI version
Expand All @@ -11,12 +14,12 @@ Py2neo
:target: https://pypi.python.org/pypi/py2neo
:alt: PyPI Downloads

.. image:: https://img.shields.io/github/license/technige/py2neo.svg
.. image:: https://img.shields.io/github/license/neo4j-contrib/py2neo.svg
:target: https://www.apache.org/licenses/LICENSE-2.0
:alt: License

.. image:: https://coveralls.io/repos/github/technige/py2neo/badge.svg?branch=master
:target: https://coveralls.io/github/technige/py2neo?branch=master
:target: https://coveralls.io/github/neo4j-contrib/py2neo?branch=master
:alt: Coverage Status


Expand Down
3 changes: 2 additions & 1 deletion bin/check-legal
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ function check_license {


function check_copyright {
YEAR=$(date +%Y)
#YEAR=$(date +%Y)
YEAR=2021 # when this project was abandoned
find "${SRC}" -type d \( -path "${SRC}/vendor" \) -prune -o -name '*.py' -print0 | xargs -0 grep -L -e "Copyright.* 20[0-9][0-9]-${YEAR}"
}

Expand Down
136 changes: 136 additions & 0 deletions bin/package-archive.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
#!/usr/bin/env bash

set -ex

function prepend_readme {
if [ -f README ]
then
readme_fn=README
elif [ -f README.rst ]; then
readme_fn=README.rst
elif [ -f README.md ]; then
readme_fn=README.md
else
echo "README not found!" 1>&2
exit 1
fi
echo -n "This is a copy of the py2neo package to restore the version history that got deleted.
It's not possible to re-upload a deleted version of a package to PyPI.
So if you rely on, for example, \`py2neo ~= 4.1.0\` in your project, you can simply switch to \`py2neo-archive ~= 4.1.0\`.
If your project works with py2neo 2021.2.3 or above, you can keep using \`py2neo\` as usual.
Note that this project will not get any updates past version 2021.2.3.
" | cat - $readme_fn > README.tmp && mv README.tmp $readme_fn
}

function check_install {
python3.8 -m venv venv_vendor
. venv_vendor/bin/activate
pip install .
deactivate
rm -r venv_vendor
}

function vendor_packages {
if grep -q -e 'interchange\|pansi' setup.py
then
python3.8 -m venv venv_vendor
. venv_vendor/bin/activate
pip install .
for dep in interchange pansi
do
if path=$(python -c "import $dep; print($dep.__path__[0])")
then
if [ -d py2neo/vendor/$dep ]
then
rm -r py2neo/vendor/$dep
fi
dep_name_count=$(grep -r --include "*.py" $dep py2neo | wc -l)
dep_import_count=$(grep -r --include "*.py" -E "from +$dep.* +import " py2neo | wc -l)
if [ "$dep_name_count" -ne "$dep_import_count" ]
then
grep -r --include "*.py" $dep py2neo
grep -r --include "*.py" -E "from +$dep.* +import " py2neo
echo "dep_name_count = $dep_name_count != $dep_import_count = dep_import_count" 1>&2
exit 1
fi
# vendor with relative imports
# while IFS= read -r -d '' fn
# do
# depth=$(echo "$fn" | grep -o "/" | wc -l)
# dots=$(for (( i = 0; i < "$depth"; ++i )); do echo -n "."; done)
# sed -i "s/\(from \+\)$dep\(.*import \+\)/\1${dots}_${dep}\2/g" "$fn"
# done < <(find py2neo -type f -name '*.py' -print0)
# vendor with absolute imports
find py2neo -type f -name '*.py' -print0 | xargs -0 sed -i "s/\(from \+\)$dep\(.*import \+\)/\1py2neo.vendor.$dep\2/g"
grep -r --include "*.py" "$dep" py2neo
echo "manually check this grep output!"
sed -i "/\"$dep/d" setup.py
mkdir -p py2neo/vendor
touch py2neo/vendor/__init__.py
cp -r $path py2neo/vendor/$dep
fi
done
deactivate
rm -r venv_vendor
fi
}

# releases with version and package hard-coded py2neo/__init__.py
for tag in release/1.6.2 release/1.6.3 py2neo-2.0 py2neo-2.0.1 py2neo-2.0.2 py2neo-2.0.3 py2neo-2.0.4 py2neo-2.0.5 py2neo-2.0.6 py2neo-2.0.7 py2neo-2.0.8 py2neo-2.0.9 py2neo-3.0.0 py2neo-3.1.0 py2neo-3.1.1 py2neo-3.1.2
do
export PATCHED_VERSION=$tag
git checkout $tag
prepend_readme
check_install
sed -i "s/\"name\": .*,/\"name\": \"py2neo-archive\",/" setup.py
sed -i "s/name=.*,/name=\"py2neo-archive\",/" setup.py
python setup.py sdist
git checkout -- .
done

# releases with version and package hard-coded py2neo/meta.py
for tag in py2neo-4.0.0b1 py2neo-4.0.0b2 py2neo-4.0.0 py2neo-4.1.0 py2neo-4.1.1 py2neo-4.1.2 py2neo-4.1.3 py2neo-4.3.0
do
export PATCHED_VERSION=$tag
git checkout $tag
prepend_readme
check_install
sed -i "s/\"name\": .*,/\"name\": \"py2neo-archive\",/" setup.py
python setup.py sdist
git checkout -- py2neo/meta.py
git checkout -- .
done

# releases with dev version (ending in .dev0) and package hard-coded py2neo/__init__.py
for tag in 5.0b2 5.0b3 5.0b4 5.0b5 2020.7b6
do
export PATCHED_VERSION=$tag
git checkout $tag
prepend_readme
check_install
sed -i "s/\"name\": .*,/\"name\": \"py2neo-archive\",/" setup.py
sed -i "s/__version__ = .*/__version__ = \"$tag\"/" py2neo/__init__.py
python setup.py sdist
git checkout -- .
done

# releases with dummy version loaded from VERSION file
for tag in 2020.0b9 2020.0rc1 2020.0.0 2020.1a1 2020.1.0 2020.1.1 2020.7b7 2020.7b8 2021.0.0 2021.0.1 2021.1.0 2021.1.1 2021.1.2 2021.1.3 2021.1.4 2021.1.5 2021.2.0 2021.2.1 2021.2.2 2021.2.3
do
export PATCHED_VERSION=$tag
git checkout $tag
prepend_readme
vendor_packages
sed -i "s/PACKAGE_NAME = .*/PACKAGE_NAME = \"py2neo-archive\"/" py2neo/meta.py
echo -n $tag > py2neo/VERSION
python setup.py sdist
git checkout -- .
done

# now call
#twine upload dist/py2neo-archive-*.tar.gz

# clean-up for development
#git checkout -- .; rm -r dist py2neo/interchange py2neo/_interchange py2neo/vendor/interchange py2neo/pansi py2neo/_pansi py2neo/vendor/pansi; rm -r venv_vendor/
4 changes: 3 additions & 1 deletion test/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
. # py2neo
./test/vendor/grolt

coverage
coveralls
grolt>=1.0.6
pytest
pytest-threadleak
26 changes: 26 additions & 0 deletions test/vendor/grolt/.coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[run]
branch = True
source = boltkit
omit =
**/__main__.py

[report]
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover

# Don't complain about missing debug-only code:
def __repr__
if self\.debug

# Don't complain if tests don't hit defensive assertion code:
raise AssertionError
raise NotImplementedError

# Don't complain if non-runnable code isn't run:
if 0:
if __name__ == .__main__.:

ignore_errors = True
show_missing = True
15 changes: 15 additions & 0 deletions test/vendor/grolt/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*~
*.py[co]
__pycache__
.pytest_cache
.idea

*.egg-info
dist
build

neo4j-community-*
neo4j-enterprise-*

.coverage
.tox
Loading

0 comments on commit d222682

Please sign in to comment.