pytest-dependency icon indicating copy to clipboard operation
pytest-dependency copied to clipboard

Update build process to current standards

Open DimitriPapadopoulos opened this issue 5 months ago • 5 comments

Fixes #83.

  • setup.py → pyproject.toml
  • use setuptools_scm to retrieve version from Git tags at build time
  • use importlib.metadata.version to retrieve version at run time
  • setuptools_scm pulls all files under version control, adapt MANIFEST.in
  • update years of copyright under doc

I haven't updated the documentation yet, still based on setup.py. I'll do that once the current changes have been discussed/accepted.

DimitriPapadopoulos avatar Aug 03 '25 17:08 DimitriPapadopoulos

The CI error is:

 ImportError: Error importing plugin "pytest_dependency": No module named 'pytest_dependency'

It's as if pytest_dependecy was not installed when running tests. Will have to look into it.

DimitriPapadopoulos avatar Aug 10 '25 16:08 DimitriPapadopoulos

It's as if pytest_dependecy was not installed when running tests. Will have to look into it.

Note that in the current setup, the test suite imports pytest_dependecy from the build directory in the current working directory. They do not require to install the package to test it.

RKrahl avatar Aug 10 '25 17:08 RKrahl

Of course I know that the official docs recommend that. But to be honest, I see several practical disadvantages in that approach and fail to see any real benefit.

Sure, but you cannot navigate against the direction taken by the whole community for ever. And perhaps the community as a whole knows better... For example, from a security point of view, an installation process based on an executable Python file instead of a declarative configuration file is not great. The declarative configuration file is not a silver bullet, of course, but it's a step in the right direction.

Why you shouldn't invoke setup.py directly

DimitriPapadopoulos avatar Aug 10 '25 18:08 DimitriPapadopoulos

Please note that I dropped setuptools_scm in favour of git-props in https://github.com/RKrahl/pytest-dependency/pull/75. I don't think, I will revert that decision.

By the way, current git-props is documented to require Python 3.6: https://github.com/RKrahl/git-props?#system-requirements Do you pull an older version to run the build process with Python 3.4?

In any case, I understand why you want to stick with git-props. That's an obstacle indeed, it might be hard to use from a declarative config file.

DimitriPapadopoulos avatar Aug 10 '25 18:08 DimitriPapadopoulos

Note that in the current setup, the test suite imports pytest_dependecy from the build directory in the current working directory. They do not require to install the package to test it.

Yes, this problem surfaces very often when updating the build system of a package. I must admit I don't know what the recommended / best / official ways to handle that are. I need more reading. Unless you have clues?

DimitriPapadopoulos avatar Aug 10 '25 18:08 DimitriPapadopoulos