Think of mwdoc as a tool that allows to easily version mediawiki pages.
For example, pages like:
Documentation/0.2/mypage
Template:Documentation/0.2/mytemplate
... can be automatically created from:
Documentation/0.1/mypage
Template:Documentation/0.1/mytemplate
Installing mwdoc
will automatically install the required dependencies.
pip install mwdoc
import mwdoc
doc = mwdoc.Documentation('somewhere.org', '/w/')
doc.login('john', 'password')
doc.createPage('0.1', 'mypage', 'This is content of my page', 'Documentation')
doc.createPage('0.1', 'mytemplate', 'This is content of my template', 'Template:Documentation')
import mwdoc
doc = mwdoc.Documentation('somewhere.org', '/w/')
doc.login('john', 'password')
doc.versionPages('0.1', '0.2', ['Documentation', 'Template:Documentation'])
import mwdoc
doc = mwdoc.Documentation('somewhere.org', '/w/')
doc.login('john', 'password')
pages = doc.listPages('Documentation')
for page in pages:
print(page)
templatepages = doc.listPages('Template:Documentation')
for page in templatepages:
print(page)
import mwdoc
doc = mwdoc.Documentation('somewhere.org', '/w/')
doc.login('john', 'password')
pages = doc.listPages('Documentation')
for page in pages:
page.delete()
Do NOT run this test against a production installation. We mean it.
The test will create pages, version them and delete them afterward.
To run the test:
git clone git://github.com/jcfr/mwdoc && cd $_
pip install -r requirements.txt
python -m unittest test_mwdoc
It will then ask for:
localhost
)/w/
)Once you've made your great commits:
git checkout -b my_branch
git push origin my_branch
A core developer should use the following steps to create a release of mwdoc.
Configure ~/.pypirc
as described here.
Make sure that all tests are passing.
Tag the release. Requires a GPG key with signatures. For version X.Y.Z:
git tag -s -m "mwdoc X.Y.Z" X.Y.Z upstream/master
git checkout master
git fetch upstream
git reset --hard upstream/master
rm -rf dist/
python setup.py sdist bdist_wheel
twine upload --sign -r pypitest dist/*
Check the PyPI testing package page.
Upload the packages to the PyPI instance::
twine upload --sign dist/*
Check the PyPI package page.
Make sure the package can be installed::
mkvirtualenv test-pip-install
pip install mwdoc
rmvirtualenv test-pip-install
Please see the GitHub project page at https://github.com/jcfr/mwdoc/graphs/contributors
git clone git://github.com/jcfr/mwdoc.git
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.