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

Allow setup.py --version to run without Cython, numpy #7

Merged
merged 2 commits into from
Apr 16, 2020
Merged

Conversation

taldcroft
Copy link
Member

@taldcroft taldcroft commented Apr 12, 2020

Description

This addresses the problem in sot/skare3#255.

See sot/chandra_time#40 for more details of functional testing (environment setup and commands).

Testing

  • Passes unit tests on MacOS
  • Functional testing
    • setup.py --version gives expected output in a minimal env (no Cython, no numpy)
    • setup.py build_ext --inplace fails in the minimal env with an import error
    • setup.py test builds and passes in a ska3 env

@javierggt
Copy link
Contributor

javierggt commented Apr 15, 2020

To expand on my comment:

  • The current setup requires that we have cython in the conda build environment just to get versions. If not, we get an error.
  • The setup after this PR would require any user to have cython in their environment at the moment this is installed. If not, there will be no warning and you get a crippled package.

Of the two, I prefer the first one. It is limited to us and there is no silent unintended consequence. It is not hard to include cython in our build environment.

Is there no other way around?

@taldcroft
Copy link
Member Author

@javierggt - good catch. The only thing I can think of is special-casing --version by checking sys.argv[1] for that string. There are a bunch of other informational commands and this gets ugly catching them all, but we can at least remove the need for cython in the ska_builder.py environment with the one check.

@javierggt
Copy link
Contributor

javierggt commented Apr 16, 2020

Something like checking the --version argument could be. Ugly but I think would work.

@taldcroft
Copy link
Member Author

@javierggt - I changed the logic here and in chandra.time, please have a look.

@javierggt
Copy link
Contributor

It seems fine to me

include_dirs=[np.get_include()])
except ImportError:
cythonize = lambda arg: None
fastss_ext = None

Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't something like this then silently not install the extension if you install within an environment that does not have cython?

@taldcroft taldcroft merged commit ff4299a into master Apr 16, 2020
@taldcroft taldcroft deleted the cython branch April 16, 2020 17:08
@javierggt javierggt mentioned this pull request Dec 7, 2020
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.

2 participants