mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Fix toml imports
Add a compat layer for using tomllib from STL which allows us to drop vendored toml library.
This commit is contained in:
+8
-1
@@ -13,6 +13,13 @@ import urllib.parse
|
||||
from json.decoder import JSONDecodeError
|
||||
from pathlib import Path
|
||||
|
||||
import click, tomlkit
|
||||
|
||||
try:
|
||||
import tomllib as toml
|
||||
except ImportError:
|
||||
import tomli as toml
|
||||
|
||||
from pipenv.cmdparse import Script
|
||||
from pipenv.environment import Environment
|
||||
from pipenv.environments import Setting, is_in_virtualenv, normalize_pipfile_path
|
||||
@@ -40,7 +47,7 @@ from pipenv.utils.shell import (
|
||||
system_which,
|
||||
)
|
||||
from pipenv.utils.toml import cleanup_toml, convert_toml_outline_tables
|
||||
from pipenv.vendor import click, plette, toml, tomlkit
|
||||
from pipenv.vendor import plette
|
||||
from pipenv.vendor.requirementslib.models.utils import get_default_pyproject_backend
|
||||
|
||||
try:
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import os
|
||||
import dotenv
|
||||
import click
|
||||
|
||||
from pipenv import environments
|
||||
from pipenv.vendor import click, dotenv
|
||||
|
||||
|
||||
def load_dot_env(project, as_dict=False, quiet=False):
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
from pipenv.vendor import toml, tomlkit
|
||||
try:
|
||||
import tomllib as toml
|
||||
except ImportError:
|
||||
import tomli as toml
|
||||
|
||||
import tomlkit
|
||||
|
||||
|
||||
def cleanup_toml(tml):
|
||||
|
||||
Vendored
+5
-1
@@ -10,6 +10,11 @@ from io import StringIO
|
||||
from configparser import ConfigParser, NoOptionError
|
||||
from pathlib import PurePath
|
||||
|
||||
try:
|
||||
import tomllib as toml
|
||||
except ImportError:
|
||||
import tomli as toml
|
||||
|
||||
from .errors import MalformedDependencyFileError
|
||||
from .regex import HASH_REGEX
|
||||
|
||||
@@ -17,7 +22,6 @@ from .dependencies import DependencyFile, Dependency
|
||||
from pipenv.patched.pip._vendor.packaging.requirements import Requirement as PackagingRequirement,\
|
||||
InvalidRequirement
|
||||
from . import filetypes
|
||||
import pipenv.vendor.toml as toml
|
||||
from pipenv.patched.pip._vendor.packaging.specifiers import SpecifierSet
|
||||
from pipenv.patched.pip._vendor.packaging.version import Version, InvalidVersion
|
||||
import json
|
||||
|
||||
Vendored
+5
-1
@@ -3,9 +3,13 @@ from __future__ import absolute_import, print_function, unicode_literals
|
||||
import re
|
||||
import json
|
||||
import tempfile
|
||||
import pipenv.vendor.toml as toml
|
||||
import os
|
||||
|
||||
try:
|
||||
import tomllib as toml
|
||||
except ImportError:
|
||||
import tomli as toml
|
||||
|
||||
|
||||
class RequirementsTXTUpdater(object):
|
||||
SUB_REGEX = r"^{}(?=\s*\r?\n?$)"
|
||||
|
||||
Reference in New Issue
Block a user