Skip to content

Commit

Permalink
release 4.606.24115
Browse files Browse the repository at this point in the history
  • Loading branch information
klahnakoski committed Apr 24, 2024
2 parents cb0b7e6 + 1fea004 commit b99dda1
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 103 deletions.
49 changes: 43 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# This workflow will install Python dependencies, run tests, and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: build
Expand All @@ -7,7 +7,7 @@ on:
push:
branches: [ "master", "dev" ]
tags:
- '[0-9]*'
- '[0-9]+'

jobs:
test:
Expand All @@ -20,10 +20,12 @@ jobs:

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Cache pip
uses: actions/cache@v2
with:
Expand All @@ -32,32 +34,51 @@ jobs:
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-
- name: Install dependencies
- name: Install Dependencies with Retry
run: |
cp packaging/setup.py .
pip install .
max_attempts=5
sleep_seconds=10
attempt_num=1
until pip install .; do
echo "Attempt $attempt_num of $max_attempts failed! Trying again in $sleep_seconds seconds..."
sleep $sleep_seconds
((attempt_num++))
if [[ $attempt_num -eq $max_attempts ]]; then
echo "All $max_attempts attempts have failed!"
exit 1
fi
done
- name: Install Test Dependencies
run: |
python tests/smoke_test.py
python -m pip install --upgrade pip
pip install --no-deps -r tests/requirements.lock
pip install .
- name: Run Tests
env:
CI: true
run: |
python -m unittest discover tests -v
coverage:
if: github.ref == 'refs/heads/dev'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Cache pip
uses: actions/cache@v2
with:
Expand All @@ -66,6 +87,23 @@ jobs:
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-
- name: Install Dependencies with Retry
run: |
cp packaging/setup.py .
max_attempts=5
sleep_seconds=10
attempt_num=1
until pip install .; do
echo "Attempt $attempt_num of $max_attempts failed! Trying again in $sleep_seconds seconds..."
sleep $sleep_seconds
((attempt_num++))
if [[ $attempt_num -eq $max_attempts ]]; then
echo "All $max_attempts attempts have failed!"
exit 1
fi
done
- name: Coverage
env:
COVERAGE: true
Expand All @@ -74,7 +112,6 @@ jobs:
python -m pip install --upgrade pip
pip install --no-deps -r tests/requirements.lock
pip install coverage coveralls
cp packaging/setup.py .
pip install .
coverage run --rcfile=packaging/coverage.ini -m unittest discover tests
coverage report --rcfile=packaging/coverage.ini
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ build
__pycache__
/setup.py
vendor
/MANIFEST.in
10 changes: 6 additions & 4 deletions jx_base/language.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@
from decimal import Decimal
from math import isnan

from jx_base.utils import enlist
from mo_dots import Data, data_types, startswith_field, null_types
import mo_dots
from mo_dots import Data, startswith_field, null_types, is_data
from mo_dots.lists import list_types, is_many
from mo_times import Date

from jx_base.utils import enlist
from mo_future import (
boolean_type,
long,
Expand All @@ -29,7 +32,6 @@
)
from mo_imports import delay_import
from mo_logs import logger
from mo_times import Date

is_literal = delay_import("jx_base.expressions.literal.is_literal")

Expand Down Expand Up @@ -369,7 +371,7 @@ def value_compare(left, right, ordering=1):
if c != 0:
return c * ordering
return 0
elif ltype in data_types:
elif ltype in mo_dots.data_types:
for k in sorted(set(left.keys()) | set(right.keys())):
c = value_compare(left.get(k), right.get(k)) * ordering
if c != 0:
Expand Down
59 changes: 0 additions & 59 deletions jx_python/expression_factory.py

This file was deleted.

2 changes: 1 addition & 1 deletion jx_python/expressions/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def jx_expression_to_function(expr):
"""
RETURN FUNCTION THAT REQUIRES PARAMETERS (row, rownum=None, rows=None):
"""
if expr == None:
if is_null(expr):
return Null

if is_expression(expr):
Expand Down
3 changes: 2 additions & 1 deletion jx_python/expressions/group_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def to_python(self, loop_depth=0):

def groupby(values, func):
output = []
cmp = lambda a, b: value_compare(detype(func(a)), detype(func(b)))
def cmp(a, b):
return value_compare(detype(func(a)), detype(func(b)))
for g, rows in itertools.groupby(sort_using_cmp(values, cmp=cmp), func):
row = list(rows)
if is_data(g):
Expand Down
13 changes: 4 additions & 9 deletions jx_python/streams/expression_factory.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
# encoding: utf-8
#
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http:# mozilla.org/MPL/2.0/.
#
# Contact: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from mo_dots import register_primitive

from jx_base.expressions import *
from jx_python.expressions import Python, PythonFunction
Expand Down Expand Up @@ -165,3 +157,6 @@ def __str__(self):


it = TopExpressionFactory(Variable("."))


