Skip to content
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

pythonPackages.toggl-cli: init at 2.1.0 (and its dependencies) #63092

Merged
merged 5 commits into from Jun 18, 2019

Conversation

mmahut
Copy link
Member

@mmahut mmahut commented Jun 13, 2019

Motivation for this change
  • pythonPackages.togglCli: init at 2.1.0

And its dependencies:

  • pythonPackages.validate_email: init at 1.3
  • pythonPackages.readchar: init at 2.0.1
  • pythonPackages.inquirer: init at 2.6.3
  • pythonPackages.PTable: init at 0.9.2
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@srhb
Copy link
Contributor

srhb commented Jun 13, 2019

@GrahamcOfBorg build pythonPackages.togglCli

@srhb
Copy link
Contributor

srhb commented Jun 13, 2019

@GrahamcOfBorg build python3Packages.togglCli

Copy link
Contributor

@worldofpeace worldofpeace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mmahut, what follows is a general review and then a more detailed
one for each commit.

Each package should reference its depedencies directly instead of
using pythonPackages. And in general we need to enable tests
which may require fetching from github.

  • pythonPackages.PTable: init at 0.9.2

Please normalize the attribute name to ptable and also pname.

note you'll need to manually give fetchPypi the non normalized pname

The commit msg should reflect this change.

Also we should build from the latest commit on GitHub, see kxxoling/PTable#27.
You'll then will be able to enable the tests.

  • pythonPackages.inquirer: init at 2.6.3

Please enable tests.
Looking at requirements-dev.txt and the Makefile will be helpful.

  • pythonPackages.readchar: init at 2.0.1

Fetching from PyPi's wheels appear to be to complex and it won't be automatically updated.
Please use fetchFromGitHub and enable tests. The setup_requires will need to be in nativeBuildInputs btw.

  • pythonPackages.validate_email: init at 1.3

Please normalize the attribute name to validate-email and also pname.
The commit msg should reflect this change.

  • pythonPackages.togglCli: init at 2.1.0

Please normalize the attribute name to toggle-cli and also pname.
The commit msg should reflect this change.

We also need to correct the dependency declaration for the setup_requires pbr and twine.
They should be nativeBuildInputs and pbr should also be a checkInputs because we need it for tests.

And on the topic of tests we should enable them.

  • Adding pythonPackages.{togglCli,validate_email,readchar,PTable,inquirer}

Unfortunately this is going to require some git rewriting because each commit that
inits should also add itself to python-packages.nix.

pkgs/development/python-modules/validate_email/default.nix Outdated Show resolved Hide resolved
pkgs/development/python-modules/togglCli/default.nix Outdated Show resolved Hide resolved
Copy link
Contributor

@worldofpeace worldofpeace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've built everything successfully for all interpreters in nixpkgs ❇️

Managed to fix the tests for toggl-cli by skipping one's that still somehow needed network access
(probably needs to be fixed upstream)

diff --git a/pkgs/development/python-modules/toggl-cli/default.nix b/pkgs/development/python-modules/toggl-cli/default.nix
index c44b42b6f2a..5c851fdb475 100644
--- a/pkgs/development/python-modules/toggl-cli/default.nix
+++ b/pkgs/development/python-modules/toggl-cli/default.nix
@@ -24,11 +24,18 @@ buildPythonPackage rec {
   nativeBuildInputs = [ pbr twine ];
   checkInputs = [ pbr pytest pytestcov pytest-mock faker factory_boy ];
 
-  # FIXME: fix tests
-  doCheck = false;
+  preCheck = ''
+     export TOGGL_API_TOKEN=your_api_token
+     export TOGGL_PASSWORD=toggl_password
+     export TOGGL_USERNAME=user@example.com
+  '';
 
   checkPhase = ''
-   pytest -m "not premium" tests/unit
+    runHook preCheck
+
+    pytest -k "not premium and not TestDateTimeType and not TestDateTimeField" tests/unit --maxfail=20
+
+    runHook postCheck
   '';
 
   propagatedBuildInputs = [

Also pr'd something for the readchar pin in inquirer magmax/python-inquirer#77

Following comments are just some expression cleanup.

pkgs/development/python-modules/ptable/default.nix Outdated Show resolved Hide resolved
pkgs/development/python-modules/inquirer/default.nix Outdated Show resolved Hide resolved
pkgs/development/python-modules/inquirer/default.nix Outdated Show resolved Hide resolved
pkgs/development/python-modules/readchar/default.nix Outdated Show resolved Hide resolved
pkgs/development/python-modules/toggl-cli/default.nix Outdated Show resolved Hide resolved
@worldofpeace worldofpeace changed the title pythonPackages.togglCli: init at 2.1.0 (and its dependencies) pythonPackages.toggl-cli: init at 2.1.0 (and its dependencies) Jun 16, 2019
@mmahut
Copy link
Member Author

mmahut commented Jun 17, 2019

@worldofpeace you are amazing - thank you for your review! Pushed the new changes.

@worldofpeace
Copy link
Contributor

Great work here @mmahut

I think this is complete, can you squash the commits?

@mmahut
Copy link
Member Author

mmahut commented Jun 18, 2019

@worldofpeace thank you! Done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants