Skip to content

Commit

Permalink
PyQ Release 4.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
pyq-enlnt committed Oct 12, 2017
1 parent 03b0582 commit 3af6a30
Show file tree
Hide file tree
Showing 23 changed files with 204 additions and 60 deletions.
2 changes: 1 addition & 1 deletion CHANGES.rst
2 changes: 1 addition & 1 deletion INSTALL.rst
2 changes: 1 addition & 1 deletion LICENSE.rst
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ data.
## Installation

```bash
pip install -i https://pypi.enlnt.com -U --no-binary pyq pyq
pip install pyq
```

For detailed installation instructions see [installation instructions][1].
Expand Down
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
try:
from pyq import __version__
except ImportError:
__version__ = '4.1.1'
__version__ = '4.1.2'


# If extensions (or modules to document with autodoc) are in another directory,
Expand Down
6 changes: 2 additions & 4 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ Quick start

.. code-block:: bash
$ pip install \
-i https://pyq.enlnt.com \
--no-binary pyq pyq
$ pip install pyq
First, make sure that PyQ is :ref:`installed <install>` and :ref:`up-to-date <update>`.
Start an interactive session::
Expand Down Expand Up @@ -71,7 +69,7 @@ Define a function in ``q``::

Call the ``q`` function from python and pretty-print the result::

>>> x = f('IBM', date(2006,10,6))
>>> x = q.f('IBM', date(2006,10,6))
>>> x.show()
date sym qty
------------------
Expand Down
2 changes: 1 addition & 1 deletion doc/install/centos32on64.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Install PyQ (note, PyQ 3.8.2 or newer required):

.. code-block:: bash
(pyq3) $ pip install -i https://pyq.enlnt.com --no-binary pyq pyq>=3.8.2
(pyq3) $ pip install pyq>=3.8.2
6. Use PyQ
Expand Down
10 changes: 6 additions & 4 deletions doc/install/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ To install the latest version, run the following command

::

$ pip install -i https://pyq.enlnt.com --no-binary pyq pyq
$ pip install pyq

.. _pre:

Expand Down Expand Up @@ -40,13 +40,13 @@ Use following pip command to install the latest version of PyQ into your environ

::

$ pip install -i https://pyq.enlnt.com --no-binary pyq pyq
$ pip install pyq

To install another version, specify which version you would like to install:

::

$ pip install -i https://pyq.enlnt.com --no-binary pyq pyq==3.8
$ pip install pyq==4.1.2


Installing from source code
Expand Down Expand Up @@ -112,7 +112,7 @@ Install PyQ:

::

$ pip install -i https://pyq.enlnt.com --no-binary pyq pyq
$ pip install pyq


.. _update:
Expand All @@ -124,3 +124,5 @@ Install PyQ:
.. include:: ubuntu.rst

.. include:: macos.rst

.. include:: windows.rst
4 changes: 2 additions & 2 deletions doc/install/macos.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Install kdb+ and PyQ:
.. code-block:: bash
(pyq2) $ unzip ${HOME}/Downloads/macosx.zip -d ${VIRTUAL_ENV}
(pyq2) $ pip install -i https://pyq.enlnt.com --no-binary pyq pyq
(pyq2) $ pip install pyq
PyQ is ready and can be launched:

Expand Down Expand Up @@ -72,7 +72,7 @@ using package manager `Homebrew <https://brew.sh/>`_.
.. code-block:: bash
(pyq) $ unzip ${HOME}/Downloads/macosx.zip -d ${VIRTUAL_ENV}
(pyq) $ pip install -i https://pyq.enlnt.com --no-binary pyq pyq
(pyq) $ pip install pyq
PyQ is ready and can be launched:

Expand Down
4 changes: 2 additions & 2 deletions doc/install/ubuntu.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Install PyQ:

.. code-block:: bash
(py2) $ pip install -i https://pyq.enlnt.com --no-binary pyq pyq
(py2) $ pip install pyq
Python 3
Expand All @@ -50,5 +50,5 @@ Install PyQ:

.. code-block:: bash
(py3) $ pip3 install -i https://pyq.enlnt.com --no-binary pyq pyq
(py3) $ pip3 install pyq
2 changes: 1 addition & 1 deletion doc/install/update.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ You can upgrade PyQ to the latest version by running:

