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

pylode: init at 2.8.6 #95863

Merged
merged 1 commit into from Mar 7, 2021
Merged

pylode: init at 2.8.6 #95863

merged 1 commit into from Mar 7, 2021

Conversation

koslambrou
Copy link
Contributor

@koslambrou koslambrou commented Aug 20, 2020

Motivation for this change

added new package: pylode at version 2.8.6

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • 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 nixpkgs-review --run "nixpkgs-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)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Copy link
Contributor

@drewrisinger drewrisinger left a comment

Choose a reason for hiding this comment

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

It looks like this is supposed to be used as a standalone package. I recommend following the example of https://github.com/NixOS/nixpkgs/blob/master/pkgs/misc/autotiling/default.nix.

In all-packages.nix, it's called as: autotiling = python3Packages.callPackage PATH_TO_NIX_FILE { };

I'll review this more thoroughly once it more closely matches existing best practices.

pkgs/applications/misc/pylode/default.nix Outdated Show resolved Hide resolved
@koslambrou
Copy link
Contributor Author

@drewrisinger I modified the PR.

I tried following best practices from https://github.com/NixOS/nixpkgs/blob/master/pkgs/misc/autotiling/default.nix.

One thing I couldn't do was use fetchPypi instead of fetchFromGithub as it produces the following error:

Executing setuptoolsBuildPhase
Traceback (most recent call last):
  File "nix_run_setup", line 8, in <module>
    exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\\r\\n', '\\n'), __file__, 'exec'))
  File "setup.py", line 20, in <module>
    with open_local(['requirements.txt']) as req:
  File "setup.py", line 14, in open_local
    return codecs.open(path, mode, encoding)
  File "/nix/store/fjgnz0xfl04hsblsi4ym5y5akfh6mlmy-python3-3.8.5/lib/python3.8/codecs.py", line 905, in open
    file = builtins.open(filename, mode, buffering)
FileNotFoundError: [Errno 2] No such file or directory: '/build/pyLODE-2.8.3/requirements.txt'
builder for '/nix/store/5ccdmbk2298755s4h1mg7q8qdiglfj81-pyLODE-2.8.3.drv' failed with exit code 1
error: build of '/nix/store/5ccdmbk2298755s4h1mg7q8qdiglfj81-pyLODE-2.8.3.drv' failed

@zowoq
Copy link
Contributor

zowoq commented Aug 22, 2020

@ofborg eval

@drewrisinger
Copy link
Contributor

@drewrisinger I modified the PR.

I tried following best practices from https://github.com/NixOS/nixpkgs/blob/master/pkgs/misc/autotiling/default.nix.

One thing I couldn't do was use fetchPypi instead of fetchFromGithub as it produces the following error:

Executing setuptoolsBuildPhase
Traceback (most recent call last):
  File "nix_run_setup", line 8, in <module>
    exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\\r\\n', '\\n'), __file__, 'exec'))
  File "setup.py", line 20, in <module>
    with open_local(['requirements.txt']) as req:
  File "setup.py", line 14, in open_local
    return codecs.open(path, mode, encoding)
  File "/nix/store/fjgnz0xfl04hsblsi4ym5y5akfh6mlmy-python3-3.8.5/lib/python3.8/codecs.py", line 905, in open
    file = builtins.open(filename, mode, buffering)
FileNotFoundError: [Errno 2] No such file or directory: '/build/pyLODE-2.8.3/requirements.txt'
builder for '/nix/store/5ccdmbk2298755s4h1mg7q8qdiglfj81-pyLODE-2.8.3.drv' failed with exit code 1
error: build of '/nix/store/5ccdmbk2298755s4h1mg7q8qdiglfj81-pyLODE-2.8.3.drv' failed

Thanks. I meant generally with respect to formatting & layout. I'll leave comments.

Copy link
Contributor

@drewrisinger drewrisinger left a comment

Choose a reason for hiding this comment

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

  • Few formatting fixes
  • Move package call to different location in all-packages.nix
  • Run tests
  • Haven't tested build yet, waiting on tests.

Comment on lines 19 to 29
propagatedBuildInputs = [
rdflib
rdflib-jsonld
requests
dateutil
markdown
jinja2
gunicorn
pytest
falcon
isodate
six
];
Copy link
Contributor

Choose a reason for hiding this comment

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

Sort alphabetically.

Pytest shouldn't need to be a runtime input (should probably be a checkInput)

Comment on lines 15 to 32
postPatch = ''
substituteInPlace requirements.txt --replace "argparse" ""
'';
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it actually fail to build with this in the requirements? If it builds, I'd say leave it in. argparse is a built-in python library.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it actually fails if I leave argparse in the requirements

Copy link
Contributor

Choose a reason for hiding this comment

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

Huh. Strange. Thanks for checking 👍

sha256 = "01a6b916r32irnllfr0rxz2mn9v6xn94lrgjdb8dhkki9ninqddy";
};

# Waiting for argparse to be removed in requirements.txt from upstream package
Copy link
Contributor

Choose a reason for hiding this comment

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

Reference pull request/issue if there is one.

Comment on lines 1 to 5
{ lib, buildPythonApplication, fetchFromGitHub, rdflib, rdflib-jsonld, requests, dateutil, markdown, jinja2, isodate, gunicorn, falcon, pytest, six }:

Copy link
Contributor

Choose a reason for hiding this comment

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

Break onto separate lines and sort the packages alphabetically like:

Suggested change
{ lib, buildPythonApplication, fetchFromGitHub, rdflib, rdflib-jsonld, requests, dateutil, markdown, jinja2, isodate, gunicorn, falcon, pytest, six }:
{ lib
, buildPythonApplication
, fetchFromGitHub
, dateutil
, falcon
, ...
}:

];

# Import errors in pylode tests
doCheck = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Try like this (replacing pytest in arguments with pytestCheckHook:

Suggested change
doCheck = false;
checkInputs = [ pytestCheckHook ];

My guess is that you're getting version conflicts between the installed version of pyLODE in $out and the tests in the source directory. See #95689 (comment) (esp. 5.) for a possible solution.

Tests are generally preferred if they exist. If this was a python package vs application, I'd recommend doing pythonImportsCheck = [ "name_of_python_package_here" ];

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I checked in the upstream pyLODE package and it seems that the tests are failing over there with an import error. Opened an issue over there.

Copy link
Contributor

Choose a reason for hiding this comment

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

@koslambrou would you like to update this PR with tests enabled and version 2.8.4?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@doronbehar Still have to wait for 2.8.5. The tests are failing in 2.8.4 and the commit that solves this was added the day after the 2.8.4 release.

Copy link
Contributor

Choose a reason for hiding this comment

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

The tests are failing in 2.8.4 and the commit that solves this was added the day after the 2.8.4 release.

Well then it should be fairly easy to grab that commit fetched from upstream. When doing it we usually put a comment that the referenced commit is included in 2.8.5 and should be removed with the update to a version newer then 2.8.4

Comment on lines 37 to 32
homepage = "https://github.com/RDFLib/pyLODE";
description = "An OWL ontology documentation tool using Python and templating, based on LODE";
Copy link
Contributor

Choose a reason for hiding this comment

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

Typically description is before homepage.

Comment on lines 9925 to 9926
pylode = python3Packages.callPackage ../misc/pylode { };

Copy link
Contributor

Choose a reason for hiding this comment

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

These are loosely sorted by directory. Your package probably doesn't belong here with the rest of the native python packages. Look for a place in the range of lines 15000+

meta = with lib; {
homepage = "https://github.com/RDFLib/pyLODE";
description = "An OWL ontology documentation tool using Python and templating, based on LODE";
license = licenses.gpl3;
Copy link
Contributor

Choose a reason for hiding this comment

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

Use of this is deprecated per https://discourse.nixos.org/t/lib-licenses-gpl3-co-are-now-deprecated/8206

It looks like gpl3Only vs gpl3Plus is appropriate here based on the license text.

@drewrisinger
Copy link
Contributor

Last comment I have is maybe this belongs in https://github.com/NixOS/nixpkgs/tree/master/pkgs/applications/science/biology because it's a taxonomy package? Doesn't seem like there's much in ./misc other than emulators

@drewrisinger
Copy link
Contributor

I'd also still prefer to see some sort of self-test because python applications are fairly unstable due to constant library updates.

@koslambrou
Copy link
Contributor Author

Then, for the tests, I'll wait until the're fixed in the pyLODE package before requesting another review.

This application is a documentation generator for ontology (taxonomy) web formats (.owl). However, it is a general purpose package and not specifically related to biology. You think pkgs/applications/science/biology is still the best location ?

@drewrisinger
Copy link
Contributor

I'd suggest either pkgs/applications/science/biology or pkgs/applications/science/misc. I'm not too well-versed with best practices for those folders.

@koslambrou koslambrou changed the title pylode: init at 2.8.3 pylode: init at 2.8.6 Mar 5, 2021
@koslambrou
Copy link
Contributor Author

@drewrisinger Updated to pyLODE v2.8.6 and all issues were resolved.

Copy link
Contributor

@drewrisinger drewrisinger left a comment

Choose a reason for hiding this comment

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

  • Diff LGTM, minus changelog & @doronbehar comments
  • Commits LGTM
  • Builds via nix-review on x86_64-linux:
1 package built:
pylode


meta = with lib; {
description = "An OWL ontology documentation tool using Python and templating, based on LODE";
homepage = "https://github.com/RDFLib/pyLODE";
Copy link
Contributor

Choose a reason for hiding this comment

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

Best practice now is to add a meta.changelog attribute if it exists.

Suggested change
homepage = "https://github.com/RDFLib/pyLODE";
homepage = "https://github.com/RDFLib/pyLODE";
changelog = "https://github.com/RDFlib/pyLODE...";

Or a more user-friendly documentation site if it exists, e.g. readthedocs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The package has nothing of the sort. The only existing documentation is the README of the Github repository.

pkgs/top-level/all-packages.nix Outdated Show resolved Hide resolved
@doronbehar
Copy link
Contributor

Result of nixpkgs-review pr 95863 run on x86_64-linux 1

1 package built:
  • pylode

@doronbehar doronbehar merged commit 95c170b into NixOS:master Mar 7, 2021
@koslambrou koslambrou deleted the add-pylode-package branch March 7, 2021 13:34
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

4 participants