You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
but I am getting what might be a predictable error - the project is not installed yet when pdm attempts to import it to call the function and get ModuleNotFoundError: No module named 'myproject'
expand/collapse traceback
pdm.termui: Overwriting distribution myproject
pdm.termui: Preparing environment(Isolated mode) for PEP 517 build...
pdm.termui: Running PEP 517 backend to build a wheel for <Link file:///Users/jonny/git/myproject (from None)>
pdm.termui: Traceback (most recent call last):
pdm.termui: File "/Users/jonny/.pyenv/versions/3.13.1/lib/python3.13/site-packages/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
pdm.termui: main()
pdm.termui: ~~~~^^
pdm.termui: File "/Users/jonny/.pyenv/versions/3.13.1/lib/python3.13/site-packages/pyproject_hooks/_in_process/_in_process.py", line 373, in main
pdm.termui: json_out["return_val"] = hook(**hook_input["kwargs"])
pdm.termui: ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
pdm.termui: File "/Users/jonny/.pyenv/versions/3.13.1/lib/python3.13/site-packages/pyproject_hooks/_in_process/_in_process.py", line 303, in build_editable
pdm.termui: return hook(wheel_directory, config_settings, metadata_directory)
pdm.termui: File "/var/folders/b8/28n_6_zn7flgh40028jxd8j80000gn/T/pdm-build-env-ogl12rz6-shared/lib/python3.13/site-packages/pdm/backend/__init__.py", line 101, in build_editable
pdm.termui: return builder.build(
pdm.termui: ~~~~~~~~~~~~~^
pdm.termui: wheel_directory, metadata_directory=metadata_directory
pdm.termui: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pdm.termui: ).name
pdm.termui: ^
pdm.termui: File "/var/folders/b8/28n_6_zn7flgh40028jxd8j80000gn/T/pdm-build-env-ogl12rz6-shared/lib/python3.13/site-packages/pdm/backend/base.py", line 226, in build
pdm.termui: self.initialize(context)
pdm.termui: ~~~~~~~~~~~~~~~^^^^^^^^^
pdm.termui: File "/var/folders/b8/28n_6_zn7flgh40028jxd8j80000gn/T/pdm-build-env-ogl12rz6-shared/lib/python3.13/site-packages/pdm/backend/base.py", line 193, in initialize
pdm.termui: self.call_hook("pdm_build_initialize", context)
pdm.termui: ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pdm.termui: File "/var/folders/b8/28n_6_zn7flgh40028jxd8j80000gn/T/pdm-build-env-ogl12rz6-shared/lib/python3.13/site-packages/pdm/backend/base.py", line 151, in call_hook
pdm.termui: getattr(hook, hook_name)(context, *args, **kwargs)
pdm.termui: ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
pdm.termui: File "/var/folders/b8/28n_6_zn7flgh40028jxd8j80000gn/T/pdm-build-env-ogl12rz6-shared/lib/python3.13/site-packages/pdm/backend/hooks/version/__init__.py", line 60, in pdm_build_initialize
pdm.termui: getattr(self, f"resolve_version_from_{source}")(context, **options)
pdm.termui: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
pdm.termui: File "/var/folders/b8/28n_6_zn7flgh40028jxd8j80000gn/T/pdm-build-env-ogl12rz6-shared/lib/python3.13/site-packages/pdm/backend/hooks/version/__init__.py", line 161, in resolve_version_from_call
pdm.termui: version_getter, args = evaluate_module_attribute(getter, context.root)
pdm.termui: ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
pdm.termui: File "/var/folders/b8/28n_6_zn7flgh40028jxd8j80000gn/T/pdm-build-env-ogl12rz6-shared/lib/python3.13/site-packages/pdm/backend/utils.py", line 206, in evaluate_module_attribute
pdm.termui: module = importlib.import_module(matched.group(1))
pdm.termui: File "/Users/jonny/.pyenv/versions/3.13.1/lib/python3.13/importlib/__init__.py", line 88, in import_module
pdm.termui: return _bootstrap._gcd_import(name[level:], package, level)
pdm.termui: ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pdm.termui: File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
pdm.termui: File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
pdm.termui: File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked
pdm.termui: File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
pdm.termui: File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
pdm.termui: File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
pdm.termui: File "<frozen importlib._bootstrap>", line 1324, in _find_and_load_unlocked
pdm.termui: ModuleNotFoundError: No module named 'myproject'
Wondering if i am doing something wrong here? I can't find tests for dynamic versions from function calls like this. It looks like the installer tries to patch sys.path, but my package is in src layout to avoid path bugs, so i tried moving the version function to scripts/version.py and that looks like it works. Is that how it's supposed to be used, or is that a bug? If that's intended behavior I would be willing to contribute docs and tests for this :)
on latest version (2.22.3)
The text was updated successfully, but these errors were encountered:
Hello!
I'm trying to use the
source = "call"
as described in the docs for a src-layout project like thisbut I am getting what might be a predictable error - the project is not installed yet when pdm attempts to import it to call the function and get
ModuleNotFoundError: No module named 'myproject'
expand/collapse traceback
Wondering if i am doing something wrong here? I can't find tests for dynamic versions from function calls like this. It looks like the installer tries to patch
sys.path
, but my package is insrc
layout to avoid path bugs, so i tried moving the version function toscripts/version.py
and that looks like it works. Is that how it's supposed to be used, or is that a bug? If that's intended behavior I would be willing to contribute docs and tests for this :)on latest version (2.22.3)
The text was updated successfully, but these errors were encountered: