lahwaacz / wiki-scripts

Framework for writing bots, maintenance scripts or performing data analysis on wikis powered by MediaWiki
http://lahwaacz.github.io/wiki-scripts/
GNU General Public License v3.0
27 stars 12 forks source link

Add documentation for migrating configuration after version 1.3 #79

Closed kynikos closed 3 years ago

kynikos commented 3 years ago

When running statistics.py:

999f72684ea687db86bacea5f9a4b814edd424ad tagged as 1.3 works correctly.

96543496049af95d8e327d1d9b8c2384b0177a67 to bb71af71e92323baec2f1ed8f8815a23c1c00354 raise:

Traceback (most recent call last):
  File "/home/dario/dev/arch/wiki-scripts/statistics.py", line 310, in <module>
    statistics = ws.config.object_from_argparser(Statistics, description="Update the statistics page on ArchWiki")
  File "/home/dario/dev/arch/wiki-scripts/ws/config.py", line 227, in object_from_argparser
    return klass.from_argparser(args)
  File "/home/dario/dev/arch/wiki-scripts/statistics.py", line 90, in from_argparser
    db = Database.from_argparser(args)
  File "/home/dario/dev/arch/wiki-scripts/ws/db/database.py", line 113, in from_argparser
    raise ValueError("Cannot create database connection: db_name cannot be None")
ValueError: Cannot create database connection: db_name cannot be None

3355503c4e63b163bd64d5736a264988d457c26f to eea9b9467e46c2205c58db2dfaf7f7ecdf2f74a5 say:

usage: statistics.py [options]
statistics.py: error: the following arguments are required: --api-url, --index-url

I was used to always stay on the latest master commit, should I now stay on the latest tagged commits instead?

lahwaacz commented 3 years ago

Hi, it is a result of #69 which changed the configuration file location as well as format. Unfortunately, there is still no documentation for the config migration, and some things had to be fixed after the merge, so I tagged 1.3 just before that. You can stay at 1.3 until this is sorted out, I will also tag a new release when this is done.

Anyway, let's change this issue to track the documentation progress :wink:

kynikos commented 3 years ago

Oh, all good then, keep up the good work :)

lahwaacz commented 3 years ago

I've attempted to describe the config migration in the documentation: https://lahwaacz.github.io/wiki-scripts/configuration.html Please let me know if it works or I missed something!

kynikos commented 3 years ago

Thank you, I got it to work again :)

But 1) there's a typo in the docs, it should be [DEFAULT], not [DEFAULTS], then 2) I think the defaults for data-dir and cookie-file may have changed, since before I didn't have those options in my configuration file, and I had the session cookie inside ~/.cache/wiki-scripts/, but now the scripts were asking my credentials at every call, so I manually created ~/.local/share/wiki-scripts/ and set those two options explicitly to find the cookie file there.

lahwaacz commented 3 years ago

Oh, thanks, I've fixed the typos. As for cookie-file, its default value was removed in 063c20b97bb526ecab0dbbb64a7704696fff9025 so it has to be set explicitly now – I've added it to the changelog. But the data-dir in the examples does not correspond directly to a wiki-scripts option, it is just used in the interpolation of configuration options. So it is entirely up to you where you want to store the :cookie:, you might even keep using the old path.