From fb8179d217dfb11e81c28076fc3bf14bdf9a0038 Mon Sep 17 00:00:00 2001 From: Leonard Richardson Date: Wed, 5 Apr 2023 10:49:29 -0400 Subject: Prepare for 4.12.1 release. --- CHANGELOG | 33 +++++++++++++++++---------------- doc/source/index.rst | 2 +- prepare-release.sh | 37 +++++++++++++++++++------------------ pyproject.toml | 10 +++++++++- 4 files changed, 46 insertions(+), 36 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 5baac68..0ed74b5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,10 +1,19 @@ -= 4.12.1 (Unreleased) += 4.12.1 (20230405) -This is the last version of Beautiful Soup known to support Python -3.6. Future versions might work under 3.6, but it's not officially -supported. +NOTE: the following things are likely to be dropped in the next +release of Beautiful Soup: -* The main improvement in this version is a nonrecursive technique + Official support for Python 3.6. + Inclusion of unit tests and test data in the wheel file. + Two scripts: demonstrate_parser_differences.py and test-all-versions. + +Changes: + +* This version of Beautiful Soup replaces setup.py and setup.cfg + with pyproject.toml. Beautiful Soup now uses tox as its test backend + and hatch to do builds. + +* The main functional improvement in this version is a nonrecursive technique for regenerating a tree. This technique is used to avoid situations where, in previous versions, doing something to a very deeply nested tree would overflow the Python interpreter stack: @@ -18,14 +27,6 @@ supported. 3. Pickling a BeautifulSoup object. (Note that pickling a Tag object can still cause an overflow.) -* Replaced setup.py and setup.cfg with pyproject.toml. Beautiful Soup - packages now uses hatch as its build backend. This results in some - minor changes to the build artifacts, e.g. wheels no longer include - the unit tests. - -* Added a tox.ini file to make it easier to run the test suite against all - supported versions of Python. - * Making a copy of a BeautifulSoup object no longer parses the document again, which should improve performance significantly. @@ -44,9 +45,9 @@ supported. a bug, but it shouldn't be an issue in normal use.) [bug=2007895] * The demonstrate_parser_differences.py script was still written in - Python 2. I've converted it to Python 3, but since no one noticed this - problem, it's a sign that no one uses this script and it's not - serving its purpose. I may rework or remove it in a later version. + Python 2. I've converted it to Python 3, but since no one has + mentioned this over the years, it's a sign that no one uses this + script and it's not serving its purpose. = 4.12.0 (20230320) diff --git a/doc/source/index.rst b/doc/source/index.rst index 7cc0f12..a43f560 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -20,7 +20,7 @@ with examples. I show you what the library is good for, how it works, how to use it, how to make it do what you want, and what to do when it violates your expectations. -This document covers Beautiful Soup version 4.12.0. The examples in +This document covers Beautiful Soup version 4.12.1. The examples in this documentation were written for Python 3.8. You might be looking for the documentation for `Beautiful Soup 3 diff --git a/prepare-release.sh b/prepare-release.sh index 599e92b..2f139d7 100644 --- a/prepare-release.sh +++ b/prepare-release.sh @@ -13,46 +13,47 @@ # bs4/__init__.py # doc/source/index.rst -# Make sure tests pass -python -m pytest bs4 +hatch clean +tox run-parallel -rm -rf build dist beautifulsoup4.egg-info - -# Make both sdist and wheels. -python3 setup.py sdist bdist_wheel +# Build sdist and wheel. +hatch build # Test the wheel locally. - rm -rf ../py3-install-test-virtualenv virtualenv -p /usr/bin/python3 ../py3-install-test-virtualenv source ../py3-install-test-virtualenv/bin/activate pip install dist/beautifulsoup4-*.whl pytest lxml html5lib soupsieve python -m pytest ../py3-install-test-virtualenv/lib/python3.10/site-packages/bs4/tests/ echo "EXPECT HTML ON LINE BELOW" -(cd .. && python -c "from bs4 import _s; print(_s('foo', 'html.parser'))") -# That should print 'foo' +(cd .. && which python && python -c "from bs4 import _s, __version__; print(__version__, _s('foo', 'lxml'))") +# That should print something like: +# /home/.../py3-install-test-virtualenv/bin/python +# [new version number] foo + deactivate rm -rf ../py3-install-test-virtualenv -# Upload to test -twine upload --repository-url https://test.pypi.org/legacy/ dist/* +# Upload to test pypi +hatch publish -r test # Test install from test pypi - rm -rf ../py3-install-test-virtualenv virtualenv -p /usr/bin/python3 ../py3-install-test-virtualenv source ../py3-install-test-virtualenv/bin/activate pip install pytest lxml html5lib -pip install -i https://testpypi.python.org/pypi beautifulsoup4 --extra-index-url=https://pypi.python.org/pypi +pip install -i https://testpypi.python.org/pypi beautifulsoup4 --extra-index-url=https://pypi.python.org/pypi python -m pytest ../py3-install-test-virtualenv/lib/python3.10/site-packages/bs4/tests/ echo "EXPECT HTML ON LINE BELOW" -(cd .. && python -c "from bs4 import _s; print(_s('foo', 'html.parser'))") -# That should print 'foo' +(cd .. && which python && python -c "from bs4 import _s, __version__; print(__version__, _s('foo', 'lxml'))") +# That should print something like: +# /home/.../py3-install-test-virtualenv/bin/python +# [new version number] foo deactivate rm -rf ../py3-install-test-virtualenv -# Upload for real -twine upload dist/* +# Upload to production pypi +hatch publish # Test install from production pypi @@ -61,7 +62,7 @@ virtualenv -p /usr/bin/python3 ../py3-install-test-virtualenv source ../py3-install-test-virtualenv/bin/activate pip install beautifulsoup4 echo "EXPECT HTML ON LINE BELOW" -(cd .. && python -c "from bs4 import _s; print(_s('foo', 'html.parser'))") +(cd .. && which python && python -c "from bs4 import _s, __version__; print(__version__, _s('foo', 'html.parser'))") # That should print 'foo' deactivate rm -rf ../py3-install-test-virtualenv diff --git a/pyproject.toml b/pyproject.toml index 7bd0740..31b0b7f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,7 +50,7 @@ path = "bs4/__init__.py" [tool.hatch.build.targets.sdist] include = [ - # The module itself. + # The module itself, and its unit tests. "/bs4/**/*.py", "/bs4/**/*.testcase", @@ -79,3 +79,11 @@ include = [ "/doc.ko/index.css", "/doc.ko/index.html", ] + + +[tool.hatch.build.targets.wheel] +include = [ + # The module itself, and its unit tests. + "/bs4/**/*.py", + "/bs4/**/*.testcase", +] \ No newline at end of file -- cgit v1.2.3