Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
16d79ebb
Commit
16d79ebb
authored
Mar 24, 2018
by
gabrieldemarmiesse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added argument list for pyximport.
parent
cb440212
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
4 deletions
+49
-4
docs/src/quickstart/build.rst
docs/src/quickstart/build.rst
+1
-1
docs/src/tutorial/cython_tutorial.rst
docs/src/tutorial/cython_tutorial.rst
+2
-2
docs/src/tutorial/profiling_tutorial.rst
docs/src/tutorial/profiling_tutorial.rst
+1
-1
docs/src/userguide/source_files_and_compilation.rst
docs/src/userguide/source_files_and_compilation.rst
+45
-0
No files found.
docs/src/quickstart/build.rst
View file @
16d79ebb
...
@@ -18,7 +18,7 @@ one may want to read more about
...
@@ -18,7 +18,7 @@ one may want to read more about
There are several ways to build Cython code:
There are several ways to build Cython code:
- Write a distutils/setuptools ``setup.py``. This is the normal and recommended way.
- Write a distutils/setuptools ``setup.py``. This is the normal and recommended way.
- Use
``pyximport`
`, importing Cython ``.pyx`` files as if they
- Use
:ref:`Pyximport<pyximport>
`, importing Cython ``.pyx`` files as if they
were ``.py`` files (using distutils to compile and build in the background).
were ``.py`` files (using distutils to compile and build in the background).
This method is easier than writing a ``setup.py``, but is not very flexible.
This method is easier than writing a ``setup.py``, but is not very flexible.
So you'll need to write a ``setup.py`` if, for example, you need certain compilations options.
So you'll need to write a ``setup.py`` if, for example, you need certain compilations options.
...
...
docs/src/tutorial/cython_tutorial.rst
View file @
16d79ebb
...
@@ -77,7 +77,7 @@ It is shipped and installed with Cython and can be used like this::
...
@@ -77,7 +77,7 @@ It is shipped and installed with Cython and can be used like this::
>>> import helloworld
>>> import helloworld
Hello World
Hello World
Since Cython 0.11, the :
mod:`pyximport
` module also has experimental
Since Cython 0.11, the :
ref:`Pyximport<pyximport>
` module also has experimental
compilation support for normal Python modules. This allows you to
compilation support for normal Python modules. This allows you to
automatically run Cython on every .pyx and .py module that Python
automatically run Cython on every .pyx and .py module that Python
imports, including the standard library and installed packages.
imports, including the standard library and installed packages.
...
@@ -87,7 +87,7 @@ modules instead. The .py import mechanism is installed like this::
...
@@ -87,7 +87,7 @@ modules instead. The .py import mechanism is installed like this::
>>> pyximport.install(pyimport=True)
>>> pyximport.install(pyimport=True)
Note that it is not recommended to let :
mod:`pyximport
` build code
Note that it is not recommended to let :
ref:`Pyximport<pyximport>
` build code
on end user side as it hooks into their import system. The best way
on end user side as it hooks into their import system. The best way
to cater for end users is to provide pre-built binary packages in the
to cater for end users is to provide pre-built binary packages in the
`wheel <https://wheel.readthedocs.io/>`_ packaging format.
`wheel <https://wheel.readthedocs.io/>`_ packaging format.
...
...
docs/src/tutorial/profiling_tutorial.rst
View file @
16d79ebb
...
@@ -216,7 +216,7 @@ meaningful output from the cProfile module. The rest of the code is mostly
...
@@ -216,7 +216,7 @@ meaningful output from the cProfile module. The rest of the code is mostly
unchanged, I only typed some variables which will likely speed things up a bit.
unchanged, I only typed some variables which will likely speed things up a bit.
We also need to modify our profiling script to import the Cython module directly.
We also need to modify our profiling script to import the Cython module directly.
Here is the complete version adding the import of the
pyximport
module::
Here is the complete version adding the import of the
:ref:`Pyximport<pyximport>`
module::
#!/usr/bin/env python
#!/usr/bin/env python
# encoding: utf-8
# encoding: utf-8
...
...
docs/src/userguide/source_files_and_compilation.rst
View file @
16d79ebb
...
@@ -107,6 +107,51 @@ on end user side as it hooks into their import system. The best way
...
@@ -107,6 +107,51 @@ on end user side as it hooks into their import system. The best way
to cater for end users is to provide pre-built binary packages in the
to cater for end users is to provide pre-built binary packages in the
`wheel <https://wheel.readthedocs.io/>`_ packaging format.
`wheel <https://wheel.readthedocs.io/>`_ packaging format.
Arguments
---------
The function ``pyximport.install()`` can take several arguments to
influence the compilation of Cython or Python files.
.. function:: pyximport.install(pyximport=True, pyimport=False, build_dir=None, build_in_temp=True, setup_args=None, reload_support=False, load_py_module_on_import_failure=False, inplace=False, language_level=None)
:param pyximport: If set to False, does not try to import ``.pyx`` files.
:param pyimport: You can pass ``pyimport=True`` to also install the ``.py`` import hook
in your meta-path. Note, however, that it is highly experimental,
will not work for most ``.py`` files, and will therefore only slow
down your imports. Use at your own risk.
:param build_dir: By default, compiled modules will end up in a ``.pyxbld``
directory in the user's home directory. Passing a different path
as ``build_dir`` will override this.
:param build_in_temp: If ``False``, will produce the C files locally. Working
with complex dependencies and debugging becomes more easy. This
can principally interfere with existing files of the same name.
:param setup_args: Dict of arguments for Distribution. See ``distutils.core.setup()``.
:param reload_support: Enables support for dynamic
``reload(my_module)``, e.g. after a change in the Cython code.
Additional files ``<so_path>.reloadNN`` may arise on that account, when
the previously loaded module file cannot be overwritten.
:param load_py_module_on_import_failure: If the compilation of a ``.py``
file succeeds, but the subsequent import fails for some reason,
retry the import with the normal ``.py`` module instead of the
compiled module. Note that this may lead to unpredictable results
for modules that change the system state during their import, as
the second import will rerun these modifications in whatever state
the system was left after the import of the compiled module
failed.
:param inplace: Install the compiled module (``.so`` for Linux and Mac / ``.pyd`` for Windows) next to the source file.
:param language_level: The source language level to use: 2 or 3.
The default is to use the language level of the current Python
runtime for .py files and Py2 for ``.pyx`` files.
Dependency Handling
Dependency Handling
--------------------
--------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment