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

papis: init at 0.5.2 + dependencies #34761

Merged
merged 7 commits into from Feb 10, 2018
Merged

papis: init at 0.5.2 + dependencies #34761

merged 7 commits into from Feb 10, 2018

Conversation

nico202
Copy link
Contributor

@nico202 nico202 commented Feb 9, 2018

Motivation for this change

Papis is a powerful and highly extensible command-line based document and bibliography manager.
https://github.com/alejandrogallo/papis

Things done

Added all papis missing dependencies (arxiv2bib, habanero, papis-python-rofi, pylibgen)
Updated python-magic from 0.4.10 to 0.4.13

(HELP WANTED: I don't know how to check if all packages depending on python-magic still works, how do I check it?
I checked beancount and it installs, relatorio and tests are ok, s3cmd installs (has no tests). How do I ask nix to do this automatically for all the dependencies?)

  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-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 nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

}:

buildPythonPackage rec {
name = "papis-${version}";
Copy link
Member

Choose a reason for hiding this comment

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

Please specify pname and leave out name.
Same for the other packages.

, pkgs
}:

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.

buildPythonApplication

, configparser, habanero, papis-python-rofi, pylibgen
, prompt_toolkit, pyparser, python_magic, pyyaml
, requests, unidecode, urwid, vobject, tkinter
, pkgs
Copy link
Member

Choose a reason for hiding this comment

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

Please pass in vim directly.

{ buildPythonPackage, lib, fetchFromGitHub }:

