Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Incr. micro version number. New style importing hooks will follow soo…
…n (see DEVELOPERS.txt).
  • Loading branch information
pearu committed Oct 22, 2003
1 parent 6a1c757 commit 9073df1
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 43 deletions.
72 changes: 32 additions & 40 deletions DEVELOPERS.txt
Expand Up @@ -58,7 +58,8 @@ Currently Scipy consists of the following files and directories:


Lib_chaco/ Lib_chaco/
Contains packages related to Chaco. [Can we move these packages Contains packages related to Chaco. [Can we move these packages
under Lib/?] under Lib/? No need, new hooks in setup.py takes care of this; in
fact, we can introduce also contrib/ directory]


tutorial/ tutorial/
Scipy tutorial. Scipy tutorial.
Expand All @@ -84,29 +85,25 @@ follow the following conventions:
* Directory ``xxx/`` must contain * Directory ``xxx/`` must contain


+ a file ``setup_xxx.py`` that defines + a file ``setup_xxx.py`` that defines
``configuration(parent_package='')`` function. See ... for more ``configuration(parent_package='')`` function. See below for more
details. details.


+ a file ``info_xxx.py``. See .. more details. + a file ``info_xxx.py``. See below more details.


* Directory ``xxx/`` may contain * Directory ``xxx/`` may contain


+ a directory ``tests/`` that contains files ``test_<name>.py`` + a directory ``tests/`` that contains files ``test_<name>.py``
corresponding to modules ``xxx/<name>{.py,.so,/}``. See ... for corresponding to modules ``xxx/<name>{.py,.so,/}``. See below for
more details. more details.


+ a file ``MANIFEST.in``. + a file ``MANIFEST.in``.


+ a file ``pre___init__.py`` that should contain the documentation
string of the module, usually found in ``__init__.py`` file. See
... for more details.

[Open issues: where we should put documentation?] [Open issues: where we should put documentation?]


File xxx/setup_xxx.py File xxx/setup_xxx.py
--------------------- ---------------------


Each Scipy module setup_xxx.py file must contain a function Each Scipy module setup_xxx.py file should contain a function
``configuration(..)`` that returns a dictionary which must be usable ``configuration(..)`` that returns a dictionary which must be usable
as an argument to distutils setup function. as an argument to distutils setup function.


Expand All @@ -123,37 +120,30 @@ module xxx is::
from scipy_distutils.core import setup from scipy_distutils.core import setup
setup(**configuration()) setup(**configuration())



File xxx/__init__.py

---------------------
Files xxx/__init__.py and xxx/pre___init__.py
---------------------------------------------


To speed up the import time as well as to minimize memory usage, scipy To speed up the import time as well as to minimize memory usage, scipy
uses ppimport hooks to transparently postpone importing large modules uses ppimport hooks to transparently postpone importing large modules
that might not be used during a Scipy usage session. But in order to that might not be used during a Scipy usage session. But in order to
have an access to documentation of all Scipy modules, including of the have an access to documentation of all Scipy modules, including of the
postponed modules, the documentation string of a module (that would postponed modules, the documentation string of a module (that would
usually reside in __init__.py file) must be moved to pre___init__.py usually reside in __init__.py file) should be copied also
file. to info_xxx.py file.


So, the contents of a typical xxx/__init__.py file is:: So, the contents of a typical xxx/__init__.py file would be::


# #
# Module xxx - ... # Module xxx - ...
# #


from pre___init__ import __doc__ from info_xxx import __doc__
#from info_xxx import __doc__
... ...


[xxx/pre___init__.py functionality will be replaced with more general
hooks in xxx/info_xxx.py file]


File xxx/info_xxx.py File xxx/info_xxx.py
-------------------- --------------------


[info_xxx.py functionality is not implemented in Scipy yet.]

Scipy setup.py and Lib/__init__.py files assume that each Scipy module Scipy setup.py and Lib/__init__.py files assume that each Scipy module
contains a info_xxx.py file. The following information will be looked contains a info_xxx.py file. The following information will be looked
from this file: from this file:
Expand All @@ -170,28 +160,36 @@ standalone
as standalone or under scipy. Default value is False. as standalone or under scipy. Default value is False.


dependencies dependencies
[Support not implemented yet, may be it is YAGNI]
List of module names that the module depends on. The module will not List of module names that the module depends on. The module will not
be installed if any of the dependencies is missing. If the module be installed if any of the dependencies is missing. If the module
depends on another Scipy module, say yyy, and that is not going to depends on another Scipy module, say yyy, and that is not going to
be installed standalone, then use full name, that is, ``scipy.yyy`` be installed standalone, then use full name, that is, ``scipy.yyy``
instead of ``yyy``. instead of ``yyy``.


