Skip to content

pythonPackage.markdownsuperscript: init at 2.0.0 #26985

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

Merged
merged 1 commit into from
Jul 3, 2017

Conversation

Zimmi48
Copy link
Member

@Zimmi48 Zimmi48 commented Jun 30, 2017

Motivation for this change
Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • 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 nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

Sorry, something went wrong.

@@ -13451,6 +13451,26 @@ in {
};
};

markdownsuperscript = buildPythonPackage rec {
Copy link
Member

Choose a reason for hiding this comment

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

Please move this expression to python-modules as described in the header of this file.

version = "2.0.0";
name = "markdownsuperscript-${version}";

src = pkgs.fetchurl {
Copy link
Member

Choose a reason for hiding this comment

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

fetchPypi is preferred.


propagatedBuildInputs = with self; [ markdown ];

doCheck = false;
Copy link
Member

Choose a reason for hiding this comment

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

add a comment when disabling tests

@Zimmi48 Zimmi48 force-pushed the add_markdownsuperscript branch from 6e7428e to 02d3154 Compare June 30, 2017 15:48
@Zimmi48
Copy link
Member Author

Zimmi48 commented Jun 30, 2017

Thanks for your remarks. I took them into account.


propagatedBuildInputs = [ markdown ];

doCheck = false; # Tests depend on packages which are not available yet in nixpkgs
Copy link
Member

Choose a reason for hiding this comment

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

Are you going to use and maintain this package? If not, then I'm of the opinion you should add test dependencies since otherwise there's no way to tell whether it is working.

Copy link
Member Author

Choose a reason for hiding this comment

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

@FRidh Today, I've tried activating the tests for this package. First, I've added the missing dependency (see #27018). Then, I've made the following changes to this derivation so that it would run the tests:

diff --git a/pkgs/development/python-modules/markdownsuperscript/default.nix b/pkgs/development/python-modules/markdownsuperscript/default.nix
index fdf9913e76..9677de0c99 100644
--- a/pkgs/development/python-modules/markdownsuperscript/default.nix
+++ b/pkgs/development/python-modules/markdownsuperscript/default.nix
@@ -1,18 +1,24 @@
-{ stdenv, buildPythonPackage, fetchPypi, markdown }:
+{ stdenv, buildPythonPackage, fetchFromGitHub, markdown, nose, codecov }:
 
 buildPythonPackage rec {
   pname = "MarkdownSuperscript";
   version = "2.0.0";
   name = "${pname}-${version}";
 
-  src = fetchPypi {
-    inherit pname version;
-    sha256 = "1dsx21h9hkx098d5azpw81dcz23rrgzrwlymwv7jri348q26p748";
+  src = fetchFromGitHub {
+    owner = "jambonrose";
+    repo = "markdown_superscript_extension";
+    rev = "v${version}";
+    sha256 = "0kvnvicgnxmd9xlm9gi7nk9jqnhj2qp7238xxrxls385l0x07004";
   };
 
+  buildInputs = [ nose codecov ]; # Tests only
+
   propagatedBuildInputs = [ markdown ];
 
-  doCheck = false; # Tests depend on packages which are not available yet in nixpkgs
+  patchPhase = ''
+    sed -i 's/==.*$//' requirements/test_requirements.txt
+  '';
 
   meta = {
     description = "An extension to the Python Markdown package enabling superscript text";

You may remark in passing that I've changed the source from PyPi to GitHub because initially I got the following error: ImportError: No module named tests. And indeed, checking the source from PyPi I could see that the tests/ folder which is present in the source on GitHub wasn't there. However, after this change the tests still fail in the same way in Python 2 and in Python 3, I get a new error (showing only the tail of the trace):

  File "/nix/store/4irqw5y5mj9dr41x1fl4cgqxpyaqvlpj-python3.6-bootstrapped-pip-9.0.1/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1521, in _listdir
    "Can't perform this operation for unregistered loader type"
NotImplementedError: Can't perform this operation for unregistered loader type

I don't know if this is a problem of version of a dependency or something else.
I'm also wondering if these tests are meant to be run by the user (there are no instructions on how to run them).
I'm not a Python programmer and I feel like I've lost already way too much time on this. Feel free to take over, to merge or to close the PR.

Copy link
Member

Choose a reason for hiding this comment

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

@Zimmi48 sometimes getting the tests to work takes a lot of time and sometimes they just don't work at all. I appreciate the time you put in it, but if you notice it isn't working or going forward, then we simply merge what we have and leave it at that.

Copy link
Member Author

Choose a reason for hiding this comment

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

@FRidh OK thanks. I suppose I should change the comment on the doCheck = false; then. What do you think of:

doCheck = false; # Did not manage to get the tests to work, see PR #26985 for details on the failed attempt.

Copy link
Member

Choose a reason for hiding this comment

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

@Zimmi48

# Missing test dependencies, see https://github.com/NixOS/nixpkgs/pull/26985

Copy link
Member

Choose a reason for hiding this comment

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

as long as you have the reference here it is fine! :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Reference added :)

@Zimmi48 Zimmi48 force-pushed the add_markdownsuperscript branch from 02d3154 to ac86016 Compare July 3, 2017 10:50
@FRidh FRidh merged commit 1336fde into NixOS:master Jul 3, 2017
@Zimmi48 Zimmi48 deleted the add_markdownsuperscript branch July 3, 2017 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants