jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/987776 )

Change subject: [cleanup] No longer require setuptools because packaging is used
......................................................................

[cleanup] No longer require setuptools because packaging is used

pkg_resources was replaced with importlib.metadata and packaging.
Therefore vendor package of setuptools is no longer required.

Bug: T340640
Bug: T347052
Change-Id: I8495ee84985e669ede3a32f1982da10e6034f6a5
---
M README.rst
M .github/workflows/doctest.yml
M .github/workflows/write_tests-ci.yml
M setup.py
M .github/workflows/oauth_tests-ci.yml
M .github/workflows/pywikibot-ci.yml
M tests/tools_tests.py
M make_dist.py
M requirements.txt
M pywikibot/scripts/version.py
M .github/workflows/login_tests-ci.yml
11 files changed, 24 insertions(+), 30 deletions(-)

Approvals:
  JJMC89: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/.github/workflows/doctest.yml b/.github/workflows/doctest.yml
index 496cc31..7805c82 100644
--- a/.github/workflows/doctest.yml
+++ b/.github/workflows/doctest.yml
@@ -58,9 +58,7 @@
         pip install packaging
         pip install "PyMySQL >= 1.0.0"
         pip install pytest
-        pip install -U setuptools
         pip install "sseclient<0.0.23,>=0.0.18"
-        python -c "import setuptools; print('setuptools:', 
setuptools.__version__)"

     - name: Generate user files
       run: |
diff --git a/.github/workflows/login_tests-ci.yml 
b/.github/workflows/login_tests-ci.yml
index bac844f..bcf58d4 100644
--- a/.github/workflows/login_tests-ci.yml
+++ b/.github/workflows/login_tests-ci.yml
@@ -82,8 +82,6 @@
         pip install mwparserfromhell
         pip install packaging
         pip install requests
-        pip install -U setuptools
-        python -c "import setuptools; print('setuptools:', 
setuptools.__version__)"

     - name: Generate family files
       run: |
diff --git a/.github/workflows/oauth_tests-ci.yml 
b/.github/workflows/oauth_tests-ci.yml
index 1b3f0a3..2223ebf 100644
--- a/.github/workflows/oauth_tests-ci.yml
+++ b/.github/workflows/oauth_tests-ci.yml
@@ -90,8 +90,6 @@
         pip install mwoauth
         pip install packaging
         pip install requests
-        pip install -U setuptools
-        python -c "import setuptools; print('setuptools:', 
setuptools.__version__)"

     - name: Generate family files
       if:  ${{ matrix.family == 'wpbeta' }}
diff --git a/.github/workflows/pywikibot-ci.yml 
b/.github/workflows/pywikibot-ci.yml
index 8d16258..4ae59a3 100644
--- a/.github/workflows/pywikibot-ci.yml
+++ b/.github/workflows/pywikibot-ci.yml
@@ -89,11 +89,9 @@
       run: |
         python -m pip install --upgrade pip
         pip --version
-        pip install -U setuptools
         if [ -f dev-requirements.txt ]; then pip install -r 
dev-requirements.txt; fi
         if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
         pip install wikitextparser
-        python -c "import setuptools; print('setuptools:', 
setuptools.__version__)"

     - name: Generate family files
       run: |
diff --git a/.github/workflows/write_tests-ci.yml 
b/.github/workflows/write_tests-ci.yml
index 06cf699..756add1 100644
--- a/.github/workflows/write_tests-ci.yml
+++ b/.github/workflows/write_tests-ci.yml
@@ -43,10 +43,8 @@
       run: |
         python -m pip install --upgrade pip
         pip --version
-        pip install -U setuptools
         if [ -f dev-requirements.txt ]; then pip install -r 
dev-requirements.txt; fi
         if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
-        python -c "import setuptools; print('setuptools:', 
setuptools.__version__)"

     - name: Generate user files
       run: |
diff --git a/README.rst b/README.rst
index 7064b6b..e80988e 100644
--- a/README.rst
+++ b/README.rst
@@ -62,7 +62,6 @@

 .. code:: text

-    pip install -U setuptools
     pip install pywikibot
     pwb <scriptname>

diff --git a/make_dist.py b/make_dist.py
index 3b1fcb4..8dc2a13 100755
--- a/make_dist.py
+++ b/make_dist.py
@@ -37,7 +37,6 @@
    - *nodist* option was added

 .. versionchanged:: 8.1
-   Python 3.7+ required because *dataclasses* module is used.
    *nodist* option was removed, *clear* option does not create a
    distribution. *local* and *remote* option clears old distributions
    first.
@@ -46,7 +45,7 @@
    option also installs packages if necessary.
 """
 #
-# (C) Pywikibot team, 2022-2023
+# (C) Pywikibot team, 2022-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -201,9 +200,6 @@
 def handle_args() -> tuple[bool, bool, bool, bool]:
     """Handle arguments and print documentation if requested.

-    Read arguments from `sys.argv` and adjust it passing `sdist` to
-    `setuptools.setup`.
-
     :return: Return whether dist is to be installed locally or to be
         uploaded
     """
diff --git a/pywikibot/scripts/version.py b/pywikibot/scripts/version.py
index 9e1f129..b0e1156 100755
--- a/pywikibot/scripts/version.py
+++ b/pywikibot/scripts/version.py
@@ -5,7 +5,7 @@
    version script was moved to the framework scripts folder
 """
 #
-# (C) Pywikibot team, 2007-2022
+# (C) Pywikibot team, 2007-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -27,9 +27,9 @@


 try:
-    import setuptools
+    import packaging
 except ImportError:
-    setuptools = DummyModule()
+    packaging = DummyModule()

 try:
     import mwparserfromhell
@@ -54,7 +54,7 @@
     """Print pywikibot version and important settings."""
     pywikibot.info('Pywikibot: ' + getversion())
     pywikibot.info('Release version: ' + pywikibot.__version__)
-    pywikibot.info('setuptools version: ' + setuptools.__version__)
+    pywikibot.info('packaging version: ' + packaging.__version__)
     pywikibot.info('mwparserfromhell version: ' + mwparserfromhell.__version__)
     pywikibot.info('wikitextparser version: ' + wikitextparser.__version__)
     pywikibot.info('requests version: ' + requests.__version__)
diff --git a/requirements.txt b/requirements.txt
index 249a822..6bdd15f 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -22,8 +22,6 @@
 mwparserfromhell>=0.5.2
 packaging
 requests>=2.21.0
-setuptools>=48.0.0 ; python_version >= '3.10'
-setuptools>=40.8.0 ; python_version < '3.10'

 # MediaWiki markup parser
 # mwparserfromhell is mandatory but wikitextparser can be used instead
diff --git a/setup.py b/setup.py
index 51ebfaf..c38db44 100755
--- a/setup.py
+++ b/setup.py
@@ -20,7 +20,7 @@
 .. warning: do not upload a development release to pypi.
 """
 #
-# (C) Pywikibot team, 2009-2023
+# (C) Pywikibot team, 2009-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -93,9 +93,6 @@
     'mwparserfromhell>=0.5.2',
     'packaging',
     'requests>=2.21.0',
-    # PEP 440
-    'setuptools>=48.0.0 ; python_version >= "3.10"',
-    'setuptools>=40.8.0 ; python_version < "3.10"',
 ]

 # ------- setup tests_require ------- #
diff --git a/tests/tools_tests.py b/tests/tools_tests.py
index 4f3d41d..070c545 100755
--- a/tests/tools_tests.py
+++ b/tests/tools_tests.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 """Test tools package alone which don't fit into other tests."""
 #
-# (C) Pywikibot team, 2015-2023
+# (C) Pywikibot team, 2015-2024
 #
 # Distributed under the terms of the MIT license.
 from __future__ import annotations
@@ -847,8 +847,8 @@

     def test_when_present(self):
         """Test when the module is available."""
-        self.assertTrue(has_module('setuptools'))
-        self.assertTrue(has_module('setuptools', '1.0'))
+        self.assertTrue(has_module('requests'))
+        self.assertTrue(has_module('requests', '1.0'))

     def test_when_missing(self):
         """Test when the module is unavailable."""
@@ -859,7 +859,7 @@
         ImportWarning)
     def test_when_insufficient_version(self):
         """Test when the module is older than what we need."""
-        self.assertFalse(has_module('setuptools', '99999'))
+        self.assertFalse(has_module('requests', '99999'))


 class TestStringFunctions(TestCase):

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/987776
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I8495ee84985e669ede3a32f1982da10e6034f6a5
Gerrit-Change-Number: 987776
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: JJMC89 <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to