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

DataValidationError: Invalid type for field editable in Pipfile #6173

Closed
Samk13 opened this issue Jun 8, 2024 · 4 comments
Closed

DataValidationError: Invalid type for field editable in Pipfile #6173

Samk13 opened this issue Jun 8, 2024 · 4 comments
Assignees

Comments

@Samk13
Copy link

Samk13 commented Jun 8, 2024

Issue description

I ran into a new error while installing Invenio today and got this message when running invenio-cli install on a new venv:

File "/home/user/.pyenv/versions/3.9.19/envs/rdm/lib/python3.9/site-packages/pipenv/vendor/plette/models/base.py", line 49, in validate
    raise DataValidationError(f"Invalid type for field {k}: {type(data[k])}")
pipenv.vendor.plette.models.base.DataValidationError: Invalid type for field editable: <class 'pipenv.vendor.tomlkit.items.String'>
Failed to install dependencies.

Version

pipenv==2024.0.0

Expected result

Dependencies should install without errors.

Actual result

Dependencies failed to install due to a DataValidationError.

Steps to replicate

  1. Create a new virtual environment.
  2. Run invenio-cli install see install instructions
  3. Observe the error when you install dependencies.

Pipfile before the fix:

# invenio.cfg
[packages]
your-site = {editable="True", path="./site"}

Fix:

Pipfile after the fix:

[packages]
your-site = {editable=true, path="./site"}

it seems like the error is related to this change if I am not mistaken:

https://github.com/pypa/pipenv/pull/6139/files#diff-aefce74956111facce5b6385d83cd8c91f0b81f7692297e99a62a2a1bb9cb6f6


Please run $ pipenv --support, and paste the results here. Don't put backticks (`) around it! The output already contains Markdown formatting.

pipenv --support | xclip
Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.

$ pipenv --support

Pipenv version: '2024.0.0'

Pipenv location: '/home/user/.pyenv/versions/3.9.19/envs/test-install/lib/python3.9/site-packages/pipenv'

Python location: '/home/user/.pyenv/versions/3.9.19/envs/test-install/bin/python'

OS Name: 'posix'

User pip version: '24.0'

user Python installations found:

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.9.19',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '6.8.0-76060800daily20240311-generic',
 'platform_system': 'Linux',
 'platform_version': '#202403110203~1715181801~22.04~aba43ee SMP '
                     'PREEMPT_DYNAMIC Wed M',
 'python_full_version': '3.9.19',
 'python_version': '3.9',
 'sys_platform': 'linux'}

System environment variables:

  • SHELL
  • SESSION_MANAGER
  • PYENV_HOOK_PATH
  • QT_ACCESSIBILITY
  • COLORTERM
  • PYENV_SHELL
  • XDG_CONFIG_DIRS
  • SSH_AGENT_LAUNCHER
  • PYENV_ACTIVATE_SHELL
  • NVM_INC
  • XDG_MENU_PREFIX
  • GNOME_DESKTOP_SESSION_ID
  • GTK_IM_MODULE
  • LC_ADDRESS
  • GNOME_SHELL_SESSION_MODE
  • LC_NAME
  • SSH_AUTH_SOCK
  • XMODIFIERS
  • HOMEBREW_PREFIX
  • DESKTOP_SESSION
  • LC_MONETARY
  • EDITOR
  • PYENV_VERSION
  • GTK_MODULES
  • PWD
  • PYENV_VIRTUALENV_INIT
  • XDG_SESSION_DESKTOP
  • LOGNAME
  • XDG_SESSION_TYPE
  • MANPATH
  • GPG_AGENT_INFO
  • SYSTEMD_EXEC_PID
  • XAUTHORITY
  • WINDOWPATH
  • HOME
  • USERNAME
  • LANG
  • LC_PAPER
  • LS_COLORS
  • XDG_CURRENT_DESKTOP
  • VIRTUAL_ENV
  • VTE_VERSION
  • GNOME_TERMINAL_SCREEN
  • PYENV_DIR
  • INFOPATH
  • NVM_DIR
  • LESSCLOSE
  • XDG_SESSION_CLASS
  • LC_IDENTIFICATION
  • TERM
  • LESSOPEN
  • USER
  • GNOME_TERMINAL_SERVICE
  • HOMEBREW_CELLAR
  • VISUAL
  • DISPLAY
  • PYENV_VIRTUAL_ENV
  • SHLVL
  • NVM_CD_FLAGS
  • LC_TELEPHONE
  • QT_IM_MODULE
  • HOMEBREW_REPOSITORY
  • LC_MEASUREMENT
  • PAPERSIZE
  • XDG_RUNTIME_DIR
  • PYENV_ROOT
  • LC_TIME
  • XDG_DATA_DIRS
  • PATH
  • GDMSESSION
  • DBUS_SESSION_BUS_ADDRESS
  • FZF_DEFAULT_OPTS
  • _OLD_VIRTUAL_PS1
  • NVM_BIN
  • LC_NUMERIC
  • OLDPWD
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PYTHONDONTWRITEBYTECODE
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /home/user/.pyenv/versions/invenio-communities/bin:/home/user/.pyenv/versions/3.9.19/bin:/home/user/.pyenv/versions/docs-invenio-rdm/bin:/home/user/.pyenv/versions/test-install/bin:/home/user/.pyenv/versions/kth-rdm-prod/bin:/home/user/.pyenv/versions/invenio-users-resources/bin:/home/user/.pyenv/versions/test-install/bin:/home/user/.pyenv/libexec:/home/user/.pyenv/plugins/python-build/bin:/home/user/.pyenv/plugins/pyenv-virtualenv/bin:/home/user/.pyenv/plugins/pyenv-update/bin:/home/user/.pyenv/plugins/pyenv-doctor/bin:/home/user/.cargo/bin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:/home/user/.nvm/versions/node/v20.13.1/bin:/home/user/.pyenv/plugins/pyenv-virtualenv/shims:/home/user/.pyenv/shims:/home/user/.pyenv/bin:/home/user/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/user/bin:/opt/nvim-linux64/bin
  • SHELL: /bin/bash
  • EDITOR: code --wait
  • LANG: en_US.UTF-8
  • PWD: /home/user/INVENIO/issues/test-install/test-install
  • VIRTUAL_ENV: /home/user/.pyenv/versions/3.9.19/envs/test-install

