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 Cython compiled check in ipython #573

Merged
merged 4 commits into from Jun 4, 2019
Merged

Conversation

dmontagu
Copy link
Contributor

@dmontagu dmontagu commented Jun 3, 2019

Addresses the issue raised in #548 related to running non-compiled in IPython

Addresses the issue raised in pydantic#548 related to running non-compiled in IPython
@dmontagu dmontagu mentioned this pull request Jun 3, 2019
5 tasks
@dmontagu
Copy link
Contributor Author

dmontagu commented Jun 3, 2019

@samuelcolvin Not sure why the build is failing. It says

2:58:53 PM: Running Sphinx v2.0.1
2:58:54 PM: Configuration error:
2:58:54 PM: There is a programmable error in your configuration file:
2:58:54 PM: Traceback (most recent call last):
2:58:54 PM:   File "/opt/buildhome/python3.6/lib/python3.6/site-packages/sphinx/config.py", line 361, in eval_config_file
2:58:54 PM:     execfile_(filename, namespace)
2:58:54 PM:   File "/opt/buildhome/python3.6/lib/python3.6/site-packages/sphinx/util/pycompat.py", line 86, in execfile_
2:58:54 PM:     exec(code, _globals)
2:58:54 PM:   File "/opt/build/repo/docs/conf.py", line 85, in <module>
2:58:54 PM:     from pydantic.version import VERSION
2:58:54 PM:   File "pydantic/__init__.py", line 2, in init pydantic.__init__
2:58:54 PM:   File "pydantic/dataclasses.py", line 8, in init pydantic.dataclasses
2:58:54 PM:   File "pydantic/main.py", line 68, in init pydantic.main
2:58:54 PM: NameError: name 'cython' is not defined

in the build logs (https://app.netlify.com/sites/pydantic-docs/deploys/5cf5977b10a4b80009431880), but I don't understand how the change I made could have introduced this error.

Also, the tests pass for me locally whether or not I have cython installed in the testing environment.

Copy link
Member

@samuelcolvin samuelcolvin left a comment

Choose a reason for hiding this comment

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

No idea why this fails, but it does. Both on travis and netlify.

wrap this in an AttributeError try/except and add pragma: no cover wherever required.

Please add an entry to history too.

@samuelcolvin samuelcolvin changed the title Update main.py Fix Cython compiled check in ipython Jun 4, 2019
@codecov
Copy link

codecov bot commented Jun 4, 2019

Codecov Report

Merging #573 into master will not change coverage.
The diff coverage is n/a.

@@          Coverage Diff          @@
##           master   #573   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          15     15           
  Lines        2508   2508           
  Branches      501    501           
=====================================
  Hits         2508   2508

@samuelcolvin samuelcolvin assigned samuelcolvin and unassigned dmontagu Jun 4, 2019
@samuelcolvin samuelcolvin merged commit 6d5c48e into pydantic:master Jun 4, 2019
anthrotype added a commit to fonttools/fonttools that referenced this pull request Mar 2, 2023
…nstalled

It's possible sometimes that 'import cython' does not fail but then 'cython.compiled' raises AttributeError.
It actually happened in our internal production environment...
So to check if cython library was actually installed we try to do `from cython import compiled`, which will raise ImportError if `compiled` variable is not present (it must be there for the 'real' cython, but sometimes a 'pretend' one sneaks in if sys.path has been messed with).

Similar issue to pydantic/pydantic#573 and ipython/ipython#13294
anthrotype added a commit to fonttools/fonttools that referenced this pull request Mar 2, 2023
…nstalled

It's possible sometimes that 'import cython' does not fail but then 'cython.compiled' raises AttributeError.
It actually happened in our internal production environment...

Similar issue to pydantic/pydantic#573 and ipython/ipython#13294
alexdrydew pushed a commit to alexdrydew/pydantic that referenced this pull request Dec 23, 2023
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.

None yet

2 participants