From d8fc4ea9d39e4f7da608a9a548c46d87c385e7a0 Mon Sep 17 00:00:00 2001 From: Chris Stanford Date: Thu, 16 Mar 2023 14:39:20 -0400 Subject: [PATCH 1/6] Updated manual method for installation to help with some errors I encountered while going through it --- docs/installation.md | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/docs/installation.md b/docs/installation.md index 68bd3eb61..cecac06c4 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. 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. From fd84b9eb31eb60bd643ca6ba7293bcc6bd3c229f Mon Sep 17 00:00:00 2001 From: Chris Stanford Date: Thu, 16 Mar 2023 16:08:07 -0400 Subject: [PATCH 2/6] Added a testing guide to the installation readme --- docs/installation.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/installation.md b/docs/installation.md index cecac06c4..ee2e28dad 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -49,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 From 3d0ad32e3adcf8f6172b3eefc07ae20c61fcf487 Mon Sep 17 00:00:00 2001 From: Chris Stanford Date: Thu, 16 Mar 2023 18:05:09 -0400 Subject: [PATCH 3/6] future proofing numpy bool type --- typed_python/types_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typed_python/types_test.py b/typed_python/types_test.py index 721c62b86..02f7940b1 100644 --- a/typed_python/types_test.py +++ b/typed_python/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), From 0245c9cb04fd0dd9ae66859d56cf89583314b430 Mon Sep 17 00:00:00 2001 From: Chris Stanford Date: Thu, 16 Mar 2023 20:14:27 -0400 Subject: [PATCH 4/6] added pytest.ini to suppress warning in operator_is_compilation_test and allow for future warning suppression --- pytest.ini | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 pytest.ini 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.* From 0aec46cba20e73e8554c6ca80475abbdec3ac243 Mon Sep 17 00:00:00 2001 From: Chris Stanford Date: Thu, 16 Mar 2023 22:38:34 -0400 Subject: [PATCH 5/6] installation suggestion --- docs/installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/installation.md b/docs/installation.md index ee2e28dad..dbca66487 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -10,7 +10,7 @@ There are several methods for building and setting up a development environment. * Install using Pipenv (which reads from the Pipfile). 3. Build nativepython libraries using `python setup.py build` 4. Install typed_python in the site-packages directory using `python setup.py install` -5. Move out of the typed_python root directory, as the source files can interfere with the installed package. +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. From 382e30e49437bad36db3a4312be8e64b5e600720 Mon Sep 17 00:00:00 2001 From: Chris Stanford Date: Fri, 17 Mar 2023 13:44:30 -0400 Subject: [PATCH 6/6] moved all tests to their own directory --- setup.py | 3 +++ typed_python/compiler/{ => tests}/compiler_cache_test.py | 0 typed_python/compiler/{ => tests}/llvm_compiler_test.py | 0 typed_python/compiler/{ => tests}/merge_type_wrappers_test.py | 0 typed_python/compiler/{ => tests}/native_ast_to_llvm_test.py | 0 typed_python/compiler/{ => tests}/python_ast_analysis_test.py | 0 typed_python/{ => tests}/Codebase_test.py | 0 typed_python/{ => tests}/class_types_test.py | 0 typed_python/{ => tests}/deep_bytecount_test.py | 0 typed_python/{ => tests}/deepcopy_test.py | 0 typed_python/{ => tests}/forward_types_test.py | 0 typed_python/{ => tests}/function_signature_test.py | 0 typed_python/{ => tests}/function_types_test.py | 0 typed_python/{ => tests}/macro_test.py | 0 typed_python/{ => tests}/module_representation_test.py | 0 typed_python/{ => tests}/module_test.py | 0 typed_python/{ => tests}/python_ast_test.py | 0 typed_python/{ => tests}/type_function_test.py | 0 typed_python/{ => tests}/type_identity_test.py | 0 typed_python/{ => tests}/typed_queue_test.py | 0 typed_python/{ => tests}/types_metadata_test.py | 0 typed_python/{ => tests}/types_named_tuple_test.py | 0 typed_python/{ => tests}/types_serialization_format_test.py | 0 typed_python/{ => tests}/types_serialization_test.py | 0 typed_python/{ => tests}/types_test.py | 0 25 files changed, 3 insertions(+) rename typed_python/compiler/{ => tests}/compiler_cache_test.py (100%) rename typed_python/compiler/{ => tests}/llvm_compiler_test.py (100%) rename typed_python/compiler/{ => tests}/merge_type_wrappers_test.py (100%) rename typed_python/compiler/{ => tests}/native_ast_to_llvm_test.py (100%) rename typed_python/compiler/{ => tests}/python_ast_analysis_test.py (100%) rename typed_python/{ => tests}/Codebase_test.py (100%) rename typed_python/{ => tests}/class_types_test.py (100%) rename typed_python/{ => tests}/deep_bytecount_test.py (100%) rename typed_python/{ => tests}/deepcopy_test.py (100%) rename typed_python/{ => tests}/forward_types_test.py (100%) rename typed_python/{ => tests}/function_signature_test.py (100%) rename typed_python/{ => tests}/function_types_test.py (100%) rename typed_python/{ => tests}/macro_test.py (100%) rename typed_python/{ => tests}/module_representation_test.py (100%) rename typed_python/{ => tests}/module_test.py (100%) rename typed_python/{ => tests}/python_ast_test.py (100%) rename typed_python/{ => tests}/type_function_test.py (100%) rename typed_python/{ => tests}/type_identity_test.py (100%) rename typed_python/{ => tests}/typed_queue_test.py (100%) rename typed_python/{ => tests}/types_metadata_test.py (100%) rename typed_python/{ => tests}/types_named_tuple_test.py (100%) rename typed_python/{ => tests}/types_serialization_format_test.py (100%) rename typed_python/{ => tests}/types_serialization_test.py (100%) rename typed_python/{ => tests}/types_test.py (100%) 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 100% rename from typed_python/types_test.py rename to typed_python/tests/types_test.py