Contents of Pipfile ('/home/user/INVENIO/issues/test-install/test-install/Pipfile'):

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
check-manifest = ">=0.25"

[packages]
invenio-app-rdm = {extras = ["opensearch2"], version = "~=12.0.0b2.dev0"}
test-install = {editable="True", path="./site"}

uwsgi = ">=2.0"
uwsgitop = ">=0.11"
uwsgi-tools = ">=1.1.1"

[requires]
python_version = "3.9"

[pipenv]
allow_prereleases = false
@oz123
Copy link
Contributor

oz123 commented Jun 8, 2024

This is fixed in plette version 2.1.0 which is just release, but at the moment pypi is down due to maintenance. As soon as it's back, I'll merge a PR here and release a new pipenv version.

@oz123
Copy link
Contributor

oz123 commented Jun 8, 2024

Fixed in sarugaku/plette@00258ed

@oz123 oz123 self-assigned this Jun 8, 2024
oz123 added a commit that referenced this issue Jun 8, 2024
This fixes breakage on files which use scripts callable.

#6173

Signed-off-by: Oz Tiram <oz.tiram@gmail.com>
oz123 added a commit that referenced this issue Jun 8, 2024
This fixes breakage on files which use scripts callable.

#6173

Signed-off-by: Oz Tiram <oz.tiram@gmail.com>
@oz123
Copy link
Contributor

oz123 commented Jun 9, 2024

Apologies, I thought this was a duplicate of an issue reported in plette. These are not the same, this issue is still not fixed.

@oz123
Copy link
Contributor

oz123 commented Jun 9, 2024

The error message raised by plette was wrong. At the same time, the code is trying to convey that the validation of your Pipfile is wrong. With the current plette code, you can do:

$ python -m plette -f examples/Pipfile.ok.editable 
$ echo $?
0
$python -m plette -f examples/Pipfile.invalid.editable 
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/oznt/Software/sarugaku/plette/src/plette/__main__.py", line 29, in <module>
    pipfile = Pipfile.load(f)
              ^^^^^^^^^^^^^^^
  File "/home/oznt/Software/sarugaku/plette/src/plette/pipfiles.py", line 65, in load
    return cls(data)
           ^^^^^^^^^
  File "/home/oznt/Software/sarugaku/plette/src/plette/models/base.py", line 8, in __init__
    self.validate(data)
  File "/home/oznt/Software/sarugaku/plette/src/plette/pipfiles.py", line 44, in validate
    klass.validate(data[key])
  File "/home/oznt/Software/sarugaku/plette/src/plette/models/base.py", line 118, in validate
    cls.item_class.validate(d)
  File "/home/oznt/Software/sarugaku/plette/src/plette/models/packages.py", line 35, in validate
    PackageSpecfiers.validate(data)
  File "/home/oznt/Software/sarugaku/plette/src/plette/models/base.py", line 49, in validate
    raise DataValidationError(f"Invalid type for field {k}: {type(data[k])}")
plette.models.base.DataValidationError: Invalid type for field editable: <class 'tomlkit.items.String'>

To have your packages install correctly, all you have to do is to fix your Pipfile. Change "True" to true.

$diff examples/Pipfile.invalid.editable examples/Pipfile.ok.editable
8c8
< your-site = {editable="True", path="./site"}
---
> your-site = {editable = true, path="./site", extras = ["tests", "dev"]}

See:

sarugaku/plette@6939a9e

@oz123 oz123 closed this as completed Jun 9, 2024
utnapischtim added a commit to utnapischtim/cookiecutter-invenio-rdm that referenced this issue Jun 9, 2024
utnapischtim added a commit to inveniosoftware/cookiecutter-invenio-rdm that referenced this issue Jun 11, 2024
utnapischtim added a commit to utnapischtim/cookiecutter-invenio-rdm that referenced this issue Jul 2, 2024
phette23 added a commit to cca/cca_invenio that referenced this issue Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants