New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mycli: 1.6.0 -> 1.17.0 #44571
mycli: 1.6.0 -> 1.17.0 #44571
Conversation
pkgs/top-level/python-packages.nix
Outdated
@@ -1102,6 +1102,20 @@ in { | |||
|
|||
cheroot = callPackage ../development/python-modules/cheroot {}; | |||
|
|||
cli-helpers = buildPythonPackage rec { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be put in pkgs/development/python-modules/cli-helpers/default.nix
. The expression should adhere to the newest standards (pname
etc.) and adding cli-helpers
should be a separate commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good, I'll update the PR later today.
Also note
So please enable tests again. |
1254d59
to
4dd71f5
Compare
4dd71f5
to
8eb691d
Compare
@kalbasit No need to have the second PR. Please remove the merge commit from this one. @GrahamcOfBorg build python2.pkgs.cli-helpers python3.pkgs.cli-helpers |
Success on aarch64-linux (full log) Attempted: python2.pkgs.cli-helpers, python3.pkgs.cli-helpers Partial log (click to expand)
|
Please provide an appropriate |
Success on x86_64-linux (full log) Attempted: python2.pkgs.cli-helpers, python3.pkgs.cli-helpers Partial log (click to expand)
|
@dotlambda the lack of tests you are talking about is actually in #44578 (you asked for this PR in an earlier comment). I need help on #44578 to figure out the tests part. I'll squash the commits after you merge #44578. |
bbaee4d
to
1c52682
Compare
@dotlambda I edited the commits, the first one is #44578 verbatim and the second one is the primary commit of this PR. |
But now you removed the commit regarding
No, I just asked for a separate commit, no need to have multiple PRs. |
oh, I see what you mean. Ok give me a second, I will split the last commit and close #44578. |
Judging from
|
1c52682
to
b5c6158
Compare
b5c6158
to
fcacb4f
Compare
@GrahamcOfBorg build python2.pkgs.cli-helpers python3.pkgs.cli-helpers |
Success on x86_64-linux (full log) Attempted: python2.pkgs.cli-helpers, python3.pkgs.cli-helpers Partial log (click to expand)
|
Success on aarch64-linux (full log) Attempted: python2.pkgs.cli-helpers, python3.pkgs.cli-helpers Partial log (click to expand)
|
@dotlambda can you also build mycli to make sure it works on borg. |
pkgs/tools/admin/mycli/default.nix
Outdated
@@ -1,28 +1,31 @@ | |||
{ lib | |||
, python | |||
, pythonPackages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop this line
pkgs/tools/admin/mycli/default.nix
Outdated
''; | ||
patches = [ ./fix-tests.patch ]; | ||
|
||
checkInputs = with pythonPackages; [ pytest mock ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop with pythonPackages;
. There's with python.pkgs;
at the top.
pkgs/tools/admin/mycli/default.nix
Outdated
doCheck = false; | ||
preCheck = '' | ||
echo '[main]' > /tmp/myclirc | ||
echo 'log_file = /tmp/mycli.test.log' >> /tmp/myclirc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From where would myclirc
be read without the patch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From nowhere, and so the library will end up calling write_default_config which writes the config file at /homeless-shelter/.myclirc
and that of course fails. Setting the myclirc stops it from writing the config file. Also, I specified the log_file
option because another test invokes logging and that defaults to /homeless-shelter/.mycli.log
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about setting something like HOME=.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try that!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This worked! Thanks for the tip.
pkgs/tools/admin/mycli/default.nix
Outdated
@@ -1,28 +1,31 @@ | |||
{ lib | |||
, python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If mycli is compatible with python3, please replace this by python3
. Otherwise, by python2
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried using python3, the tests fail like this:
=================================== FAILURES ===================================
________________________________ test_list_dsn _________________________________
def test_list_dsn():
runner = CliRunner()
with NamedTemporaryFile(mode="w") as myclirc:
myclirc.write(dedent("""\
[alias_dsn]
test = mysql://test/test
[main]
log_file = /tmp/mycli.test.log
"""))
myclirc.flush()
args = ['--list-dsn', '--myclirc', myclirc.name]
result = runner.invoke(cli, args=args)
> assert result.output == "test\n"
E AssertionError: assert '' == 'test\n'
E + test
args = ['--list-dsn', '--myclirc', '/build/tmpbldvl9dg']
myclirc = <tempfile._TemporaryFileWrapper object at 0x7fffedb39da0>
result = <Result RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for ... suitable UTF-8\nlocales were discovered. This most likely requires resolving\nby reconfiguring the locale system.',)>
runner = <click.testing.CliRunner object at 0x7fffedb39dd8>
test/test_main.py:287: AssertionError
==== 1 failed, 186 passed, 59 skipped, 1 xfailed, 1 xpassed in 5.42 seconds ====
builder for '/nix/store/m4vvpfnpgnlsa265cagv1hq99yfh5fs8-mycli-1.17.0.drv' failed with exit code 1
e
I put python2
there for now, we can revisit in a separate PR.
@GrahamcOfBorg build mycli |
Success on x86_64-linux (full log) Attempted: mycli Partial log (click to expand)
|
Success on aarch64-linux (full log) Attempted: mycli Partial log (click to expand)
|
fcacb4f
to
c0d2ac8
Compare
@GrahamcOfBorg build python2.pkgs.pymysql python3.pkgs.pymysql mycli |
Success on x86_64-linux (full log) Attempted: python2.pkgs.pymysql, python3.pkgs.pymysql, mycli Partial log (click to expand)
|
Success on aarch64-linux (full log) Attempted: python2.pkgs.pymysql, python3.pkgs.pymysql, mycli Partial log (click to expand)
|
pkgs/tools/admin/mycli/default.nix
Outdated
@@ -1,28 +1,29 @@ | |||
{ lib | |||
, python | |||
, python2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to https://github.com/dbcli/mycli/blob/19619a4dfa0682654634c33e4ec55263f82475b6/tox.ini#L2, mycli supports python3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a comment about it above, pasting here as well.
I tried using python3, the tests fail like this:
=================================== FAILURES ===================================
________________________________ test_list_dsn _________________________________
def test_list_dsn():
runner = CliRunner()
with NamedTemporaryFile(mode="w") as myclirc:
myclirc.write(dedent("""\
[alias_dsn]
test = mysql://test/test
[main]
log_file = /tmp/mycli.test.log
"""))
myclirc.flush()
args = ['--list-dsn', '--myclirc', myclirc.name]
result = runner.invoke(cli, args=args)
> assert result.output == "test\n"
E AssertionError: assert '' == 'test\n'
E + test
args = ['--list-dsn', '--myclirc', '/build/tmpbldvl9dg']
myclirc = <tempfile._TemporaryFileWrapper object at 0x7fffedb39da0>
result = <Result RuntimeError('Click will abort further execution because Python 3 was configured to use ASCII as encoding for ... suitable UTF-8\nlocales were discovered. This most likely requires resolving\nby reconfiguring the locale system.',)>
runner = <click.testing.CliRunner object at 0x7fffedb39dd8>
test/test_main.py:287: AssertionError
==== 1 failed, 186 passed, 59 skipped, 1 xfailed, 1 xpassed in 5.42 seconds ====
builder for '/nix/store/m4vvpfnpgnlsa265cagv1hq99yfh5fs8-mycli-1.17.0.drv' failed with exit code 1
e
I put python2
there for now, we can revisit in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have to add glibcLocales
to checkInputs
and add LC_ALL = "en_US.UTF-8";
to the expression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! it worked!
|
||
propagatedBuildInputs = [ cryptography ]; | ||
|
||
buildInputs = [ unittest2 ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is not necessary.
{ lib | ||
, buildPythonPackage | ||
, fetchPypi | ||
, python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop this line.
description = "Pure Python MySQL Client"; | ||
homepage = https://github.com/PyMySQL/PyMySQL; | ||
license = licenses.mit; | ||
maintainers = [ maintainers.fridh maintainers.kalbasit ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you add fridh?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran git blame
and tracked down the first commit to him, should I remove him?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, he's the main python maintainer but probably does not particularly maintain this package.
65273ef
to
d934f32
Compare
d934f32
to
1e26e23
Compare
@dotlambda PTAL. |
1e26e23
to
e9cb147
Compare
@dotlambda I simplified mycli even more, there really was no need for the patch, PTAL. |
@GrahamcOfBorg build mycli |
Success on x86_64-linux (full log) Attempted: mycli Partial log (click to expand)
|
Success on aarch64-linux (full log) Attempted: mycli Partial log (click to expand)
|
Motivation for this change
I'm getting errors when using mycli 1.6.0, not getting errors after the update.
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)closes kalbasit/shabka#32