buildPythonPackage rec {
name = "papis-python-rofi-${version}";
Copy link
Member

Choose a reason for hiding this comment

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

This should be called python-rofi.

@@ -5810,6 +5816,10 @@ in {

paperwork-backend = callPackage ../applications/office/paperwork/backend.nix { };

papis = callPackage ../applications/office/papis { };

papis-python-rofi = callPackage ../development/python-modules/papis-python-rofi { };
Copy link
Member

Choose a reason for hiding this comment

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

python-rofi

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I see. papis-python-rofi seems to be a fork of python-rofi. Then it's all right like that,

@@ -5810,6 +5816,10 @@ in {

paperwork-backend = callPackage ../applications/office/paperwork/backend.nix { };

papis = callPackage ../applications/office/papis { };
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 to all-packages.nix and use python3Packages.callPackage


src = pkgs.fetchurl {
url = "mirror://pypi/p/python-magic/${name}.tar.gz";
sha256 = "1hx2sjd4fdswswj3yydn2azxb59rjmi9b7jzh94lf1wnxijjizbr";
sha256 = "128j9y30zih6cyjyjnxhghnvpjm8vw40a1q7pgmrp035yvkaqkk0";
Copy link
Member

Choose a reason for hiding this comment

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

Would you mind moving this to development/python-modules/, specifying pname, version and using fetchPypi?

@dotlambda
Copy link
Member

For checking whether the dependents of python-magic still compile, use nix-shell -p nox --run "nox-review pr 34761"

Copy link
Member

@dotlambda dotlambda left a comment

Choose a reason for hiding this comment

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

The papis package should be put in pkgs/tools/... since it's command line only.

@nico202 nico202 force-pushed the papis branch 3 times, most recently from 6b0e120 to e4d8e76 Compare February 9, 2018 14:32
@nico202
Copy link
Contributor Author

nico202 commented Feb 9, 2018

  1. use pname instead of name
  2. move python-magic to its own file
  3. use vim instead of pkgs.vim
  4. move papis to all-packages, tools, use pythonApplication

@nico202
Copy link
Contributor Author

nico202 commented Feb 9, 2018

nox is failing, but even the following command fails on unstable

nix-build -A python27Packages.graphite_pager -A fava -A python36Packages.python_magic -A diffoscope -A python27Packages.thumbor -A python27Packages.alot -A python27Packages.python_magic -A alot -A beancount -A python36Packages.relatorio -A s3cmd

do we need to ask maintainers to fix the packages?

};

# Python 2.x is not supported.
disabled = !isPy3k && !isPyPy;
Copy link
Member

Choose a reason for hiding this comment

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

So, Python 2 isn't supported but PyPy is?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

my fault

};

# strictly requires 1.6.5 but nix has 1.6.6 only
preConfigure = "sed -i 's/1.6.5/1.6.6/' requirements.txt";
Copy link
Member

Choose a reason for hiding this comment

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

prePatch
I think you should rather replace == by >= to make this patch future-proof.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah that was stupid by me, fixing

Copy link
Member

Choose a reason for hiding this comment

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

You could also create an upstream PR.

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'm not on bitbucket and I'm not willed to sign up, and I could not find his mail address. He is @grimmy on github

pname = "pyparser";
version = "1.0";

src = fetchFromBitbucket {
Copy link
Member

Choose a reason for hiding this comment

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

Why not fetchPypi? fetchPypi is generally preferred because this makes it easier to override the src. However, in case e.g. tests are not uploaded to PyPI, it is better to use other sources.
The same applies for all other packages.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for this and for papis tests are missing, for one other they are failing. Fixed others

sha256 = "1kp2iyx20lpc9dv4qg5fgwf83a1wx6f7hj1ldqyncg0kn9xcrhbg";
};

meta = {
Copy link
Member

Choose a reason for hiding this comment

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

You could put a with lib; here to get rid of the lib. prefix if you want.


meta = {
description = "Get a BibTeX entry from an arXiv id number, using the arxiv.org API";
homepage = http://nathangrigg.github.io/arxiv2bib/;
Copy link
Member

Choose a reason for hiding this comment

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

Wrong descripion and homepage.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks

@dotlambda
Copy link
Member

If these packages do have maintainers, then yes it would nice to tell them about it.
But as long as all packages that were not broken beforehand compile fine after the update, you should not worry too much.

sha256 = "0aplb4zdpgbpmaw9qj0vr7qip9q5w7sl1m1lp1nc9jmjfij9i0hf";
};

preConfigure = "sed -i 's/parse==/parse>=/' requirements.txt";
Copy link
Member

Choose a reason for hiding this comment

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

postPatch


propagatedBuildInputs = [ file ];

patchPhase = ''
Copy link
Member

Choose a reason for hiding this comment

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

postPatch

sha256 = "0cw6ajdaknijka3j2bkkkn0bcxqifk825kq0a0rdbbmc6661pgxb";
};

preConfigure = "sed -i 's/configparser>=3.0.0/# configparser>=3.0.0/' setup.py";
Copy link
Member

Choose a reason for hiding this comment

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

postPatch

vim
];

preCheck = ''
Copy link
Member

Choose a reason for hiding this comment

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

Why is this needed? Leave an explanation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

@nico202 nico202 force-pushed the papis branch 3 times, most recently from 5b5b272 to 3be6a08 Compare February 9, 2018 15:29
@dotlambda
Copy link
Member

@GrahamcOfBorg build python2.pkgs.python-magic python3.pkgs.python-magic
@GrahamcOfBorg build python2.pkgs.arxiv2bib python3.pkgs.arxiv2bib
@GrahamcOfBorg build python2.pkgs.habanero python3.pkgs.habanero
@GrahamcOfBorg build python2.pkgs.papis-python-rofi python3.pkgs.papis-python-rofi
@GrahamcOfBorg build python3.pkgs.pylibgen
@GrahamcOfBorg build python2.pkgs.pyparser python3.pkgs.pyparser
@GrahamcOfBorg build papis

@GrahamcOfBorg
Copy link

Failure on x86_64-linux (full log)

Partial log (click to expand)

error: attribute ‘python-magic’ in selection path ‘python2.pkgs.python-magic’ not found

@GrahamcOfBorg
Copy link

Failure on aarch64-linux (full log)

Partial log (click to expand)

error: attribute 'python-magic' in selection path 'python2.pkgs.python-magic' not found

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Partial log (click to expand)

reading manifest file 'arxiv2bib.egg-info/SOURCES.txt'
writing manifest file 'arxiv2bib.egg-info/SOURCES.txt'
running build_ext

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
/nix/store/xljrpmkadgzych8lrc23b28xqfwz5qjq-python2.7-arxiv2bib-1.0.8
/nix/store/sf4ix1gj00xcqs9bqpx6yahklv6f1mbs-python3.6-arxiv2bib-1.0.8

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Partial log (click to expand)

reading manifest file 'arxiv2bib.egg-info/SOURCES.txt'
writing manifest file 'arxiv2bib.egg-info/SOURCES.txt'
running build_ext

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
/nix/store/yqgy43rplkkl4qy10d119i22p52cv025-python2.7-arxiv2bib-1.0.8
/nix/store/cgvdq69mdrmppyhnxd4ykfl7h3iibjaq-python3.6-arxiv2bib-1.0.8

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Partial log (click to expand)

reading manifest template 'MANIFEST.in'
writing manifest file 'papis_python_rofi.egg-info/SOURCES.txt'
running build_ext

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
/nix/store/djbckq084gkc4w4fdjmiabhnnjwkgwz2-python2.7-papis-python-rofi-1.0.2
/nix/store/fa9v9m9z4fc6by8dcwl1maa0qgqk8crg-python3.6-papis-python-rofi-1.0.2

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Partial log (click to expand)

reading manifest file 'habanero.egg-info/SOURCES.txt'
writing manifest file 'habanero.egg-info/SOURCES.txt'
running build_ext

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
/nix/store/9vd466dillbzcyw8ggncbpw6zv0b39gy-python2.7-habanero-0.6.0
/nix/store/6hbx1pdybzl11x9dqyblvp9kg4302knk-python3.6-habanero-0.6.0

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Partial log (click to expand)

reading manifest file 'habanero.egg-info/SOURCES.txt'
writing manifest file 'habanero.egg-info/SOURCES.txt'
running build_ext

----------------------------------------------------------------------
Ran 0 tests in 0.001s

OK
/nix/store/dp74cs064gvc3mkklfc2hdnm1zap1x62-python2.7-habanero-0.6.0
/nix/store/2g14lglbckmxp1my3vxj70p8h6jm8v8q-python3.6-habanero-0.6.0

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Partial log (click to expand)

reading manifest template 'MANIFEST.in'
writing manifest file 'papis_python_rofi.egg-info/SOURCES.txt'
running build_ext

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
/nix/store/p3k78inig9ll5fkn4f53xxa0pq5hvk90-python2.7-papis-python-rofi-1.0.2
/nix/store/5p0zl94450b80hvpa064pw5bg8kshay8-python3.6-papis-python-rofi-1.0.2

@dotlambda
Copy link
Member

@GrahamcOfBorg build python2.pkgs.python_magic python3.pkgs.python_magic

@nico202
Copy link
Contributor Author

nico202 commented Feb 9, 2018

Should python_magic be renamed to python-magic? Any guideline on the naming convention? I don't like the underscore but I kept it as it was

@dotlambda
Copy link
Member

Ran 0 tests in 0.000s

Please specify the appropriate checkPhase for arxiv2bib
For papis-python-rofi, you'll need to set doCheck = false and leave a comment that there are no tests

@dotlambda
Copy link
Member

pylibgen also needs an appropriate checkPhase

@nico202 nico202 force-pushed the papis branch 2 times, most recently from f5b9b0f to 8d57878 Compare February 9, 2018 16:15
@nico202
Copy link
Contributor Author

nico202 commented Feb 9, 2018

Fixed tests, let me know

};

