Giter Site home page Giter Site logo

Comments (11)

jamesmyatt avatar jamesmyatt commented on July 23, 2024

I've looked at #15, but I don't understand the issue. Surely the package names and numbers reported via pip are the ones that you want to report, rather than the value of some internal attribute.

from watermark.

rasbt avatar rasbt commented on July 23, 2024

Is there a reason why _get_packages doesn't use pkg_resources to get the package version numbers, like pip does?

Honestly has been so long that I don't remember why I chose one over the other, but I think pkg_resources does not work with older versions of Python setuptools?

I think it's useful to support these Python versions for people who deliberately have to use an old python version on a webserver or so. On the other hand, this is a IPython magic command, so there may not be an intersection of people who have IPython installed but yet have such an old setuptools version.

So I agree with you changing to pkg_resources makes sense

from watermark.

jamesmyatt avatar jamesmyatt commented on July 23, 2024

I'm happy to make these changes when I have time, but it will be a major version since it changes the meaning of the -p flag (from modules to packages).

It is worth dropping guaranteed support for Python 2 at the same time? i.e. for version 2.0. IPython hasn't supported it 2 major versions ago. https://python3statement.org/. In fact, IPython 7.0+ only supports Python 3.5 and above.

from watermark.

rasbt avatar rasbt commented on July 23, 2024

It is worth dropping guaranteed support for Python 2 at the same time?

That's a tough question. Making features like this easier to implement is exactly the reason why I think people should "slowly" start about dropping Py 2 support if they haven't done so already.

However, pip install ipython it will still install IPython no matter which Python version you have, and one of the use cases of this package is to find out more about the environment that a user used to run/execute particular code (when my students have questions regarding hw submissions, it's super handy to tell them to execute %watermark ... in the notebook and report back the output of this.

So, I am afraid dropping Py2 makes this less useful, because people who are voluntarily or involuntarily using Python 2.7 but then unable to install watermark for a reason unknown to them (thinking of beginners), and then it will just be another hurdle to them to find out why they can't install it etc..

Anyways, usually, I am in favor of dropping Py 2 support, but maybe we shouldn't do that just yet. I do think though a (deprecation) warning should be displayed if a person runs watermark in IPython on Python 2.7 as a start.

from watermark.

jamesmyatt avatar jamesmyatt commented on July 23, 2024

If the change was made in v2.0 then v1.x would still install on Python 2.7 just as IPython 5.x does

from watermark.

rasbt avatar rasbt commented on July 23, 2024

That sounds good to me then. Have never done that before -- you are basically saying we can specify the IPython/Python dependency of the 2.0 version somewhere in the setup.py file so that people on Python 2.7 get the correct (compatible) 1.7 version when they run pip install watermark?

from watermark.

jamesmyatt avatar jamesmyatt commented on July 23, 2024

Started work on this here: https://github.com/jamesmyatt/watermark/tree/v2-pre

I also noticed that some of the methods already use the Python 3 print function without importing from future:

print('{:<10} {}'.format(val.__name__, val.__version__))

from watermark.

rasbt avatar rasbt commented on July 23, 2024

Good point. That's a contributed function, personally, I don't use format, just didn't think about it when I merged it. But wouldn't it also still work in Python 2.7?

from watermark.

jamesmyatt avatar jamesmyatt commented on July 23, 2024

I think that str.format was backported from Python 3.0 to Python 2.6

from watermark.

rasbt avatar rasbt commented on July 23, 2024

Should be addressed now via #54 (using pkg_resources)

from watermark.

jamesmyatt avatar jamesmyatt commented on July 23, 2024

Thanks for doing this 👍
I've been on parental leave, so I've only just noticed 😆

from watermark.

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.