Skip to content

Commit

Permalink
PyQ Release 4.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleks Bunin committed Mar 6, 2018
1 parent d1fadf3 commit 788be57
Show file tree
Hide file tree
Showing 19 changed files with 1,561 additions and 1,045 deletions.
114 changes: 114 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: AllDefinitions
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: true
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 79
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentPPDirectives: AfterHash
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: 'Py_BEGIN_ALLOW_THREADS'
MacroBlockEnd: 'Py_END_ALLOW_THREADS'
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
RawStringFormats:
- Delimiter: pb
Language: TextProto
BasedOnStyle: google
ReflowComments: false
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 8
UseTab: Never
...

12 changes: 12 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Prevent git from showing duplicate names with commands like "git shortlog"

# The syntax is:
# Name that should be used <email that should be used> Bad name <bad email>

# This file is up-to-date if the command git log --format="%aN <%aE>" | sort -u
# gives no duplicates.

Alexander Belopolsky <a@enlnt.com> Alexander Belopolsky <abalkin@users.noreply.github.com>
Alexander Belopolsky <a@enlnt.com> Alexander Belopolsky <abalkin@enlnt.com>
Alexander Belopolsky <a@enlnt.com> Alexander Belopolsky <alexander.belopolsky@gmail.com>
Aleks Bunin <b@enlnt.com> Aleks Bunin <github@compuix.com>
5 changes: 1 addition & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ install:
- export CONDA_FORCE_32BIT=1
- conda create -q -n test-env python=$TRAVIS_PYTHON_VERSION
- source activate test-env
- conda install numpy
# Install kdb+
- curl -O https://kx.com/$X/3.5/linuxx86.zip
- unzip -d $CONDA_PREFIX linuxx86.zip
Expand All @@ -43,6 +42,4 @@ addons:
- gcc-multilib
script:
- pyq --versions
- pyq -mpytest --pyargs pyq --cov pyq
after_success:
- bash <(curl -s https://codecov.io/bash)
- pyq -mpytest --pyargs pyq
5 changes: 4 additions & 1 deletion AUTHORS.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
Enlightenment Research, LLC [pyq@enlnt.com](mailto:pyq@enlnt.com)
Alexander Belopolsky
Aleks Bunin
Stephen Taylor
Hao Deng
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
# PyQ - Python for kdb+

[![Build Status](https://travis-ci.org/KxSystems/pyq.svg?branch=master)](https://travis-ci.org/KxSystems/pyq)
[![Documentation Status](https://readthedocs.org/projects/pyq/badge/?version=latest)](http://pyq.readthedocs.io/en/latest/?badge=latest)
[![Documentation Status](https://readthedocs.org/projects/pyq/badge/?version=latest)](https://pyq.readthedocs.io/en/latest/?badge=latest)
[![PyPI Version](https://img.shields.io/pypi/v/pyq.svg)](https://pypi.python.org/pypi/pyq)
[![LGTM](https://img.shields.io/badge/lgtm-review-blue.svg)](https://lgtm.com/projects/g/enlnt/pyq)
[![Codecov](https://codecov.io/gh/KxSystems/pyq/branch/master/graph/badge.svg)](https://codecov.io/gh/KxSystems/pyq)

[PyQ][2] brings the [Python programming language][4] to the [kdb+ database][5].
Part of the [_Fusion for kdb+_](http://code.kx.com/q/interfaces/fusion/) interface collection.
[PyQ][2] brings the [Python programming language][4] to the [kdb+ database][5].
Part of the [_Fusion for kdb+_][6] interface collection.

It allows developers to integrate Python and q codes seamlessly in one application.
This is achieved by bringing the Python and q interpreters into the same process so that code written in either of the languages operates on the same data.
In PyQ, Python and q objects live in the same memory space and share the same
data.

Please [report issues](https://github.com/KxSystems/pyq/issues) in this repository.
Please [report issues][7] in this repository.


## Installation
Expand Down Expand Up @@ -74,3 +73,5 @@ tox
[3]: https://tox.readthedocs.io/en/latest
[4]: https://www.python.org/about
[5]: https://kx.com
[6]: https://code.kx.com/q/interfaces/fusion/
[7]: https://github.com/KxSystems/pyq/issues
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.2'
__version__ = '4.1.3'


# If extensions (or modules to document with autodoc) are in another directory,
Expand Down
36 changes: 36 additions & 0 deletions doc/whatsnew/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,42 @@
Version History
===============


Version History
===============

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

Released on 2018-03-06

Bug fixes and enhancements

- !604 - BUG #970 Ignore the first line in the otool -L output.
- !608 - ENH #980 Implemented K.guid.na.
- !610 - STY #916 C code reformat
- !614 - ENH #919 Rewrote z2py entirely in C.
- !616 - MNT #984 Speed up access to q builtins.
- !617 - ENH #936 Support for kdb+ version 3.6
- !622 - BUG #988 Use /sbin/ldconfig if ldconfig not in the PATH.
- !627 - ENH #990 Better diagnostic on a broken q executable.
- gh-33 - MNT Define _GNU_SOURCE conditionally.
- gh-38 - MNT Update k.h.

Documentation

This is the last release, where documentation included with the PyQ source. Starting with PyQ 4.2.0 documentation will be available only at `code.kx.com <http://code.kx.com/q/interfaces/pyq/>`_.

- !621 - MNT Update metadata and authors list
- gh-26 - MNT Updated the license entry in the package classifiers.

CI

- gh-27, gh-29, gh-46 - BLD Travis CI configuration.
- gh-39 - BLD Blacklist pytest 3.3.0.
- gh-45 - BLD Send coverage results to Codecov


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

Expand Down
6 changes: 6 additions & 0 deletions doc/words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,9 @@ Gitlab
Centos
ubuntu
kernelspec
otool
na
ldconfig
gh
codecov
sbin
17 changes: 9 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
else:
from distutils.core import Command, Distribution, Extension, setup

VERSION = '4.1.2'
VERSION = '4.1.3'
IS_RELEASE = True
VERSION_FILE = 'src/pyq/version.py'
VERSION_PY = """\
Expand Down Expand Up @@ -110,10 +110,9 @@ def split_replace(string, a, b, sep):
'src/pyq/pyq-operators.q',
'src/pyq/python.q']),
],
url='http://pyq.enlnt.com',
author='Enlightenment Research, LLC',
author_email='pyq@enlnt.com',
license='PyQ General License',
url='https://github.com/KxSystems/pyq',
author='PyQ Authors',
license='Apache License',
platforms=['Linux', 'Mac OS-X', 'Solaris'],
classifiers=['Development Status :: 5 - Production/Stable',
'Environment :: Console',
Expand All @@ -127,7 +126,6 @@ def split_replace(string, a, b, sep):
'Operating System :: POSIX :: SunOS/Solaris',
'Programming Language :: C',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation :: CPython',
Expand Down Expand Up @@ -246,14 +244,17 @@ def get_python_dll(executable):
# (i.e Ubuntu), but provide dynamic libraries in a separate
# package.
libpython = 'libpython{}.{}'.format(*sys.version_info[:2]).encode()
output = subprocess.check_output(['ldconfig', '-p'])
try:
output = subprocess.check_output(['ldconfig', '-p'])
except subprocess.CalledProcessError:
output = subprocess.check_output(['/sbin/ldconfig', '-p'])
for line in output.splitlines():
if libpython in line:
return decode(line.split()[-1])

elif sysname == 'Darwin':
output = subprocess.check_output(['otool', '-L', executable])
for line in output.splitlines():
for line in output.splitlines()[1:]:
if b'Python' in line:
python_dll = decode(line.split()[0])
return python_dll.replace('@executable_path',
Expand Down
3 changes: 3 additions & 0 deletions src/pyq.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/errno.h>
#include <pwd.h>
#include <limits.h>
#ifdef __APPLE__
Expand Down Expand Up @@ -307,6 +308,8 @@ main(int argc, char *argv[])
fflush(stdout);
fflush(stderr);
rc = execvp(qpath, args);
if (errno != ENOENT)
perror(qpath);
tried_paths[i] = qpath;
}
else {
Expand Down
19 changes: 10 additions & 9 deletions src/pyq/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@
# binr was introduced in kdb+3.0 2012.07.26
_Q_RES.append('binr')

if Q_VERSION >= 3.6:
_Q_RES.append('hopen')


class K(_K):
"""proxies for kdb+ objects
Expand Down Expand Up @@ -573,7 +576,7 @@ def q(x):
return pairs


def _genmethods(cls):
def _genmethods(cls, obj):
q('\l pyq-operators.q')
cls._show = q('{` sv .Q.S[y;z;x]}')
cls._sizeof = q('.p.sizeof')
Expand All @@ -598,6 +601,7 @@ def _genmethods(cls):
for x, f in _q_builtins():
if not hasattr(cls, x):
setattr(cls, x, f)
obj.__dict__[x] = f

def cmp_op(op):
def dunder(self, other):
Expand Down Expand Up @@ -648,14 +652,9 @@ def __call__(self, m=None, *args):
object.__setattr__(self, '_cmd', Cmd())
self._cmd.cmdloop()

def __getattribute__(self, attr):
try:
return object.__getattribute__(self, attr)
except AttributeError:
pass
k = K._k
def __getattr__(self, attr, _k=K._k):
try:
return k(0, attr.rstrip('_'))
return _k(0, attr.rstrip('_'))
except kerr:
pass
raise AttributeError(attr)
Expand Down Expand Up @@ -780,7 +779,7 @@ def __import__(name, globals={}, locals={}, fromlist=[], level=[-1, 0][_PY3K],
__builtin__.__import__ = __import__
###############################################################################

_genmethods(K)
_genmethods(K, q)
del _genmethods, _imp


Expand Down Expand Up @@ -853,6 +852,8 @@ def constructor(x):
if self.code > 4 and int(self.code) != 11:
constructor.inf = q('0W' + self.char)
constructor.na = q('0N' + self.char)
elif self.name == 'guid':
constructor.na = q('0Ng')

return constructor

Expand Down
Loading

0 comments on commit 788be57

Please sign in to comment.