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

[bug] An error occurs on export-pkg of python-require package #14818

Closed
apyvovar opened this issue Sep 25, 2023 · 3 comments · Fixed by #14819
Closed

[bug] An error occurs on export-pkg of python-require package #14818

apyvovar opened this issue Sep 25, 2023 · 3 comments · Fixed by #14819
Assignees
Labels
Milestone

Comments

@apyvovar
Copy link

apyvovar commented Sep 25, 2023

Environment details

  • Operating System+version: macOS 13.5.2
  • Compiler+version: apple clang 14.0.3
  • Conan version: 2.0.11
  • Python version: 3.11.4

Steps to reproduce

For some cases, I have to build Conan package in specific build folder. So, I'm using corresponding --output-folder with this approach.

But there's a problem with python-require package. Running conan export-pkg command on python-require package results an error - A python-require cannot be export-pkg
Interesting note: Despite an error, looks like the package is actually exports to cache and an assertion fails later (conan list command show newly created package in cache).

Logs

conan_utils/2.0.2: Exported: conan_utils/2.0.2#d52343939be22b0ecd71de27769573ac (2023-09-25 15:07:33 UTC)
ERROR: Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.11/site-packages/conan/cli/cli.py", line 272, in main
    cli.run(args)
  File "/opt/homebrew/lib/python3.11/site-packages/conan/cli/cli.py", line 172, in run
    command.run(self._conan_api, args[0][1:])
  File "/opt/homebrew/lib/python3.11/site-packages/conan/cli/command.py", line 125, in run
    info = self._method(conan_api, parser, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/conan/cli/commands/export_pkg.py", line 52, in export_pkg
    assert conanfile.package_type != "python-require", "A python-require cannot be export-pkg"
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: A python-require cannot be export-pkg

ERROR: A python-require cannot be export-pkg
@memsharded memsharded self-assigned this Sep 25, 2023
@memsharded
Copy link
Member

Hi @apyvovar

Thanks for the report.

Indeed every stacktrace should be considered as a bug and fixed.

In this case it seems the fix would be a better error message, but the protection would still be there. A python_require is only a conanfile.py recipe, but it does not contain binaries, so it cannot be export-pkg. It can be conan export or even conan create (which is an alias to conan export for python_requires). But the conan export-pkg command is a very specific command to package pre-compiled binaries from user space, which doesn't make sense for python_requires packages.

We will check the behavior and messages, it probably should avoid the initial export completely, and fail earlier, but lets have a look.

@memsharded memsharded added the bug label Sep 25, 2023
@memsharded memsharded added this to the 2.0.12 milestone Sep 25, 2023
@apyvovar
Copy link
Author

apyvovar commented Sep 25, 2023

Hello, @memsharded

Looks like the package is actually exported before an error. And it works properly.

Maybe, it makes more sense to handle python-require package as special case for export-pkg command for sake of consistency of package development flow, described in documentation (https://docs.conan.io/2/tutorial/developing_packages/local_package_development_flow.html) ? Feels like, this shouldn't cause much troubles.

@memsharded
Copy link
Member

I am proposing #14819 for a better error message and avoiding the export.
The issue is that conan create and also export-pkg have associated other mechanisms like the export of binaries, running the test_package test, or storing the information in lockfiles or the --format=json. Trying to do the equivalent of a conan create for a python-require inside export-pkg will be quite dirty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants