Skip to content

Rfam fork of wikimedia/pywikibot for managing Rfam wiki content

License

Notifications You must be signed in to change notification settings

Rfam/rfam-pywikibot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pywikibot for Rfam

This is an Rfam fork of the [Pywikibot](https://github.com/wikimedia/pywikibot) framework with new scripts for managing [Rfam](http://rfam.org) data on Wikipedia and Wikimedia Commons.

The Pywikibot framework is a Python library that interfaces with the MediaWiki API version 1.14 or higher.

Also included are various general function scripts that can be adapted for different tasks.

For further information about the library excluding scripts see the full code documentation.

Quick start

git clone https://github.com/Rfam/pywikibot.git
cd pywikibot
git submodule update --init

Install Rfam dependencies using virtualenv:

virtualenv env
source env/bin/activate
pip install -r requirements.txt

Our installation guide has more details for advanced usage.

⚠️ Make sure the following line is present in user-config.py:

upload_to_commons = True

Rfam-specific Tasks

1. Upload Rfam secondary structure diagram to Wikimedia Commons. Note: sharing the images on Wikimedia Commons makes the files available to Wikipedia projects in different languages.

python pwb.py upload_image RF03114 RF03115
  1. Create Rfam infobox to get the code that can be manually added to Wikipedia.
python pwb.py generate_infobox RF03114 RF03115
  1. Add Rfam infobox to a Wikipedia page (only if it has no infobox already).
python pwb.py add_infobox RF03114 RF03115
  1. Generate Rfam infobox for a Wikipedia page (need to add to Wikipedia manually).
python pwb.py generate_gallery RT_RNA_motifs

For more documentation on pywikibot see docs.

Basic Usage

If you wish to write your own script it's very easy to get started:

import pywikibot
site = pywikibot.Site('en', 'wikipedia')  # The site we want to run our bot on
page = pywikibot.Page(site, 'Wikipedia:Sandbox')
page.text = page.text.replace('foo', 'bar')
page.save('Replacing "foo" with "bar"')  # Saves the page

Required external programs

It may require the following programs to function properly:

  • 7za: To extract 7z files

About

Rfam fork of wikimedia/pywikibot for managing Rfam wiki content

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%