1

In my classic setup.py script, I have a post_install method that registers my python widget with a jupyter notebook. How do I do this using the pyproject.toml file? I can't seem to find any documentation on this.

doc: https://setuptools.pypa.io/en/latest/userguide/extension.html

I have these classes defined in my setup.py file that need to be run. Is there a way to replicate this in the new pyproject.toml system?

# Each of these classes represent the different modes that pip install
# can go into, and what logic can be run after pip install finishes
class develop(_develop):
    """Post-installation logic to run for development mode"""

    def run(self):
        self.execute(_post_install, (), msg="Running post-install...")
        super().run()


class install(_install):
    """Post-installation logic to run for installation mode"""

    def run(self):
        self.execute(_post_install, (), msg="Running post-install...")
        super().run()


class egg_info(_egg_info):
    """Post-installation logic to run for 'egg_info' mode"""

    def run(self):
        self.execute(_post_install, (), msg="Running post-install...")
        super().run()

In the setup.py here is the part that I need to call:

 "cmdclass": {
        "develop": develop,
        "install": install,
        "egg_info": egg_info,
    },
JabberJabber
  • 341
  • 2
  • 17
  • Not possible. When using current versions of *pip* and *wheels* and all the modern packaging tools there is no concept of "post install" step. -- Maybe we can still help you get to your actual goal which seems to be to register some widgets into a Jupyter notebook, if you create a new question with this framing. – sinoroc Apr 05 '23 at 17:40
  • I modified with what I am trying to replicate. – JabberJabber Apr 05 '23 at 17:50
  • Not possible. *pip* (and any other modern installer) always installs from a *wheel*. If there is no *wheel* available, *pip* builds a *wheel* from the *sdist*. And *wheels* do not contain any `setup.py`, at all. – sinoroc Apr 05 '23 at 18:09
  • what if I don't want to use a wheel? I would prefer an sdist. wheels are a pain to manage. – JabberJabber Apr 05 '23 at 18:25
  • I do not think you have a choice. This is the process. You could try [this](https://stackoverflow.com/a/58290113), but I do not know if it still works, and I really would not recommend it. -- You still have not clearly explained why you want to do a post-install step. Is that really necessary? What is the actual goal? Isn't there any other way to "register a widget into a Jupyter notebook"? – sinoroc Apr 05 '23 at 18:32

0 Answers0