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

Include a 'version' tag in Pipfile.lock #5

Closed
defnull opened this issue Nov 21, 2016 · 10 comments
Closed

Include a 'version' tag in Pipfile.lock #5

defnull opened this issue Nov 21, 2016 · 10 comments

Comments

@defnull
Copy link

defnull commented Nov 21, 2016

No description provided.

@dstufft
Copy link
Member

dstufft commented Nov 21, 2016

Yes I thought about this as well. Ideally this is something that is dependent of the serialization mechanism entirely so that we can change serialization formats as needed. Something like:

version=1
{
    "_meta": {
        "sources": [
            {"url": "https://pypi.org/", "verify_ssl": true},
        ]
     },
    "default": [
        {"name": "requests", "version": "0.11.2", "hash": "..."},
        {"name": "Django", "version": "1.6", "hash": "..."},
        {"name": "pinax", "git": "git://...", "ref": "1.4", "editable": true},
    ],
    "development": [
        {"name": "nose", "version": "1.3.7", "hash": "..."},
    ]
}

It makes parsing slightly harder in that you have to read the first line to get the version, and then only parse line 2+ for the rest of the data, but it means we can easily switch to any other serialization format we want.

@defnull
Copy link
Author

defnull commented Nov 21, 2016

I don't agree. There are only a handful of serialization formats that may be interesting and auto-detecting the format is not that hard. Breaking the format this way would render most existing tools useless. You are basically introducing a non-standard container format here.

@Screwtapello
Copy link

Even with a version tag, it likely won't be practical to change the serialisation mechanism; there's going to (eventually) be a lot of code in the wild that just assumes that the version number will always be 1. Much like every future version of HTML is constrained to be intelligible to an HTML4 parser, every future version of the lockfile spec is going to have to work with a version 1 parser.

@dstufft
Copy link
Member

dstufft commented Nov 21, 2016

Eh, I disagree. People will bake all sorts of random assumptions into their code. If we state that new versions are a thing they need to support then that's sort of it. Otherwise we can never add any new syntax to the lock file at all because someone might not correctly be handling unexpected new data.

@Screwtapello
Copy link

A half-assed, "it worked once, never touch it again" Pipfile.lock parser will never support multiple versions, no matter how many warnings you put in the file-format spec, because people writing such parsers won't even look at the spec. On the other hand, a half-assed parser is almost guaranteed to ignore parts of the file it doesn't understand, because anything else is wasted effort.

No file-format decision can guarantee that every implementation follows the specification. However, a file-format that expects and requires laziness will likely be more interoperably and reliably implemented than one which requires even minimal attention to other details.

@dstufft
Copy link
Member

dstufft commented Jan 26, 2017

In #28 it was suggested to embed the pip version inside of the Pipfile.lock. I believe that this has the same fundamental idea as this issue, provide a mechanism by which you can version the Pipfile.lock. Ultimately, I think just a spec version is a better idea than a "pip version", because part of the goal here is to allow other tooling to interact with these files independetly of pip (for example, IDEs) without needing to pretend they are pip.

@kennethreitz
Copy link
Contributor

I'll add this to pipenv.

@kennethreitz
Copy link
Contributor

Declaring current version as 1.

@kennethreitz
Copy link
Contributor

{"_meta": {"pipfile-spec": 1}}

@kennethreitz
Copy link
Contributor

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

No branches or pull requests

4 participants