::

pip install -i https://pyq.enlnt.com --no-binary pyq -U pyq
pip install -U pyq
100 changes: 100 additions & 0 deletions doc/install/windows.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
Experimental support for Windows
--------------------------------

PyQ 4.1.0 introduced experimental support for Windows.

Requirements are:

- Installation should be started using Windows Command Prompt.
- `Visual Studio 9 for Python`_, if using Python 2.7.x.
- `Microsoft Build Tools for Visual Studio 2017`_, if using Python 3.6.x
- Ensure kdb+ is installed under ``C:\q`` or the ``QHOME`` environment variable is set to the location of the kdb+ executable.

.. _Visual Studio 9 for Python: http://aka.ms/vcpython27
.. _Microsoft Build Tools for Visual Studio 2017: https://www.visualstudio.com/downloads/#build-tools-for-visual-studio-2017

Install PyQ:

.. code-block:: batch
pip install -U pyq
You can start PyQ by running

.. code-block:: text
c:\q\w32\q.exe python.q
.. note::

You will have to press ``^Z`` and then ``Enter`` key in order to get into Python REPL. This is known limitation of this version.

You can run tests too: first install required packages:

.. code-block:: batch
pip install pytest pytest-pyq
Then run:

.. code-block:: text
set QBIN=c:\q\w32\q.exe
%QBIN% python.q -mpytest --pyargs pyq < nul
You can follow latest updates on Windows support on `issue gh#1`_.

.. _issue gh#1: https://github.com/enlnt/pyq/issues/1



Installing Jupyter kernel
.........................


Since we have not ported the ``pyq`` executable to the Windows platform yet, setting up a working PyQ environment
on Windows requires several manual steps.

First, it is strongly recommended to use a dedicated Python virtual environment and install ``q`` in ``%VIRTUAL_ENV%``.
Assuming that you have downloaded ``windows.zip`` from `<https://kx.com/download/>`_ in your ``Downloads`` folder, enter the following commands:

.. code-block:: batch
python -mvenv py36
py36\Scripts\activate.bat
set QHOME=%VIRTUAL_ENV%\q
"C:\Program Files\7-Zip\7z.exe" x -y -o%VIRTUAL_ENV% %HOMEPATH%\Downloads\windows.zip
del %QHOME%\q.q
set PYTHONPATH=%VIRTUAL_ENV%\lib\site-packages
set QBIN=%QHOME%\w32\q.exe
Now you should be able to install jupyter, pyq and pyq-kernel in one command

.. code-block:: batch
pip install jupyter pyq pyq-kernel
Finally, to install pyq kernel specs, run

.. code-block:: batch
%QBIN% python.q -mpyq.kernel install
If everything is successful, you should see pyq_3 listed in the kernelspec list:

.. code-block:: text
>jupyter kernelspec list
Available kernels:
pyq_3 C:\Users\a\AppData\Roaming\jupyter\kernels\pyq_3
python3 c:\users\a\py36\share\jupyter\kernels\python3
Now, start the notebook server

.. code-block:: batch
jupyter-notebook
and select "PyQ 3" from the "New" menu.

For examples of what can be done in a PyQ notebook, please see `presentation <https://youtu.be/v2UoP0l6mOw>`_.
10 changes: 5 additions & 5 deletions doc/manual/pyq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,13 @@ k('0 1 3 6 10 15 21 28 36 45')

* - q
- Return
* - :func:`pyq.q.sums`
* - :func:`~pyq.q.sums`
- the cumulative sums of the elements
* - :func:`pyq.q.prds`
* - :func:`~pyq.q.prds`
- the cumulative products of the elements
* - :func:`pyq.q.maxs`
* - :func:`~pyq.q.maxs`
- the maximums of the prefixes of the argument
* - :func:`pyq.q.mins`
* - :func:`~pyq.q.mins`
- the minimums of the prefixes of the argument


Expand All @@ -329,7 +329,7 @@ functionality:

Passing :func:`operator.mul`, :func:`max` or :func:`min` as the second
optional argument to :func:`itertools.accumulate`, one can get
analogues of :func:`pyq.q.prds`, :func:`pyq.q.maxs` and :func:`pyq.q.mins`.
analogues of :func:`~pyq.q.prds`, :func:`~pyq.q.maxs` and :func:`~pyq.q.mins`.