register_primitive(ExpressionFactory)
6 changes: 3 additions & 3 deletions packaging/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
author_email='kyle@lahnakoski.com',
classifiers=["Development Status :: 4 - Beta","Topic :: Software Development :: Libraries","Topic :: Software Development :: Libraries :: Python Modules","License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)","Programming Language :: Python :: 3.8","Programming Language :: Python :: 3.9","Programming Language :: Python :: 3.11","Programming Language :: Python :: 3.12"],
description='JSON query expressions using Python',
extras_require={"tests":["mo-testing>=7.562.24075"]},
extras_require={"tests":["mo-testing>=7.585.24095"]},
include_package_data=True,
install_requires=["mo-collections==5.584.24095","mo-dots==9.584.24095","mo-future==7.584.24095","mo-json==6.584.24095","mo-json-config==4.586.24095","mo-kwargs==7.584.24095","mo-logs==8.584.24095","mo-math==7.584.24095","mo-threads==6.585.24095","mo-times==5.584.24095"],
install_requires=["mo-collections==5.606.24115","mo-dots==9.606.24115","mo-future==7.584.24095","mo-json==6.606.24115","mo-json-config==4.606.24115","mo-kwargs==7.606.24115","mo-logs==8.606.24115","mo-math==7.606.24115","mo-threads==6.606.24115","mo-times==5.606.24115"],
license='MPL 2.0',
long_description='# jx-python\n\nPython library for JSON Expressions \n\n[![PyPI Latest Release](https://img.shields.io/pypi/v/jx-python.svg)](https://pypi.org/project/jx-python/)\n[![Build Status](https://github.com/klahnakoski/jx-python/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/klahnakoski/jx-python/actions/workflows/build.yml)\n[![Coverage Status](https://coveralls.io/repos/github/klahnakoski/jx-python/badge.svg?branch=dev)](https://coveralls.io/github/klahnakoski/jx-python?branch=dev)\n',
long_description_content_type='text/markdown',
name='jx-python',
packages=["jx_base","jx_base.expressions","jx_base.models","jx_python.expressions","jx_python.containers","jx_python.cubes","jx_python.lists","jx_python.namespace","jx_python","jx_python.streams"],
url='https://github.com/klahnakoski/jx-python',
version='4.586.24095'
version='4.606.24115'
)
14 changes: 7 additions & 7 deletions packaging/setuptools.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
"Programming Language :: Python :: 3.12"
],
"description": "JSON query expressions using Python",
"extras_require": {"tests": ["mo-testing>=7.562.24075"]},
"extras_require": {"tests": ["mo-testing>=7.585.24095"]},
"include_package_data": true,
"install_requires": [
"mo-collections==5.584.24095", "mo-dots==9.584.24095",
"mo-future==7.584.24095", "mo-json==6.584.24095",
"mo-json-config==4.586.24095", "mo-kwargs==7.584.24095",
"mo-logs==8.584.24095", "mo-math==7.584.24095",
"mo-threads==6.585.24095", "mo-times==5.584.24095"
"mo-collections==5.606.24115", "mo-dots==9.606.24115",
"mo-future==7.584.24095", "mo-json==6.606.24115",
"mo-json-config==4.606.24115", "mo-kwargs==7.606.24115",
"mo-logs==8.606.24115", "mo-math==7.606.24115",
"mo-threads==6.606.24115", "mo-times==5.606.24115"
],
"license": "MPL 2.0",
"long_description": {
Expand All @@ -44,5 +44,5 @@
"jx_python.streams"
],
"url": "https://github.com/klahnakoski/jx-python",
"version": "4.586.24095"
"version": "4.606.24115"
}
24 changes: 12 additions & 12 deletions tests/requirements.lock
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# Tests pass with these versions 2024-04-04
# Tests pass with these versions 2024-04-24
# pip install --no-deps -r tests/requirements.lock
certifi==2024.2.2
charset-normalizer==3.3.2
hjson==3.1.0
idna==3.6
mo-collections==5.584.24095
mo-dots==9.584.24095
mo-files==6.585.24095
mo-collections==5.606.24115
mo-dots==9.606.24115
mo-files==6.606.24115
mo-future==7.584.24095
mo-imports==7.584.24095
mo-json==6.584.24095
mo-json-config==4.586.24095
mo-kwargs==7.584.24095
mo-logs==8.584.24095
mo-math==7.584.24095
mo-testing==7.585.24095
mo-threads==6.585.24095
mo-times==5.584.24095
mo-json==6.606.24115
mo-json-config==4.606.24115
mo-kwargs==7.606.24115
mo-logs==8.606.24115
mo-math==7.606.24115
mo-testing==8.591.24112
mo-threads==6.606.24115
mo-times==5.606.24115
requests==2.31.0
urllib3==2.2.0
2 changes: 1 addition & 1 deletion tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mo-testing>=7.585.24095
mo-testing>=8.591.24112

0 comments on commit b99dda1

Please sign in to comment.