• Resolve circular dependency of a Python package

    From Jan Gru@21:1/5 to All on Thu May 20 07:40:02 2021
    Dear mentors,


    I want to ask a question on resolving circular dependencies of Python
    packages, which use distutils to build, as I am trying to package
    oletools, for which a RFP-bug has been filed [1].

    ~oletools~ has a circular dependency inside its seup.py [2] to ~pcodedmp~

    #+BEGIN_SRC

            install_requires=[

               ...

               'pcodedmp>=1.2.5',
            ],

    #+END_SRC

    In turn ~pcodedmp~has a dependency on ~oletools~ in its setup.py [3]


    #+BEGIN_SRC

    INSTALL_REQUIRES = [
        'oletools>=0.54',
        ...
    ]

    #+END_SRC

    Those are de-facto runtime dependencies, but ~pcodedmp~ is required by ~oletools~ to run the `python setup.py tests` during the build of
    oletools, so it is kind of a build dependency, too. I assume disabling
    those tests selectively, which require ~pcodedmp~ would be a viable
    solution, since the policy suggests to break the loop by utilizing
    Debian tooling [4]. Is this correct?

    If so, I have a practical question about realizing it:  I consulted the documentation of pybuild [5] and am able to disable all tests, which
    might not be an apt solution. Therefore I tried to `export PYBUILD_TEST_ARGS=-k-test_to_skip` in the rules file, which should
    disable only the test(s) in question. Unfortunately this does not work
    as I get the error error:

    `I: pybuild base:232: python3.9 setup.py test -k-test_to_skip
    [...snip...] error: option -k not recognized`

    Do you have an idea on how to resolve this and where the problem
    resides? Is the pybuild-documentation misleading in this regard or is it
    my fault?


    Thanks already in advance for your help!


    Best regards,

    Jan

    ---

    [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=939464

    [2] https://github.com/decalage2/oletools/blob/master/setup.py

    [3] https://github.com/bontchev/pcodedmp/blob/master/setup.py

    [4] https://www.debian.org/doc/debian-policy/ch-relationships.html#binary-dependencies-depends-recommends-suggests-enhances-pre-depends


    [5] See https://wiki.debian.org/Python/Pybuild

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andrey Rahmatullin@21:1/5 to Jan Gru on Fri May 21 22:20:01 2021
    On Thu, May 20, 2021 at 07:32:53AM +0200, Jan Gru wrote:
    Those are de-facto runtime dependencies, but ~pcodedmp~ is required by ~oletools~ to run the `python setup.py tests` during the build of oletools, so it is kind of a build dependency, too. I assume disabling those tests selectively, which require ~pcodedmp~ would be a viable solution, since the policy suggests to break the loop by utilizing Debian tooling [4]. Is this correct?
    Yes, assuming it's indeed not needed for the build process.

    If so, I have a practical question about realizing it:  I consulted the documentation of pybuild [5] and am able to disable all tests, which might not be an apt solution. Therefore I tried to `export PYBUILD_TEST_ARGS=-k-test_to_skip` in the rules file, which should disable only the test(s) in question. Unfortunately this does not work as I get the error error:

    `I: pybuild base:232: python3.9 setup.py test -k-test_to_skip [...snip...] error: option -k not recognized`
    -k is indeed a pytest option, and the doc you used mentions that.
    I'd just disable all tests.

    --
    WBR, wRAR

    -----BEGIN PGP SIGNATURE-----

    iQJhBAABCgBLFiEEolIP6gqGcKZh3YxVM2L3AxpJkuEFAmCoFJstFIAAAAAAFQAP cGthLWFkZHJlc3NAZ251cGcub3Jnd3JhckBkZWJpYW4ub3JnAAoJEDNi9wMaSZLh pwoP/icOlwKE3klp6xtgxGDlw+92eoeHzVIdi8BzU+V1R74H+vhUE5BZO0l1LlpK jzdphuMSctTscH4PsnB67VE2VK/o/qYwQ8NTdoBDDPECkzYeBiDFun/VITi/5VEu I5Hiz1Sb9ZrDahWYeFG+3LLQLYpQBuhFIg6LYbvXcaHXZ7I4Nl1cyv0l4TpC7Obr cw5XopxHVxdvWWlxH59JfjcXr+a/smpelIKu4K0SehhYMEz3tgnyQ1gurMHZtQ9R WDnQcP1ARlS0iPq4ifUMYNIssH+Nwb5GA6aHPta7QDK/b0q9XtEEkW2FgsqwjbNP qRrlz6sBTcJAw04NL0hcMnVTdTKyoeoIGJHNqts8nkxTE7SmM1M9meoakuxScKdE YwI0mpSr/a9NW1W+Yk1S43ErUN/G5i8i4BiQapqA0aSLr63NN5o+1u6RTpttWEkR WE6KYYutdOD+8rd4zCenx9iYSrWKwXB+jUaWcKtlcgx2neRzPRn0v22a2iXep8HJ tuCYAQua/z7rJZ6+hi1aOPhpXaCobRqhfcXh9S+F9zZVvs8Th1bGbUiPifefWzIU sgSZHhDdkomv6KfcC/D2No33zVCPtwSA58chA/RcHl0J+IIpWDvunuXQWZRWgbJP c2RganWVyR8HzAU90IWlXdZiE+zw6f15D3dR4WjhP4WIpO5e
    =JxV2
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)