Sliding window statistics
Expand Down
2 changes: 1 addition & 1 deletion doc/pyq-2017.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2303,7 +2303,7 @@
"(free for use with kdb+ personal edition)\n",
"\n",
"```\n",
"pip install -i https://pyq.enlnt.com --no-binary pyq pyq\n",
"pip install pyq\n",
"```\n",
"\n",
"## PyQ kernel for Jupyter \n",
Expand Down
25 changes: 25 additions & 0 deletions doc/whatsnew/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,29 @@
Version History
===============

`PyQ 4.1.2 <http://pyq.readthedocs.io/en/pyq-4.1.2/>`_
------------------------------------------------------

Released on 2017-10-12

Bug fixes and enhancements

- !589 - BUG #955 Check for negative values (including 0Ni) in enums.
- !590 - BUG #956 Do not use clr.
- !591 - ENH #958 Support for building wheels.
- !594 - BUG #960 Do not colorize the q) prompt on Windows.
- !597 - BUG #962 Removed 'collections' from lazy_converters.
- !598 - MNT #963 Fixed issue identified by lgtm.com.


Documentation

- !588 - DOC #954 Windows documentation.
- !595 - DOC #961 Fixed a typo in an introductory example.
- !599 - DOC #964 Updated documentation in preparation for 4.1.2 release.



`PyQ 4.1.1 <http://pyq.readthedocs.io/en/pyq-4.1.1/>`_
------------------------------------------------------

Expand Down Expand Up @@ -707,3 +730,5 @@ implemented K._ja
ln
guid
aN
clr
lgtm
1 change: 1 addition & 0 deletions doc/words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,4 @@ ktd
Gitlab
Centos
ubuntu
kernelspec
24 changes: 22 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
else:
from distutils.core import Command, Distribution, Extension, setup

VERSION = '4.1.1'
VERSION = '4.1.2'
IS_RELEASE = True
VERSION_FILE = 'src/pyq/version.py'
VERSION_PY = """\
Expand Down Expand Up @@ -84,6 +84,11 @@
'src/scripts/pq',
'src/scripts/qp',
],
data_files=[
('q', ['src/pyq/p.k',
'src/pyq/pyq-operators.q',
'src/pyq/python.q']),
],
url='http://pyq.enlnt.com',
author='Enlightenment Research, LLC',
author_email='pyq@enlnt.com',
Expand All @@ -106,11 +111,23 @@
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Database',
'Topic :: Software Development :: Libraries'
'Topic :: Software Development :: Libraries' +
' :: Python Modules'],
)


def add_data_file(data_files, target, source):
"""Add an entry to data_files"""
for t, f in data_files:
if t == target:
break
else:
data_files.append((target, []))
f = data_files[-1][1]
if source not in f:
f.append(source)


def get_version():
write_version_file = True
if IS_RELEASE:
Expand Down Expand Up @@ -330,6 +347,7 @@ def write_pyq_config(self):
pyq_config_file = os.path.join(self.build_lib, 'pyq-config.q')
with open(pyq_config_file, 'w') as f:
f.write(PYQ_CONFIG.format(**vars(self)))
add_data_file(self.distribution.data_files, 'q', pyq_config_file)


class BuildQExt(Command):
Expand Down Expand Up @@ -418,6 +436,8 @@ def run(self):

compiler.link_shared_object(objects, ext_path,
extra_postargs=extra_args)
add_data_file(self.distribution.data_files,
os.path.join('q', self.q_arch), ext_path)


class BuildPyExt(build_ext):
Expand Down
3 changes: 1 addition & 2 deletions src/pyq/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,13 +737,12 @@ def _tupletok(x):
converters[buffer] = K._kp
except NameError:
buffer = str
pass


###############################################################################
# Lazy addition of converters
###############################################################################
lazy_converters = {'uuid': [('UUID', lambda u: K._kguid(u.int))],
'collections': [('OrderedDict', converters[dict])],
'py._path.local': [('LocalPath',
lambda p: q.hsym(p.strpath))],
'pathlib': [('PurePath', lambda p: K(':' + str(p)))],
Expand Down
Loading

0 comments on commit 3af6a30

Please sign in to comment.