Pipenv: Pipfile-Parsing nicht vollständig TOML-kompatibel

Erstellt am 1. März 2018  ·  3Kommentare  ·  Quelle: pypa/pipenv

Genau diese Besorgnis scheint in Ausgabe #613 geäußert und zurückgewiesen worden zu sein. Irgendwann hat pipenv die richtige Unterstützung für zitierte Schlüssel eingestellt. Wenn dies nicht der Fall ist, hoffe ich, dass ich auf die verwendete Spezifikation hingewiesen werden kann, um meine Pipfiles besser zu erstellen.

Die Absätze zu zitierten und gepunkteten Schlüsseln im Abschnitt Schlüssel dieser README sind für dieses Problem relevant: https://github.com/toml-lang/toml#keys

Beschreiben Sie Ihre Umgebung
  1. Debian 10
  2. Python-Version: 3.6.4
  3. Pipenv-Version: 10.1.2
Erwartetes Ergebnis

Diese Pipfel...

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

["requires"]
python_version = "3.6"

[packages]
motor = "*"

    [packages."discord.py"]
    git = "https://github.com/Rapptz/discord.py.git"
    ref = "rewrite"
    editable = true
    extras = ["voice"]

Sollte das folgende Wörterbuch rendern... (geparst von toml und Prettyprinted)

{'packages': {'discord.py': {'editable': True,
                             'extras': ['voice'],
                             'git': 'https://github.com/Rapptz/discord.py.git',
                             'ref': 'rewrite'},
              'motor': '*'},
 'requires': {'python_version': '3.6'},
 'source': [{'name': 'pypi',
             'url': 'https://pypi.python.org/simple',
             'verify_ssl': True}]}
Tatsächliche Ergebnis
Traceback (most recent call last):
  File "/home/akirasama/.local/bin/pipenv", line 11, in <module>
    sys.exit(cli())
  File "/home/akirasama/.local/venvs/pipenv/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/akirasama/.local/venvs/pipenv/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/akirasama/.local/venvs/pipenv/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/akirasama/.local/venvs/pipenv/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/akirasama/.local/venvs/pipenv/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/akirasama/.local/venvs/pipenv/lib/python3.6/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/akirasama/.local/venvs/pipenv/lib/python3.6/site-packages/pipenv/cli.py", line 433, in sync
    clear=clear, unused=unused, sequential=sequential
  File "/home/akirasama/.local/venvs/pipenv/lib/python3.6/site-packages/pipenv/core.py", line 2389, in do_sync
    ensure_project(three=three, python=python, validate=False)
  File "/home/akirasama/.local/venvs/pipenv/lib/python3.6/site-packages/pipenv/core.py", line 603, in ensure_project
    ensure_virtualenv(three=three, python=python, site_packages=site_packages)
  File "/home/akirasama/.local/venvs/pipenv/lib/python3.6/site-packages/pipenv/core.py", line 548, in ensure_virtualenv
    python = ensure_python(three=three, python=python)
  File "/home/akirasama/.local/venvs/pipenv/lib/python3.6/site-packages/pipenv/core.py", line 424, in ensure_python
    python = project.required_python_version
  File "/home/akirasama/.local/venvs/pipenv/lib/python3.6/site-packages/pipenv/project.py", line 110, in required_python_version
    required = self.parsed_pipfile.get('requires', {}).get('python_full_version')
  File "/home/akirasama/.local/venvs/pipenv/lib/python3.6/site-packages/pipenv/project.py", line 271, in parsed_pipfile
    return contoml.loads(toml.dumps(data, preserve=True))
  File "/home/akirasama/.local/venvs/pipenv/lib/python3.6/site-packages/pipenv/patched/contoml/__init__.py", line 15, in loads
    elements = parse_tokens(tokens)
  File "/home/akirasama/.local/venvs/pipenv/lib/python3.6/site-packages/pipenv/patched/prettytoml/parser/__init__.py", line 17, in parse_tokens
    return _parse_token_stream(TokenStream(tokens))
  File "/home/akirasama/.local/venvs/pipenv/lib/python3.6/site-packages/pipenv/patched/prettytoml/parser/__init__.py", line 32, in _parse_token_stream
    raise ParsingError('Failed to parse line {}'.format(pending.head.row))
prettytoml.parser.errors.ParsingError: Failed to parse line 11
Schritte zum Replizieren

$ pipenv lock

Won't Fix

Hilfreichster Kommentar

Ich verstehe. Das Label wontfix hat mich verwirrt. Dankeschön!

Alle 3 Kommentare

@kennethreitz

Können Sie erklären, warum dieser Teil der TOML-Spezifikation nicht unterstützt wird? Ich möchte wirklich nicht für alle meine Pakete auf Inline-Tabellen zurückgreifen.

Wäre es besser, wenn ich im pipfile-Repository ein Problem bezüglich der Einhaltung der TOML-Spezifikation mache?

Wir werden es reparieren, es hat gerade für uns nur geringe Priorität

Ich verstehe. Das Label wontfix hat mich verwirrt. Dankeschön!

War diese Seite hilfreich?
0 / 5 - 0 Bewertungen