diff --git a/docs/installation.md b/docs/installation.md index 68bd3eb61..dbca66487 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -4,12 +4,13 @@ There are several methods for building and setting up a development environment. ### Manual Method ### -1. Create a new virtualenv with Python 3.6 (`virtualenv --python= venv`) and source it +1. Create a new virtualenv with Python 3.6 (`virtualenv --python= venv`) and source it. 2. Install requirements via pip. For the moment there are two options: - * Install with plain pip using the `requirements` - * Install using Pipenv (which reads from the Pipfile) + * Install with plain pip using `pip install -r requirements.txt` + * Install using Pipenv (which reads from the Pipfile). 3. Build nativepython libraries using `python setup.py build` -4. Append the root of this repository to your `PYTHONPATH` +4. Install typed_python in the site-packages directory using `python setup.py install` +5. You might need to move out of the typed_python root directory, as the source files can interfere with the installed package. ### Pipenv Method ### This method is simple, and can take care of virtual environment creation and installation for you. @@ -21,12 +22,10 @@ The included Makefile in this repository contains recipes for building, installi You can also customize the name and location of any built virtual environments with the `VIRTUAL_ENV` variable. - -## Installation ## +## Prerequisites ## ### OSX ### -#### Prerequisites #### * Python 3.6 (recommended installed with homebrew) * Currently build is tested against `clang`, not `gcc`. For more information about installing `clang` and configuring your environment see [here](https://embeddedartistry.com/blog/2017/2/20/installing-clangllvm-on-osx) * It is recommended you use Pipenv ([see this link](https://pipenv.readthedocs.io/en/latest/install/#installing-pipenv)) to manage the application. @@ -34,12 +33,9 @@ You can also customize the name and location of any built virtual environments w * install Redis (`brew install redis`) - - ### Linux ### (These instructions are only for Ubuntu for the moment) -#### Prerequisites #### Before building the modules in this repository, you will need to make sure that you have the following: * Python 3.6 with header files (`python3.6-dev python3.6-dbg`) Note that for development you will also install the debug interpreter. @@ -53,3 +49,15 @@ Before building the modules in this repository, you will need to make sure that ``` * Pipenv ([see this link](https://pipenv.readthedocs.io/en/latest/install/#installing-pipenv)) * Redis Server (`redis-server`) + +## Testing ## + +### Manual Method ### + +1. Install the following additional packages: `pip install scipy pytest flaky` +2. Navigate to the build directory `cd build` +3. Run `pytest` + +### Automatic Method ### + +1. Run the included `install_and_test.sh` script, which will create a temporary virtual environment and run the tests within it. \ No newline at end of file diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 000000000..40261d98f --- /dev/null +++ b/pytest.ini @@ -0,0 +1,3 @@ +[pytest] +filterwarnings = + ignore:.*\"is\" with a literal.*:SyntaxWarning:.*operator_is_compilation_test.* diff --git a/setup.py b/setup.py index d6429059c..0cd7a3b7d 100644 --- a/setup.py +++ b/setup.py @@ -68,6 +68,9 @@ def run(self): author_email='braxton.mckee@gmail.com', url='https://github.com/aprioriinvestments/typed_python', packages=setuptools.find_packages(), + package_data={ + 'typed_python': ['tests/*'] + }, cmdclass={'build_ext': TypedPythonBuildExtension}, ext_modules=ext_modules, install_requires=INSTALL_REQUIRES, diff --git a/typed_python/compiler/compiler_cache_test.py b/typed_python/compiler/tests/compiler_cache_test.py similarity index 100% rename from typed_python/compiler/compiler_cache_test.py rename to typed_python/compiler/tests/compiler_cache_test.py diff --git a/typed_python/compiler/llvm_compiler_test.py b/typed_python/compiler/tests/llvm_compiler_test.py similarity index 100% rename from typed_python/compiler/llvm_compiler_test.py rename to typed_python/compiler/tests/llvm_compiler_test.py diff --git a/typed_python/compiler/merge_type_wrappers_test.py b/typed_python/compiler/tests/merge_type_wrappers_test.py similarity index 100% rename from typed_python/compiler/merge_type_wrappers_test.py rename to typed_python/compiler/tests/merge_type_wrappers_test.py diff --git a/typed_python/compiler/native_ast_to_llvm_test.py b/typed_python/compiler/tests/native_ast_to_llvm_test.py similarity index 100% rename from typed_python/compiler/native_ast_to_llvm_test.py rename to typed_python/compiler/tests/native_ast_to_llvm_test.py diff --git a/typed_python/compiler/python_ast_analysis_test.py b/typed_python/compiler/tests/python_ast_analysis_test.py similarity index 100% rename from typed_python/compiler/python_ast_analysis_test.py rename to typed_python/compiler/tests/python_ast_analysis_test.py diff --git a/typed_python/Codebase_test.py b/typed_python/tests/Codebase_test.py similarity index 100% rename from typed_python/Codebase_test.py rename to typed_python/tests/Codebase_test.py diff --git a/typed_python/class_types_test.py b/typed_python/tests/class_types_test.py similarity index 100% rename from typed_python/class_types_test.py rename to typed_python/tests/class_types_test.py diff --git a/typed_python/deep_bytecount_test.py b/typed_python/tests/deep_bytecount_test.py similarity index 100% rename from typed_python/deep_bytecount_test.py rename to typed_python/tests/deep_bytecount_test.py diff --git a/typed_python/deepcopy_test.py b/typed_python/tests/deepcopy_test.py similarity index 100% rename from typed_python/deepcopy_test.py rename to typed_python/tests/deepcopy_test.py diff --git a/typed_python/forward_types_test.py b/typed_python/tests/forward_types_test.py similarity index 100% rename from typed_python/forward_types_test.py rename to typed_python/tests/forward_types_test.py diff --git a/typed_python/function_signature_test.py b/typed_python/tests/function_signature_test.py similarity index 100% rename from typed_python/function_signature_test.py rename to typed_python/tests/function_signature_test.py diff --git a/typed_python/function_types_test.py b/typed_python/tests/function_types_test.py similarity index 100% rename from typed_python/function_types_test.py rename to typed_python/tests/function_types_test.py diff --git a/typed_python/macro_test.py b/typed_python/tests/macro_test.py similarity index 100% rename from typed_python/macro_test.py rename to typed_python/tests/macro_test.py diff --git a/typed_python/module_representation_test.py b/typed_python/tests/module_representation_test.py similarity index 100% rename from typed_python/module_representation_test.py rename to typed_python/tests/module_representation_test.py diff --git a/typed_python/module_test.py b/typed_python/tests/module_test.py similarity index 100% rename from typed_python/module_test.py rename to typed_python/tests/module_test.py diff --git a/typed_python/python_ast_test.py b/typed_python/tests/python_ast_test.py similarity index 100% rename from typed_python/python_ast_test.py rename to typed_python/tests/python_ast_test.py diff --git a/typed_python/type_function_test.py b/typed_python/tests/type_function_test.py similarity index 100% rename from typed_python/type_function_test.py rename to typed_python/tests/type_function_test.py diff --git a/typed_python/type_identity_test.py b/typed_python/tests/type_identity_test.py similarity index 100% rename from typed_python/type_identity_test.py rename to typed_python/tests/type_identity_test.py diff --git a/typed_python/typed_queue_test.py b/typed_python/tests/typed_queue_test.py similarity index 100% rename from typed_python/typed_queue_test.py rename to typed_python/tests/typed_queue_test.py diff --git a/typed_python/types_metadata_test.py b/typed_python/tests/types_metadata_test.py similarity index 100% rename from typed_python/types_metadata_test.py rename to typed_python/tests/types_metadata_test.py diff --git a/typed_python/types_named_tuple_test.py b/typed_python/tests/types_named_tuple_test.py similarity index 100% rename from typed_python/types_named_tuple_test.py rename to typed_python/tests/types_named_tuple_test.py diff --git a/typed_python/types_serialization_format_test.py b/typed_python/tests/types_serialization_format_test.py similarity index 100% rename from typed_python/types_serialization_format_test.py rename to typed_python/tests/types_serialization_format_test.py diff --git a/typed_python/types_serialization_test.py b/typed_python/tests/types_serialization_test.py similarity index 100% rename from typed_python/types_serialization_test.py rename to typed_python/tests/types_serialization_test.py diff --git a/typed_python/types_test.py b/typed_python/tests/types_test.py similarity index 99% rename from typed_python/types_test.py rename to typed_python/tests/types_test.py index 721c62b86..02f7940b1 100644 --- a/typed_python/types_test.py +++ b/typed_python/tests/types_test.py @@ -2021,7 +2021,7 @@ def test_can_convert_numpy_scalars(self): def test_other_bitness_types(self): # verify we can cast around non-64-bit values in a way that matches numpy typeAndNumpyType = [ - (bool, numpy.bool), + (bool, numpy.bool_), (Int8, numpy.int8), (Int16, numpy.int16), (Int32, numpy.int32),