Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Up Minimum Python Supported Version to 3.8 #131

Open
wants to merge 16 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ jobs:
# this way, failuares are treated as a warning and don’t fail the whole workflow. This is sometimes referred to
# as a "shadow CI job".
# pypy is currently disabled, as it takes a long time to run (>20mins)
# python-version: ['3.7', '3.8', '3.9', '3.10', 'pypy-3.9']
python-version: ['3.7', '3.8', '3.9', '3.10']
# python-version: ['3.8', '3.9', '3.10', 'pypy-3.9']
python-version: ['3.8', '3.9', '3.10']
experimental: [false]

# I'm temporarily disabling the build on the 3.11 alpha, as the installation aims at buiilding the scipy wheel,
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ formats:

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.7
version: "3.9"
install:
- requirements: docs/requirements.txt
2 changes: 1 addition & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Installing Tarski

## Software Requirements
Tarski is mostly developed in Python, and requires a working Python>=3.6 installation.
Tarski is mostly developed in Python, and requires a working Python>=3.8 installation.
We strongly recommend installing Tarski within a Python
[virtual environment](https://docs.python.org/3/tutorial/venv.html).
The installation instructions below will install for you any additional
Expand Down
5 changes: 1 addition & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def main():
"License :: OSI Approved :: Apache Software License",

'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
Expand All @@ -50,14 +49,12 @@ def main():
packages=find_packages('src'), # include all packages under src
package_dir={'': 'src'}, # tell distutils packages are under src

python_requires='>=3.6', # supported Python ranges
python_requires='>=3.8', # supported Python ranges
install_requires=[
# psutil not supported on Windows, we haven't tested in other platforms, but since it's not essential
# to the functioning of Tarski, better be conservative here and install only on Linux.
'psutil; platform_system=="Linux"',

'multipledispatch',

# Antlr pinned to a specific version to avoid messages "ANTLR runtime and generated code versions disagree"
# messages. If we want to bump this up, we'll need to regenerate the grammar files with the new version.
'antlr4-python3-runtime==4.7.2',
Expand Down
17 changes: 11 additions & 6 deletions src/tarski/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@

import logging
from .version import __version__, __version_info__
import sys

from . import fstrips
from .errors import LanguageError
from .fol import FirstOrderLanguage
from .theories import language
from .syntax import Constant, Formula, Function, Predicate, Term, Variable
from .theories import Theory as Theories
from .syntax import Function, Predicate, Formula, Term, Constant, Variable
from .errors import LanguageError
from . import fstrips
from .theories import language
from .version import __version__, __version_info__

logging.getLogger(__name__).addHandler(logging.NullHandler())


if sys.version_info < (3, 8, 0):
raise OSError(f'Tarski requires Python>=3.8, but yours is {sys.version_info}')

__all__ = ['__version__', '__version_info__', 'FirstOrderLanguage', 'language', 'Theories',
'Function', 'Predicate', 'Formula', 'Term', 'Constant', 'Variable', 'LanguageError', 'fstrips']
4 changes: 2 additions & 2 deletions src/tarski/analysis/csp.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from collections import defaultdict

from ..errors import TarskiError
from ..syntax import CompoundFormula, Atom, Connective, Variable, Constant
from ..syntax import Atom, CompoundFormula, Connective, Constant, Variable


class WrongFormalismError(TarskiError):
Expand Down Expand Up @@ -77,7 +77,7 @@ def check_hypergraph_acyclicity(hypergraph):
Abiteboul, S., Hull, R. and Vianu, V (1995). Foundations of Databases, pp.131-132.
"""
nodes = set(itertools.chain.from_iterable(hypergraph))
edges = set(frozenset(x) for x in hypergraph) # simply convert the tuple into frozensets
edges = {frozenset(x) for x in hypergraph} # simply convert the tuple into frozensets
if len(edges) <= 1 or len(nodes) <= 1:
return True

Expand Down
12 changes: 7 additions & 5 deletions src/tarski/analysis/csp_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
from enum import Enum
from pathlib import Path

from ..fstrips.manipulation import Simplify
from ..errors import TarskiError
from ..fstrips.representation import is_conjunction_of_literals, has_state_variable_shape, \
collect_effect_free_parameters
from ..fstrips.manipulation import Simplify
from ..fstrips.representation import (collect_effect_free_parameters,
has_state_variable_shape,
is_conjunction_of_literals)
from ..grounding.common import StateVariableLite
from ..syntax import QuantifiedFormula, Quantifier, Contradiction, CompoundFormula, Atom, CompoundTerm, \
is_neg, symref, Constant, Variable, Tautology, top
from ..syntax import (Atom, CompoundFormula, CompoundTerm, Constant,
Contradiction, QuantifiedFormula, Quantifier, Tautology,
Variable, is_neg, symref, top)
from ..syntax.ops import collect_unique_nodes, flatten
from ..syntax.transform import to_prenex_negation_normal_form

Expand Down
8 changes: 4 additions & 4 deletions src/tarski/benchmarks/blocksworld.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

import tarski as tsk
from tarski import fstrips as fs
from tarski.fstrips import DelEffect, AddEffect
from tarski.fstrips import AddEffect, DelEffect

from ..fstrips import create_fstrips_problem
from ..syntax import land
from ..theories import Theory


BASE_DOMAIN_NAME = "blocksworld"


Expand All @@ -24,7 +24,7 @@ def generate_strips_bw_language(nblocks=4):
lang.predicate('on', object_t, object_t)
_ = [lang.predicate(p, object_t) for p in "ontable clear holding".split()]

_ = [lang.constant('b{}'.format(k), object_t) for k in range(1, nblocks + 1)]
_ = [lang.constant(f'b{k}', object_t) for k in range(1, nblocks + 1)]
return lang


Expand All @@ -41,7 +41,7 @@ def generate_fstrips_bw_language(nblocks=4):

# Table and blocks
lang.constant('table', place)
_ = [lang.constant('b{}'.format(k), block) for k in range(1, nblocks + 1)]
_ = [lang.constant(f'b{k}', block) for k in range(1, nblocks + 1)]
return lang


Expand Down
1 change: 0 additions & 1 deletion src/tarski/benchmarks/counters.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from ..syntax import land
from ..theories import Theory


BASE_DOMAIN_NAME = "counters-fn"


Expand Down
50 changes: 43 additions & 7 deletions src/tarski/dl/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,44 @@

from .concepts import Concept, PrimitiveConcept, UniversalConcept, NotConcept, ExistsConcept, ForallConcept, \
EqualConcept, AndConcept, OrConcept, EmptyConcept, NominalConcept, NullaryAtom, GoalConcept, GoalNullaryAtom
from .concepts import Role, PrimitiveRole, InverseRole, StarRole, RestrictRole, CompositionRole, GoalRole
from .features import MinDistanceFeature, ConceptCardinalityFeature, EmpiricalBinaryConcept, FeatureValueChange,\
NullaryAtomFeature, Feature
from .factory import SyntacticFactory, compute_dl_vocabulary
from .concepts import (AndConcept, CompositionRole, Concept, EmptyConcept,
EqualConcept, ExistsConcept, ForallConcept, GoalConcept,
GoalNullaryAtom, GoalRole, InverseRole, NominalConcept,
NotConcept, NullaryAtom, OrConcept, PrimitiveConcept,
PrimitiveRole, RestrictRole, Role, StarRole,
UniversalConcept)
from .errors import ArityDLMismatch
from .factory import SyntacticFactory, compute_dl_vocabulary
from .features import (ConceptCardinalityFeature, EmpiricalBinaryConcept,
Feature, FeatureValueChange, MinDistanceFeature,
NullaryAtomFeature)

__all__ = [
'AndConcept',
'ArityDLMismatch',
'CompositionRole',
'Concept',
'ConceptCardinalityFeature',
'EmpiricalBinaryConcept',
'EmptyConcept',
'EqualConcept',
'ExistsConcept',
'Feature',
'FeatureValueChange',
'ForallConcept',
'GoalConcept',
'GoalNullaryAtom',
'GoalRole',
'InverseRole',
'MinDistanceFeature',
'NominalConcept',
'NotConcept',
'NullaryAtom',
'NullaryAtomFeature',
'OrConcept',
'PrimitiveConcept',
'PrimitiveRole',
'RestrictRole',
'Role',
'StarRole',
'SyntacticFactory',
'UniversalConcept',
'compute_dl_vocabulary',
]
Loading