Resolve circular dependency of a Python package

2021-05-19 Thread Jan Gru

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




Re: Resolve circular dependency of a Python package

2021-05-21 Thread Andrey Rahmatullin
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


signature.asc
Description: PGP signature