harelba / q

q - Run SQL directly on delimited files and multi-file sqlite databases

Home Page:http://harelba.github.io/q/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Migrating from optparse to argparse

InCogNiTo124 opened this issue · comments

As per the Python docs:

Deprecated since version 3.2: The optparse module is deprecated and will not be developed further; development will continue with the argparse module.

If the owner decides it could be done, I would be happy to do it

@InCogNiTo124 Thanks, that would be great! I would really appreciate that.

Kindly, please try to make sure that the diff on the PR is easy to reason about, so we can make sure there are no semantic differences between the way q parses parameters after the change. Backward compatibility is of paramount importance - there are too many users which rely on it for both manual and automated use-cases.

Backward compatibility is of paramount importance

I will do my best!

JSYK pytest==6.2.2 is broken for python3.10:

$ pytest .
=================================== test session starts ====================================
platform linux -- Python 3.10.1, pytest-6.2.2, py-1.11.0, pluggy-0.13.1
rootdir: /home/msmetko/repos/q, configfile: pytest.ini
collected 0 items / 1 error                                                                

========================================== ERRORS ==========================================
___________________________ ERROR collecting test/test_suite.py ____________________________
/usr/lib/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1050: in _gcd_import
    ???
<frozen importlib._bootstrap>:1027: in _find_and_load
    ???
<frozen importlib._bootstrap>:1006: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:688: in _load_unlocked
    ???
venv/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:161: in exec_module
    source_stat, co = _rewrite_test(fn, self.config)
venv/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:356: in _rewrite_test
    co = compile(tree, fn_, "exec", dont_inherit=True)
E   TypeError: required field "lineno" missing from alias
================================= short test summary info ==================================
ERROR test/test_suite.py - TypeError: required field "lineno" missing from alias
!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!
===================================== 1 error in 0.18s =====================================

the solution was to upgrade it to pytest==6.2.5