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

Fix package imports from setup file. #513

Closed
wants to merge 3 commits into from

Conversation

mdickinson
Copy link
Member

Fixes #478.

@@ -134,11 +141,6 @@ def check_python_version():
)

def additional_commands():
# Pygments 2 isn't supported on Python 3 versions earlier than 3.3, so
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have a python version check (check_python_version) that excludes these versions of Python, so this check is redundant.

@codecov-io
Copy link

codecov-io commented Aug 21, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@8515bbc). Click here to learn what that means.
The diff coverage is 50%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #513   +/-   ##
=========================================
  Coverage          ?   65.25%           
=========================================
  Files             ?       44           
  Lines             ?     7058           
  Branches          ?     1415           
=========================================
  Hits              ?     4606           
  Misses            ?     2027           
  Partials          ?      425
Impacted Files Coverage Δ
traits/__init__.py 75% <50%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8515bbc...d669e8e. Read the comment docs.

@@ -178,7 +180,7 @@ def additional_commands():
description='explicitly typed attributes for Python',
long_description=open('README.rst').read(),
download_url='https://github.com/enthought/traits',
install_requires=__requires__,
install_requires=["six"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given this change, do you want to remove the duplication in traits.__init__?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly. That's an actual package change rather than just an infrastructure change, so it has the potential to break code. It's probably safe to assume that no-one is doing from traits import __requires__, but it's hard to be sure.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed it.

@@ -124,8 +132,7 @@ def check_python_version():

if __name__ == "__main__":
check_python_version()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason why we don't simply use the python_requires kwarg? See https://setuptools.readthedocs.io/en/latest/setuptools.html#new-and-changed-setup-keywords

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None that I know of, but this is unrelated to this PR, which is focused on making the minimal changes necessary to avoid package imports. Please could you open an issue (or a PR)?

@@ -58,6 +59,10 @@ def _minimal_ext_cmd(cmd):


def write_version_py(filename='traits/_version.py'):
"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible nit-picky comment - the function is write_version_py but now it's being used to get the full version info, with the side-effect of also writing the version file.

It might be cleaner and more readable to split this up into a get_version, which uses write_version_py in the absence of a traits/_version.py file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's a mess that needs to be rewritten. I didn't really want to do that in this PR - this was supposed to be a quick fix for an actual bug. I'll take a look.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just been trying to do a minimal refactor, but there's no such thing: as soon as I try to refactor, things get messy. I'm going to leave this as it is for this PR and delegate reworking the version machinery to a separate PR.

@mdickinson
Copy link
Member Author

Closing this in favour of the more extensive changes in #515.

@mdickinson mdickinson closed this Aug 22, 2019
@mdickinson mdickinson deleted the fix/dont-import-from-setup branch August 22, 2019 16:10
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

Successfully merging this pull request may close these issues.

setup.py attempts to import from traits._version
3 participants