# Required for tests only
buildInputs = [ mock ];
Copy link
Member

Choose a reason for hiding this comment

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

checkInputs

}:

buildPythonPackage rec {
name = "habanero-${version}";
Copy link
Member

Choose a reason for hiding this comment

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

pname

sha256 = "128j9y30zih6cyjyjnxhghnvpjm8vw40a1q7pgmrp035yvkaqkk0";
};

propagatedBuildInputs = [ file ];
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is necessary. Is it, @FRidh?

Copy link
Member

Choose a reason for hiding this comment

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

No, it is not. The patch introduces it so it can be found during run-time. I doubt it needs to be explicitly added during build-time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

@nico202 nico202 force-pushed the papis branch 2 times, most recently from 7a27d43 to 3bd19ec Compare February 9, 2018 16:43
@nico202
Copy link
Contributor Author

nico202 commented Feb 9, 2018

I had to change dateparser too because it was needed in order to run habanero tests. However tests on python3 are failing (as per comment). Failing tests are only 3 and because of this error:

AssertionError: False is not true : Didn't found any of the expected messages (['year is out of range', "('year must be in 1..9999'"]) -- message was: ValueError('year -2986 is out of range',)

So it might be possible to fix it upstream, I'll bump the issue

@dotlambda
Copy link
Member

I just created a PR for dateparser :D
We might want to merge #34768 first. Then you can rebase.

@nico202
Copy link
Contributor Author

nico202 commented Feb 9, 2018

:D no problem, I'll wait for dateparser merge.
Thanks

@dotlambda
Copy link
Member

@nico202 You can remove your commit regarding dateparser and rebase on master.

@nico202
Copy link
Contributor Author

nico202 commented Feb 9, 2018

@dotlambda thanks for everything, I know that has been a long review I'm sorry, I hope this time it's ok

Copy link
Member

@FRidh FRidh left a comment

Choose a reason for hiding this comment

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

Almost there ;)

# Required for tests only
checkInputs = [ mock ];

checkPhase = "python -m unittest discover -s tests";
Copy link
Member

Choose a reason for hiding this comment

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

${python.interpreter} instead of python

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ehm python is undefined

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 add it to dependencies

propagatedBuildInputs = [ requests ];

# It's not using unittest
checkPhase = "python tests/test_pylibgen.py -c 'test_api_endpoints()'";
Copy link
Member

Choose a reason for hiding this comment

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

${python.interpreter} instead of python

@nico202
Copy link
Contributor Author

nico202 commented Feb 10, 2018

Changed papis github url since yesterday it was moved to papis/papis

@FRidh FRidh changed the title [WIP] papis: init at 0.5.2 + dependencies papis: init at 0.5.2 + dependencies Feb 10, 2018
@FRidh FRidh merged commit d8d8a0a into NixOS:master Feb 10, 2018
@nico202 nico202 deleted the papis branch February 10, 2018 09:17
@nico202 nico202 mentioned this pull request Feb 14, 2018
8 tasks
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