Manual:Pywikibot/Instalación

This page is a translated version of the page Manual:Pywikibot/Installation and the translation is 66% complete.
Outdated translations are marked like this.
Esta páxina va ayudate nos primeros pasos con Pywikibot, yá sía nel to propiu ordenador, en Toolforge, o usando PAWS: A Web Shell.
En PAWS

PAWS: A Web Shell ye la manera más cenciella d'empezar con Pywikibot. Nun se precisa nenguna instalación, y utilices una interfaz web pa unviar comandos.

Nel to propiu ordenador

Esta páxina ayudaráte colos primeros pasos pa instalar y executar Pywikibot nos tos ordenadores. Esti procesu tien cuatro pasos principales:

Toolforge t'ufre una infraestructura d'agospiamientu estable que te permite executar bots de contino o nun horariu determináu.

Instalar Python

Descarga ya instala Python dende https://www.python.org/downloads/.

Si yá instalasti Python, comprueba si la to versión ye recién abondo executando python --version nuna consola. To discover if Python version 3 or above is installed, run python3 --version in a console.

Ubuntu 19.04 and up comes with versions 2 & 3 installed. Python v2 runs by default using terminal command python; to use v3, use terminal command python3.

Python 3.7 or higher is currently required to run the bot.

On Windows please do not forget to modify PATH environment variable to make Python and pip work properly.

Instalar les dependencies

Additional packages are required to run Pywikibot. Run the following command to install these packages:

$ python -m pip install "requests>=2.20.1"
$ python -m pip install "mwparserfromhell>=0.5.2"
$ python -m pip install packaging

For Python 3.7 an additional package is required. Install it with:

$ python -m pip install importlib_metadata

An alternate MediaWiki markup parser may be installed with:

$ python -m pip install "wikitextparser>=0.47.5"

See also https://doc.wikimedia.org/pywikibot/stable/introduction.html#quick-start

Instalar Pywikibot

$ python -m pip install pywikibot

If using pip, use pwb instead of python pwb.py in examples below.

Descargar el Pywikibot actual stable: .tar.gz, .zip.

Desempaqueta el ficheru descargáu, por casu en ~/pywikibot o en %USERPROFILE%\pywikibot.

Alternativamente, puedes recuperar la última versión usando git o un veceru svn dende Gerrit, consulta Manual:Pywikibot/Gerrit#For users . Esta ye la manera encamentada pa que los operadores de bot activos y los desendolcadores usen Pywikibot.

Hai versiones más antigües disponibles en https://pywikibot.toolforge.org/.

Anovar Pywikibot

Ten actualizada la infraestructura del to bot. Salen nueves versiones de siguío, y tán disponibles nel mesmu llugar.

Si tas usando la versión de git o svn, puedes saltar esta nota. Otramiente, sé consciente de que precises faer copia de los ficheros de configuración y scripts («user-config.py», cualquier ficheru de la familia, o script personalizáu que creares o editares, y cualquier ficheru actual de volcáu XML que teas usando pa una wiki) antes d'instalar una nueva versión.

Desempaqueta la nueva versión sobre la versión antigua, sobreescribiendo tolos ficheros.

Configurar Pywikibot

Abre Terminal nos sistemes tipu-Unix (Linux/BSD/Solaris) o Símbolu del sistema en Windows (xeneralmente baxo les carpetes Sistema Windows o Accesorios del menú Toles aplicaciones o Tolos programes dientro del Menú d'entamu), y cambia de direutoriu a onde estraxisti Pywikibot:

Tipu-Unix (Linux/BSD/Solaris):
$ cd ~/core
Windows:
$ c:
$ cd "%USERPROFILE%\pywikibot"

Naturalmente, sustituye l'allugamientu pol direutoriu onde desempaquetaste Pywikibot.

Sigue col siguiente comandu pa xenerar el ficheru de configuración d'usuariu:

$ python pwb.py generate_user_files

Sigue les indicaciones pa configurar Pywikibot.

Finalmente, executa'l siguiente comandu p'aniciar sesión na to wiki:

$ python pwb.py login

Utilizar en wikis de terceros

Pywikibot ta pre-configuráu pa una gran cantidá de wikis; sicasí, posiblemente non pa la que quies utilizar. Visita Manual:Pywikibot/Use on third-party wikis pa saber cómo configurar Pywikibot pa la to wiki.

Más opciones de configuración

Pywikibot apurre una amplia gama d'opciones de configuración pa camudar el comportamientu del to bot. Puedes cambiar estes opciones nel ficheru user-config.py. Ver en config.py la llista de tolos parámetros que puedes usar.

Proxy configuration

Pywikibot relies on requests for communicating with the web. You can use HTTP_PROXY and HTTPS_PROXY environment variables to make requests use a proxy server. Refer to requests' documentation for more info.

Executar un script

Pywikibot trai nel paquete un gran númberu de scripts nel direutoriu scripts. Puedes executar toos estos usando:

$ python pwb.py [name of the script]

To learn more about running basic Pywikibot scripts, see:

La llista de tolos scripts ta disponible en $scripts.

Otres dependencies

La mayoría de los scripts nun riquen otros paquetes; sicasí, dalgunos nun funcionarán ensin ellos. La llista d'estos paquetes ta en requirements.txt xunto coles sos dependencies.

Pa instalar les dependencies de dalgún script, usa "pip", y executa'l siguiente comandu:

$ python -m pip install [name of the package]

Alternativamente, executa'l siguiente comandu pa instalar toles dependencies de tolos scripts d'una vegada:

$ python -m pip install -r requirements.txt


If you need more help on setting up your Pywikibot visit the #pywikibot IRC channel connect or pywikibot@ mailing list.