provides global_symbols
List of names that should be imported to scipy name space. List of names that should be imported to scipy name space.


ignore ignore
Boolean variable indicating that the module should be ignored or Boolean variable indicating that the module should be ignored or
not. Default value is False. Useful when the module is platform not. Default value is False. Useful when the module is platform
dependent. dependent.


postpone_import
Boolean variable indicating that importing module should be
postponed until first attempt of its usage. Default value is False.

File xxx/tests/test_yyy.py File xxx/tests/test_yyy.py
-------------------------- --------------------------


Ideally, each Python code, extension module, or a subpackage in ``xxx/`` Ideally, each Python code, extension module, or a subpackage in ``xxx/``
directory should have the corresponding ``test_<name>.py`` file in directory should have the corresponding ``test_<name>.py`` file in
``xxx/tests/`` directory. This file should define a function ``xxx/tests/`` directory. This file should define classes derived
``test_suite_list`` that must return a list of 2-tuples from ScipyTestCase class. Methods of such classes that names start
``(<ScipyTestCase class>, <method name pattern>)``. with ``bench_`` or ``check_`` or ``test_`` are passed on to unittest
machinery. These methods may have optional arguments, the default
value of the first argument defines the testing level number. Default
level is 1.


A minimal example of a ``test_yyy.py`` file that implements tests for A minimal example of a ``test_yyy.py`` file that implements tests for
a module ``xxx.yyy`` containing a function ``zzz()``, is shown below:: a module ``xxx.yyy`` containing a function ``zzz()``, is shown below::
Expand All @@ -205,25 +203,13 @@ a module ``xxx.yyy`` containing a function ``zzz()``, is shown below::
del sys.path[0] del sys.path[0]


class test_zzz(ScipyTestCase): class test_zzz(ScipyTestCase):
def check_simple(self): def check_simple(self, level=1):
assert zzz()=='Hello from zzz' assert zzz()=='Hello from zzz'
#... #...


# defining test_suite_list function is obligatory
def test_suite_list(level=1):
suite_list = []
if level > 0:
suite_list += [
(test_zzz,'check_'),
#...
]
if level > 5:
#...
return suite_list

if __name__ == "__main__": if __name__ == "__main__":
from scipy_test.testing import ScipyTest from scipy_test.testing import ScipyTest
ScipyTest('xxx.yyy').test(level=1,verbosity=2) ScipyTest('xxx.yyy').run()


``ScipyTestCase`` is derived from ``unittest.TestCase`` and it ``ScipyTestCase`` is derived from ``unittest.TestCase`` and it
implements additional method ``measure(self, code_str, times=1)``. implements additional method ``measure(self, code_str, times=1)``.
Expand All @@ -237,3 +223,9 @@ functions::
assert_array_equal(x,y,err_msg='') assert_array_equal(x,y,err_msg='')
assert_array_almost_equal(x,y,decimal=6,err_msg='') assert_array_almost_equal(x,y,decimal=6,err_msg='')
rand(*shape) # returns random array with a given shape rand(*shape) # returns random array with a given shape

``ScipyTest`` managed running ``tests/test_*.py`` scripts. When using
its ``.run()`` method then the level and verbosity parameters for
tests are taken from ``sys.argv`` and the method
``.test(level,verbosity)`` is called.

10 changes: 7 additions & 3 deletions Lib/scipy_version.py
@@ -1,12 +1,16 @@
major = 0 major = 0
minor = 2 minor = 2
micro = 0 micro = 1
#release_level = 'alpha' #release_level = 'alpha'
release_level='' release_level=''


from __cvs_version__ import cvs_version from __cvs_version__ import cvs_version
cvs_minor = cvs_version[-3] cvs_minor = cvs_version[-3]
cvs_serial = cvs_version[-1] cvs_serial = cvs_version[-1]


scipy_version = '%(major)d.%(minor)d.%(micro)d_%(release_level)s'\ if release_level:
'_%(cvs_minor)d.%(cvs_serial)d' % (locals ()) scipy_version = '%(major)d.%(minor)d.%(micro)d_%(release_level)s'\
'_%(cvs_minor)d.%(cvs_serial)d' % (locals ())
else:
scipy_version = '%(major)d.%(minor)d.%(micro)d'\
'_%(cvs_minor)d.%(cvs_serial)d' % (locals ())

0 comments on commit 9073df1

Please sign in to comment.