jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/971617 )
Change subject: [doc] Add some version hints
......................................................................
[doc] Add some version hints
Change-Id: I257cf42b37fb76bd09727206b716bb2c5ae9a034
---
M pywikibot/data/sparql.py
M pywikibot/page/_wikibase.py
M pywikibot/pagegenerators/_factory.py
3 files changed, 43 insertions(+), 20 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/data/sparql.py b/pywikibot/data/sparql.py
index 3417e32..85627aa 100644
--- a/pywikibot/data/sparql.py
+++ b/pywikibot/data/sparql.py
@@ -4,6 +4,7 @@
#
# Distributed under the terms of the MIT license.
#
+from textwrap import fill
from typing import Optional
from urllib.parse import quote
@@ -135,10 +136,14 @@
return result
def query(self, query: str, headers: Optional[Dict[str, str]] = None):
- """
- Run SPARQL query and return parsed JSON result.
+ """Run SPARQL query and return parsed JSON result.
+
+ .. versionchanged:: 8.5
+ :exc:``exceptions.NoUsernameError` is raised if the response
+ looks like the user is not logged in.
:param query: Query text
+ :raises NoUsernameError: User not logged in
"""
if headers is None:
headers = DEFAULT_HEADERS
@@ -165,15 +170,15 @@
# not in case the response otherwise might have it in between
strcontent = self.last_response.content.decode()
if (strcontent.startswith('<!DOCTYPE html>')
- and 'https://commons-query.wikimedia.org' in url):
- if ('Special:UserLogin' in strcontent
- or 'Special:OAuth' in strcontent):
- message = ('You need to log in to Wikimedia Commons '
- 'and give OAUTH permission. '
- 'Open https://commons-query.wikimedia.org '
- 'with browser to login and give permission.')
- raise NoUsernameError('User not logged in. ' + message)
-
+ and 'https://commons-query.wikimedia.org' in url
+ and ('Special:UserLogin' in strcontent
+ or 'Special:OAuth' in strcontent)):
+ raise NoUsernameError(fill(
+ 'User not logged in. You need to log in to Wikimedia '
+ 'Commons and give OAUTH permission. Open '
+ 'https://commons-query.wikimedia.org with browser to '
+ 'login and give permission.'
+ ))
return None
def ask(self, query: str,
diff --git a/pywikibot/page/_wikibase.py b/pywikibot/page/_wikibase.py
index 0b88472..e3da067 100644
--- a/pywikibot/page/_wikibase.py
+++ b/pywikibot/page/_wikibase.py
@@ -94,7 +94,7 @@
DATA_ATTRIBUTES: Dict[str, Any] = {}
- def __init__(self, repo, id_=None) -> None:
+ def __init__(self, repo, id_: Optional[str] = None) -> None:
"""
Initializer.
@@ -141,14 +141,14 @@
for key, cls in self.DATA_ATTRIBUTES.items():
setattr(self, key, cls.new_empty(self.repo))
- def _defined_by(self, singular: bool = False) -> dict:
+ def _defined_by(self, singular: bool = False) -> Dict[str, str]:
"""
Internal function to provide the API parameters to identify the entity.
An empty dict is returned if the entity has not been created yet.
:param singular: Whether the parameter names should use the singular
- form
+ form
:return: API parameters
"""
params = {}
@@ -159,7 +159,7 @@
params['ids'] = self.id
return params
- def getID(self, numeric: bool = False):
+ def getID(self, numeric: bool = False) -> Union[int, str]:
"""
Get the identifier of this entity.
@@ -406,6 +406,8 @@
"""
Internal function to provide the API parameters to identify the entity.
+ .. versionadded:: 8.5
+
:param singular: Whether the parameter names should use the singular
form
:raise NoWikibaseEntityError: if this entity is associated with
@@ -500,13 +502,16 @@
>>> page = pywikibot.FilePage(repo, 'File:Sandbox-Test.svg')
>>> item = page.data_item()
>>> item.editLabels({'en': 'Test file.'}) # doctest: +SKIP
+
+ .. versionadded:: 8.5
"""
data = {'labels': labels}
self.editEntity(data, **kwargs)
def addClaim(self, claim, bot: bool = True, **kwargs):
- """
- Add a claim to the MediaInfo.
+ """Add a claim to the MediaInfo.
+
+ .. versionadded:: 8.5
:param claim: The claim to add
:type claim: pywikibot.page.Claim
@@ -525,8 +530,9 @@
claim.on_item = self
def removeClaims(self, claims, **kwargs) -> None:
- """
- Remove the claims from the MediaInfo.
+ """Remove the claims from the MediaInfo.
+
+ .. versionadded:: 8.5
:param claims: list of claims to be removed
:type claims: list or pywikibot.Claim
diff --git a/pywikibot/pagegenerators/_factory.py b/pywikibot/pagegenerators/_factory.py
index 4a19361..6c26176 100644
--- a/pywikibot/pagegenerators/_factory.py
+++ b/pywikibot/pagegenerators/_factory.py
@@ -913,7 +913,10 @@
return self._parse_log_events(*params)
def _handle_redirect(self, value: str) -> HANDLER_RETURN_TYPE:
- """Handle `-redirect` argument."""
+ """Handle `-redirect` argument.
+
+ .. versionadded:: 8.5
+ """
if not value:
# True by default
value = 'true'
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/971617
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: I257cf42b37fb76bd09727206b716bb2c5ae9a034
Gerrit-Change-Number: 971617
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/971615 )
Change subject: [8.6] Prepare next release
......................................................................
[8.6] Prepare next release
Change-Id: I21e72f51b0446f015e9236ceeb4e2d1a64dc3ec3
---
M .appveyor.yml
M ROADMAP.rst
M pywikibot/__metadata__.py
M HISTORY.rst
M scripts/__init__.py
5 files changed, 33 insertions(+), 16 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/.appveyor.yml b/.appveyor.yml
index f374f7f..cf53988 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -1,7 +1,7 @@
image: Visual Studio 2022
clone_depth: 50
skip_tags: true
-version: 8.5.{build}
+version: 8.6.{build}
environment:
PYWIKIBOT_DIR: "%appdata%\\Pywikibot"
diff --git a/HISTORY.rst b/HISTORY.rst
index ac0003a..272ffcb 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -1,5 +1,24 @@
Release history
===============
+
+8.5.0
+-----
+*05. November 2023*
+
+* Add a pagegenerators filter option to check if a page is redirect (:phab:`T261549`)
+* Add support for ``vikidia:nl`` site
+* Replace MediaWiki API deprecated ``inprop=preload`` with ``preloadcontent`` (:phab:`T348910`)
+* Remove check for purge right from APISite.purgepages (:phab:`T349348`)
+* Add MediaInfo editLabels, AddClaim and removeClaim functions (:phab:`T348422`)
+* Drop unused ``Family.use_hard_category_redirects`` (:phab:`T348953`)
+* No longer drop site decorators for optimized codes (:phab:`T74424`)
+* Improve handling of uninitialized MediaInfo
+* Add support for ``vikidia:ar`` site
+* Make exception about missing mediainfo more friendly
+* L10N and i18n updates
+* Give visible error to user when there are no rights (:phab:`T345342`)
+
+
8.4.0
-----
*07. October 2023*
diff --git a/ROADMAP.rst b/ROADMAP.rst
index 6936180..bcf1442 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,19 +1,8 @@
Current release
---------------
-* Add a pagegenerators filter option to check if a page is redirect (:phab:`T261549`)
-* Add support for ``vikidia:nl`` site
-* Replace MediaWiki API deprecated ``inprop=preload`` with ``preloadcontent`` (:phab:`T348910`)
-* Remove check for purge right from APISite.purgepages (:phab:`T349348`)
-* Add MediaInfo editLabels, AddClaim and removeClaim functions (:phab:`T348422`)
-* Drop unused ``Family.use_hard_category_redirects`` (:phab:`T348953`)
-* No longer drop site decorators for optimized codes (:phab:`T74424`)
-* Improve handling of uninitialized MediaInfo
-* Add support for ``vikidia:ar`` site
-* Make exception about missing mediainfo more friendly
-* L10N and i18n updates
-* Give visible error to user when there are no rights (:phab:`T345342`)
-* **Python 3.6 support will be discontinued** and this is the last version supporting it.
+* (no changes yet)
+* **Python 3.6 support will be discontinued soon**.
Deprecations
diff --git a/pywikibot/__metadata__.py b/pywikibot/__metadata__.py
index 980be8e..b385c6f 100644
--- a/pywikibot/__metadata__.py
+++ b/pywikibot/__metadata__.py
@@ -11,7 +11,7 @@
__name__ = 'pywikibot'
-__version__ = '8.5.0'
+__version__ = '8.6.0.dev0'
__description__ = 'Python MediaWiki Bot Framework'
__maintainer__ = 'The Pywikibot team'
__maintainer_email__ = 'pywikibot(a)lists.wikimedia.org'
diff --git a/scripts/__init__.py b/scripts/__init__.py
index f0a0608..70309c2 100644
--- a/scripts/__init__.py
+++ b/scripts/__init__.py
@@ -29,4 +29,4 @@
#
# Distributed under the terms of the MIT license.
#
-__version__ = '8.5.0'
+__version__ = '8.6.0'
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/971615
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: I21e72f51b0446f015e9236ceeb4e2d1a64dc3ec3
Gerrit-Change-Number: 971615
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <dalangi-ctr(a)wikimedia.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/971609 )
Change subject: [doc] Update ROADMAP.rst and CHANGELOG.rst
......................................................................
[doc] Update ROADMAP.rst and CHANGELOG.rst
Change-Id: I7d0ac0406e618e7286d060b6004c1ac066e4b05c
---
M ROADMAP.rst
M scripts/CHANGELOG.rst
2 files changed, 34 insertions(+), 0 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/ROADMAP.rst b/ROADMAP.rst
index 42ac05d..6936180 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,6 +1,18 @@
Current release
---------------
+* Add a pagegenerators filter option to check if a page is redirect (:phab:`T261549`)
+* Add support for ``vikidia:nl`` site
+* Replace MediaWiki API deprecated ``inprop=preload`` with ``preloadcontent`` (:phab:`T348910`)
+* Remove check for purge right from APISite.purgepages (:phab:`T349348`)
+* Add MediaInfo editLabels, AddClaim and removeClaim functions (:phab:`T348422`)
+* Drop unused ``Family.use_hard_category_redirects`` (:phab:`T348953`)
+* No longer drop site decorators for optimized codes (:phab:`T74424`)
+* Improve handling of uninitialized MediaInfo
+* Add support for ``vikidia:ar`` site
+* Make exception about missing mediainfo more friendly
+* L10N and i18n updates
+* Give visible error to user when there are no rights (:phab:`T345342`)
* **Python 3.6 support will be discontinued** and this is the last version supporting it.
diff --git a/scripts/CHANGELOG.rst b/scripts/CHANGELOG.rst
index f87830d..bdc4501 100644
--- a/scripts/CHANGELOG.rst
+++ b/scripts/CHANGELOG.rst
@@ -1,6 +1,19 @@
Scripts Changelog
=================
+8.5.0
+-----
+
+category_graph
+~~~~~~~~~~~~~~
+
+* Change category output string to format string (:phab:`T348709`)
+
+commonscat
+~~~~~~~~~~
+
+* Fix skip page template parameter check (:phab:`T106952`)
+
8.4.0
-----
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/971609
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: I7d0ac0406e618e7286d060b6004c1ac066e4b05c
Gerrit-Change-Number: 971609
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <dalangi-ctr(a)wikimedia.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/971606 )
Change subject: [IMPR] use process_cpu_count to select the default number of worker
......................................................................
[IMPR] use process_cpu_count to select the default number of worker
os.cpu_count() returns the total number of CPUs that the current
machinevhas. On Unix, sched_setaffinity() can reduce the number of CPU
"usable" by a process. With Python 3.13 os.process_cpu_count() can be
used to get the number of logical CPUs usable by the calling thread of
the current process. This patch uses os.process_cpu_count() like in
Python 3.13 to select the default number of worker for
concurrent.futures.
Change-Id: Id66f9bb32cec80206434f39277db7b4c62867ec3
---
M pywikibot/scripts/preload_sites.py
1 file changed, 28 insertions(+), 5 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/scripts/preload_sites.py b/pywikibot/scripts/preload_sites.py
index afda243..4d4799e 100755
--- a/pywikibot/scripts/preload_sites.py
+++ b/pywikibot/scripts/preload_sites.py
@@ -22,15 +22,19 @@
#
# Distributed under the terms of the MIT license.
#
-import os
from concurrent.futures import ThreadPoolExecutor, wait
from datetime import datetime
from typing import Optional, Union
import pywikibot
-from pywikibot.backports import List, Set, removeprefix
+from pywikibot.backports import Dict, List, Set, removeprefix
from pywikibot.family import Family
+try: # Python 3.13
+ from os import process_cpu_count # type: ignore[attr-defined]
+except ImportError:
+ from os import cpu_count as process_cpu_count
+
#: supported families by this script
families_list = [
@@ -44,7 +48,9 @@
'wiktionary',
]
-exceptions = {
+# Ignore sites from preloading
+# example: {'wikiversity': ['beta'], }
+exceptions: Dict[str, List[str]] = {
}
@@ -80,8 +86,8 @@
"""
start = datetime.now()
if worker is None:
- # Python 3.8 default
- worker = min(32, (os.cpu_count() or 1) + 4)
+ # Python 3.13 default
+ worker = min(32, (process_cpu_count() or 1) + 4)
# to allow adding futures in preload_family the workers must be one
# more than families are handled
worker = max(len(families) * 2, worker)
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/971606
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: Id66f9bb32cec80206434f39277db7b4c62867ec3
Gerrit-Change-Number: 971606
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged