Importing modules into setup.py

Would it interfere in any way with the building of a distributable if I were to import additional modules into a “setup.py” file?

I’m contemplating adding a build-duration print-out to my setup-process, via importing and using “datetime” in my “setup.py” files. A quick experiment seems to indicate that it works–but I want to check that it doesn’t have some non-obvious untoward effect (such as interfering with module-freezing, or some such thing).

To be clear, what I have in mind is a “setup.py” that looks something like this:

from setuptools import setup

from datetime import datetime

now = datetime.now()

setup(
    # Options as usual here...
)

duration = datetime.now() - now
print ("\n\nBuild completed in:", duration)

As far as I know, you can put whatever you want in setup.py, as long as you actually call the setup() function. That’s one of the joys of it being a Python file.

Great! That’s very good to know. Thank you for the answer! :slight_smile: