Giter Site home page Giter Site logo

Comments (9)

vbabiy avatar vbabiy commented on May 18, 2024

Is there any way to set the line endings during the file generation/copy?

Maybe have two versions of the file, detect the platform, then select the
correct file for the platform before the copy operation.


Original Comment By: Kelsey Hightower

from pip.

vbabiy avatar vbabiy commented on May 18, 2024

I've now fixed my own code to generate correct newlines for each platform.

But regardless of my file-generation script, I think that Windows users should
be getting CRLF files and Linux users should be getting LF files. I think it's
impolite to put LF files on a Windows user's computer.


Original Comment By: Ram Rachum

from pip.

vbabiy avatar vbabiy commented on May 18, 2024

I am glad you found a solution. Since python is cross platform, it will be
hard to know where an enduser will deploy your code or package. I would always
suggest detecting the platform and doing the right thing when possible.


Original Comment By: Kelsey Hightower

from pip.

vbabiy avatar vbabiy commented on May 18, 2024

So you agree that pip should prefer downloading a zip distribution over a
tar.gz one on Windows?


Original Comment By: Ram Rachum

from pip.

vbabiy avatar vbabiy commented on May 18, 2024

I would not think an installer should treat zip or tarballs differently, as
both could contain the same package/code. As a developer I would rather handle
that kind of logic myself. Just image the issues you would run into if you
left that up to the installer. You would have to make sure RPM, easy_install,
pip, and other installers all do the same thing.


Original Comment By: Kelsey Hightower

from pip.

vbabiy avatar vbabiy commented on May 18, 2024

I'm confused by your comment.

My suggestion is about the case where a package on PyPI has both a zip
source distribution and a tar.gz one available.

When you as a developer publish these two kinds of source distributions on
PyPI, it's your responsibility that both of the distributions work and that
users can use either of them randomly. Do you agree on this?

Since it's the developer's responsibility to make sure all the source
distributions work, it is the right of every installer (such as easy_install
or pip) to choose randomly which kind of source distribution it wants to use.

So if pip has a right to choose whichever source distribution it wants, why
not be polite to the OS and choose the one that is more likely to have newline
characters that are compatible with the OS's?

"As a developer I would rather handle that kind of logic myself"

I don't understand. Where would you handle that logic? Your package only gets
executed after pip installs it, so how could it have any control on which
distribution pip downloads? Possibly I've completely misunderstood your
statement.


Original Comment By: Ram Rachum

from pip.

vbabiy avatar vbabiy commented on May 18, 2024

In my personal projects I make sure both the zip and tar.gz versions work the
same.

"As a developer I would rather handle that kind of logic myself"

One way I would handle the logic myself would be to put OS specific stuff in
setup.py. For example, you can select a different set of files that get
installed depending on the OS platform. The same OS detection could occur
during execution as well.

Keep in mind I am only speaking for myself, not the core pip developers.


Original Comment By: Kelsey Hightower

from pip.

vbabiy avatar vbabiy commented on May 18, 2024

"So if pip has a right to choose whichever source distribution it wants, why
not be polite to the OS and choose the one that is more likely to have newline
characters that are compatible with the OS's?"

I tend to agree with this statement. I guess the question here is; What's
Pip's current policy on how it selects which distribution to install when the
only difference is the packaging format (zip vs tar.gz)?


Original Comment By: Kelsey Hightower

from pip.

dstufft avatar dstufft commented on May 18, 2024

I'm going to close this. I don't think picking different extensions on different OSs is a generally good idea.

from pip.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.