From c187ae4c8a37ba04d7e065d4678fbef41f1cb475 Mon Sep 17 00:00:00 2001 From: Jared Date: Fri, 7 May 2021 09:15:48 -0400 Subject: [PATCH] fix data package issue for pypi; remove old readme. (#78) * add sas2nb for binder and SO question * bump version 2.4.4 after merge * add iris.sas test file * change github workflow to not upload wheel. * workaround binder wheel install issue. * fix data packaging for pypi * bump version --- README.rst | 91 ------------------------------------------- sas_kernel/Readme.md | 85 ---------------------------------------- sas_kernel/version.py | 2 +- setup.cfg | 12 +++--- setup.py | 22 +++++------ 5 files changed, 17 insertions(+), 195 deletions(-) delete mode 100644 README.rst delete mode 100644 sas_kernel/Readme.md diff --git a/README.rst b/README.rst deleted file mode 100644 index d8d4a96..0000000 --- a/README.rst +++ /dev/null @@ -1,91 +0,0 @@ -SAS Kernel for Jupyter -====================== - -What is this? -------------- - -A SAS Kernel for `Jupyter Notebooks`_ - -Dependencies ------------- - -- Python3.X -- Jupyter -- SAS 9.4 or higher – This includes `SAS Viya`_ -- Linux OS - -With the latest changes in `saspy`_ it is no longer a requirement that -Jupyter and SAS be installed on the same machine. SAS and Jupyter can -now communicate via passwordless ssh. This is in response to `issue -11`_. The configuration details are located in `sascfg.py`_ - -Documentation -------------- - -Here is the link to the current documentation -https://sassoftware.github.io/sas\_kernel/ - -Install -------- - -To successfully use the SAS Kernel you must have each of the following: -\* `SAS version 9.4 or above`_ \* `Jupyter`_ \* Jupyter has a number of -dependencies. See the subsections for steps on installing Jupyter on -your system. \* `Python 3`_ - -Install for Anaconda Python (assuming SAS already installed) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -1. `Download`_ and install Anaconda Python (make sure you get - Python3.X). If you install Anaconda without super user rights (root - or sudo) then other users on the system will not be able to access - the SAS kernel. A couple notes that I’ve observed: - -- The default install location is the users home directory. This is - fine for a single user install I would put it in a common location - (``/opt``) if you’re doing a system wide install -- One of the prompts is to add the path to your environment. I - recommend you want to answer ‘yes’ to that question so that all the - installing user has the executables in their path. If you’re doing a - system wide install (root or sudo) all the other users should add - that path to their environmental variables - -1. Install sas\_kernel. The sas\_kernel has a dependency on saspy which - is located `here`_. In the command below I’m assuming that ``pip`` - maps to python3 if that is not the case the you might need to use - ``pip3`` instead. ``pip install sas_kernel`` - -2. Verify that the sas\_kernel is installed ``jupyter kernelspec list`` - - If you installed as a superuser, your output should similar to this: - - :: - - Available kernels: - python3 /opt/Anaconda3-2.5.0/lib/python3.5/site-packages/ipykernel/resources - sas /usr/local/share/jupyter/kernels/sas - - If you installed as a regular user (sas in this case), your output - should similar to this: - - :: - - Available kernels: - python3 /home/sas/anaconda3/lib/python3.5/site-packages/ipykernel/resources - sas /home/sas/.local/share/jupyter/kernels/sas - -3. Verify SAS Executable is correct - - 1. find the sascfg.py file – it is currently located in the install - location (see above) \`[install location]/site- - -.. _Jupyter Notebooks: http://www.jupyter.org -.. _SAS Viya: http://www.sas.com/en_us/software/viya.html -.. _saspy: https://github.com/sassoftware/saspy -.. _issue 11: https://github.com/sassoftware/sas_kernel/issues/11 -.. _sascfg.py: https://github.com/sassoftware/saspy/blob/master/saspy/sascfg.py -.. _SAS version 9.4 or above: http://www.sas.com -.. _Jupyter: http://jupyter.org -.. _Python 3: http://www.python.org -.. _Download: https://www.continuum.io/downloads -.. _here: https://github.com/sassoftware/saspy \ No newline at end of file diff --git a/sas_kernel/Readme.md b/sas_kernel/Readme.md deleted file mode 100644 index f0650c6..0000000 --- a/sas_kernel/Readme.md +++ /dev/null @@ -1,85 +0,0 @@ -# Project Metis -#### What does Metis mean? -Metis is the moon cloest to Jupiter. It was an internal codename that stuck. - -## What is this? - -A SAS Kernel for [Jupyter Notebooks](http://www.jupyter.org) - -It relies on Python3.X - -and integrates or extends the following items: - -* Jupyter notebook components -* JupyterHub for multiuser servers -* Jupyter kernel for SAS -* Codemirror mode for SAS -* Theme for SAS -* SAS Extension to show the SAS Log -* NBgrader for academic use of Juypter - -## Architecture -![](sasKernel.png) -* Jupyter notebook is a framework that allows users to submit code to a computational engine (Kernel) and display results inline -* The SAS Kernel is a few hundred lines of python code that facilitates communication between the Jupyter notebook and SAS -* SAS communicates with the SAS Kernel through stdin, stdout, and stderr using the ODS HTML5 engine -* The SAS Kernel has no use without access to SAS - -## Install -To successfully use the SAS Kernel you must have each of the following: -* [SAS version 9.4 or above](http://www.sas.com) -* [Jupyter](http://jupyter.org) - - * Jupyter has a number of dependencies. The quickest path to get up and running, in my opinion, is to use [Anaconda Python](http://docs.continuum.io/anaconda/index) -* [Python 3](http://www.python.org) - -## Improving Usability -There are a few NBExtensions that have been created to make working with Juypter notebooks more productive. These are largely the result of pain points from my use of SAS Kernel for programming tasks. The extensions can be found [here](). The list includes: -* SAS Log -- which show the SAS log for the last executed cell or the entire log since the last (re)start of the notebook -* SAS Explore -- which gives a list of the assigned libraries (LIBNAMES) and the DATA Sets (MEMNAME) within them. -* SAS Tasks -- - -## Jupyterhub - -## NBGrader - - -## FAQ -* Is there a SAS Magic that I can access from a python kernel? - - Yes! There are actually several cell magics available from SAS. - They are `%%SAS`, `%%IML`, `%%SQL` (which uses SAS SQL), and `%%OPTMODEL`. To load these magics in your notebook, execute the following command `%load_ext sas_magic`. You can check that the magics have are successfully activated by looking at the results of `%lsmagic` and looking in the cell magic section. - If you use multiple SAS Cell magics in the *same* notebook they will share a SAS session (have the same WORK libname and MACROS). There is currently no sharing of SAS Sessions between different notebooks. - -* Do I need to buy SAS to use this kernel? - - The SAS Kernel is simply a gateway for Jupyter notebooks to talk to SAS, as such, if SAS is not installed this kernel won't be that helpful. For information on purchasing SAS [click here](http://www.sas.com/en_us/software/how-to-buy.html) - -* How does Jupyter communicate with SAS? - - Behind a Jupyter notebook is a python session, that python session submits code to SAS and receives responses through socket i/o (leveraging stdin , stdout, and stderr) which has been supported in SAS for a long time - -* If stdin, stdout, and stderr have been supported for so long why do I need to have SAS 9.4 or newer? - - First, SAS 9.4 was released in July 2013 so it isn't exactly a bleeding edge requirement. The reason for a prerequisite for SAS 9.4 is because that was the first release that supported the creation of HTML5 documents and that is the returned output so that we can render attractive tables and graphs automagically - -* How can I see my SAS log, I only see the listing output? - - SAS is different from many other programming languages in that it has two useful information streams, the log (which details the technical details of what happened and how long it took) and the lst (which includes the tables and graphics from the analysis). The SAS Kernel attempts to show you I *think* you want. Here are the rules: - -LOG Has Errors|LST|DISPLAYED| NOTES ---- | --- |--- | --- -No | No | LOG | This happens when you run DATA Step or a PROC with the `noprint` option -No | Yes |LST | -Yes| Yes | LST & LOG| ERROR messages with context from the log, then the listing output -Yes| No | LOG| - - If you want to see the log but it was not displayed you can use [SASLog NBExtension]() which will show the log for the last executed cell or the entire log since the last (re)start of the notebook - -* Will this leave a bunch of SAS sessions hanging around? - - A SAS session is started for each notebook you have open i.e. 5 notebooks open = 5 SAS sessions. Those sessions will remain active for the life of the notebook. If you shutdown your notebook, the SAS session will also terminate. In Jupyterhub, there are configuration options to shutdown inactive sessions and the SAS kernel complies with those directives. - -* I restarted my SAS Kernel and now my WORK library is now empty. What happened? - - When you restart the kernel in a notebook you are terminating the current SAS session and starting a new one. All of the temporary artifacts, datasets in the WORK library, assigned libnames, filename, WORK macros, and so on are destroyed. diff --git a/sas_kernel/version.py b/sas_kernel/version.py index b49bca3..ef86fc4 100644 --- a/sas_kernel/version.py +++ b/sas_kernel/version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = '2.4.7' +__version__ = '2.4.9' diff --git a/setup.cfg b/setup.cfg index 3250fba..15fa259 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,10 +1,10 @@ [metadata] description = A SAS kernel for Jupyter -# description_file = file: README.md -long_description = README.md +long_description = file: Readme.md +long_description_content_type = text/markdown author = Jared Dean license = Apache Software License -license_file = LICENSE.txt +license_files = LICENSE.txt author_email =jared.dean@sas.com url = https://github.com/sassoftware/sas_kernel @@ -17,6 +17,7 @@ classifiers = Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 Intended Audience :: Science/Research Intended Audience :: Developers Operating System :: OS Independent @@ -35,12 +36,9 @@ setup_requires = jupyter_client >= 6 ipython >= 7 -# include_package_data = True - [options.extras_require] jlab_ext = jupyterlab >=3 jlab_create_sas_file + sas2nb # sas_log_viewer_v2 - # sas2nb - diff --git a/setup.py b/setup.py index 4c6d15a..ac0a2a3 100644 --- a/setup.py +++ b/setup.py @@ -14,18 +14,19 @@ # See the License for the specific language governing permissions and # limitations under the License. # - +try: + from setuptools import setup, find_packages +except ImportError: + from distutils.core import setup, find_packages from distutils.command.install import install -import sys -import os -from setuptools import setup, find_packages -exec(open('./sas_kernel/version.py').read()) -print("Installing sas_kernel version:{}".format(__version__)) +import os +import sys +from sas_kernel.version import __version__ -SVEM_FLAG = '--single-version-externally-managed' -if SVEM_FLAG in sys.argv: - sys.argv.remove(SVEM_FLAG) +svem_flag = '--single-version-externally-managed' +if svem_flag in sys.argv: + sys.argv.remove(svem_flag) class InstallWithKernelspec(install): @@ -38,10 +39,9 @@ def run(self): # If the NO_KERNEL_INSTALL env variable is set then skip the kernel installation. return else: - import sas_kernel.install as kernel_install + from sas_kernel import install as kernel_install kernel_install.main(argv=sys.argv) - setup(name='SAS_kernel', version=__version__, packages=find_packages(),