Skip to content

Commit

Permalink
Works on FreeBSD; PySwip is the project name.
Browse files Browse the repository at this point in the history
  • Loading branch information
yuce committed Jun 7, 2018
1 parent b87f907 commit 91c4337
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 27 deletions.
14 changes: 9 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

+ 0.2.7

* Works on FreeBSD.

+ 0.2.6

* Fixed issue [#9](https://github.com/yuce/pyswip/issues/9).
Expand All @@ -13,8 +17,8 @@

+ 0.2.4

* Maintenance release of PySWIP
* Added an error to avoid opening nested queries using PySWIP (SWI-Prolog does
* Maintenance release of PySwip
* Added an error to avoid opening nested queries using PySwip (SWI-Prolog does
not allow that). The error is NestedQueryError.
* Added Tomasz Gryszkiewicz's patch for better finding the SWI-Prolog lib in
Darwin
Expand All @@ -25,7 +29,7 @@

+ 0.2.3

* Maintenance release of PySWIP
* Maintenance release of PySwip
* Solved issue "Segmentation fault when assertz-ing" (thanks to jpthompson23)
* Solved issue "pyswip doesn't work on cygwin"
* Solved issue "Callbacks can cause segv's" (thanks to jpthompson23)
Expand All @@ -34,8 +38,8 @@

+ 0.2.2

* PySWIP won't rely on the (id of the) functor handle of `=/2`.
* Sebastian Höhn's patch to enable PySWIP to work on MAC OS-X is incorporated.
* PySwip won't rely on the (id of the) functor handle of `=/2`.
* Sebastian Höhn's patch to enable PySwip to work on MAC OS-X is incorporated.

+ 0.2.1

Expand Down
38 changes: 34 additions & 4 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
# PySWIP INSTALL
# PySwip INSTALL

PySWIP has no dependencies beyond Python's standard library. Some operating systems do not install the full standard library. In that case make sure that your Python setup includes `ctypes`.
PySwip has no dependencies beyond Python's standard library. Some operating systems do not install the full standard library. In that case make sure that your Python setup includes `ctypes`.

We recommend installing PySwip into a virtual environment. Python3 already has built-in support for that. You can create a virtual environment in `pyswip_env` directory using:
```
python3 -m venv pyswip_env
```

After that, you have to activate the virtual environment. On UNIX-like platorms (Linux, MacOS, FreeBSD, etc.) with BASH/csh/tcsh shell:
```
source pyswip_env/bin/activate
```

On Windows:
```
pyswip_env\Scripts\activate
```

See the [Python documentation](https://docs.python.org/3/library/venv.html) for more information.

## Linux

Expand Down Expand Up @@ -53,7 +70,20 @@ PySWIP has no dependencies beyond Python's standard library. Some operating syst
prolog.assertz("father(michael,john)")
```
## Other UNIX
**TODO**
### FreeBSD
1) SWI-Prolog can be installed using `pkg`:
```
pkg install swi-pl
```
2) `pip install pyswip`
3) Run a quick test by running following code at your Python console:
```python
from pyswip import Prolog
prolog = Prolog()
prolog.assertz("father(michael,john)")
```
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<a href="https://travis-ci.org/yuce/pyswip"><img src="https://api.travis-ci.org/yuce/pyswip.svg?branch=master"></a>
<a href="https://coveralls.io/github/yuce/pyswip"><img src="https://coveralls.io/repos/github/yuce/pyswip/badge.svg?branch=master"></a>

# PySWIP
# PySwip

## What's New?

See the [CHANGELOG](CHANGELOG.md).

**This library is being cleaned up and refactored. Expect API breakage and incompatibility with previous versions.**

Thanks to all [contributors](CONTRIBUTORS.txt). If you have contributed to PySWIP in the past and your name does not appear on that list, please [let me know](mailto:[email protected]) so I can add your name.
Thanks to all [contributors](CONTRIBUTORS.txt). If you have contributed to PySwip in the past and your name does not appear on that list, please [let me know](mailto:[email protected]) so I can add your name.

## Introduction

PySWIP is a Python - SWI-Prolog bridge enabling to query [SWI-Prolog](http://www.swi-prolog.org) in your Python programs.
PySwip is a Python - SWI-Prolog bridge enabling to query [SWI-Prolog](http://www.swi-prolog.org) in your Python programs.
It features an (incomplete) SWI-Prolog foreign language interface, a utility class that makes it easy querying with Prolog and also a
Pythonic interface.

Since PySWIP uses SWI-Prolog as a shared library and ctypes to access it, it doesn't require compilation to be installed.
Since PySwip uses SWI-Prolog as a shared library and ctypes to access it, it doesn't require compilation to be installed.

## Requirements:

Expand Down Expand Up @@ -109,9 +109,9 @@ The core functionality of `Prolog.query` is based on Nathan Denny's public domai
* https://twitter.com/tklx


## Projects/Publications that Use or Reference PySWIP
## Projects/Publications that Use or Reference PySwip

**Do you have a project, video or publication that uses/mentions PySWIP? [Please let me know](mailto:[email protected]) or send a pull request.**
**Do you have a project, video or publication that uses/mentions PySwip? [Please let me know](mailto:[email protected]) or send a pull request.**

### Books

Expand Down Expand Up @@ -143,7 +143,7 @@ The core functionality of `Prolog.query` is based on Nathan Denny's public domai
* [Super Pacman](https://github.com/kajornsakp/prologProject)
* [Pokemon Weak Detector](https://github.com/ReiiYuki/PokemonWeakDetector)
* [Food Recommendations in Hyderabad, India](https://github.com/cindyleowtt/prolog_food) Food Recommendation AI Expert System using a GUI hosted on Flask and a backend developed with PYSWIP and native Prolog
* [pyswip_envctrl](https://github.com/2rs2ts/pyswip_envctrl) An environment control module expert system written in PySWIP.
* [pyswip_envctrl](https://github.com/2rs2ts/pyswip_envctrl) An environment control module expert system written in PySwip.
* [tic-tac-toe](https://github.com/ivpusic/tic-tac-toe) Tic-tac-toe game with AI in Prolog and GUI in Python (kivy framework + pyswip)
* [TBM1 - "Getting to Know My Home"](http://thewiki.rockinrobotchallenge.eu/index.php?title=TBM1_-_“Getting_to_Know_My_Home”)
* [A script that enables use of a Prolog natural language parsing component to control a Scribbler II robot over bluetooth](http://justinmangue.com/blog/scribpro-py/)
Expand Down
4 changes: 2 additions & 2 deletions examples/README
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PySWIP Examples
PySwip Examples
===============

This directory contains examples for PySWIP.
This directory contains examples for PySwip.

The ones marked with (clp) requires clp library of SWI-Prolog.

Expand Down
4 changes: 2 additions & 2 deletions pyswip/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
# SOFTWARE.


# PySWIP version
__VERSION__ = "0.3.0"
# PySwip version
__VERSION__ = "0.2.7"

from pyswip.prolog import Prolog
from pyswip.easy import *
7 changes: 3 additions & 4 deletions pyswip/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,9 +420,8 @@ def _findSwipl():
(path, swiHome) = _findSwiplMacOSHome()

else:
raise EnvironmentError('The platform %s is not supported by this '
'library. If you want it to be supported, '
'please open an issue.' % platform)
# This should work for other UNIX
(path, swiHome) = _findSwiplLin()

# This is a catch all raise
if path is None:
Expand Down Expand Up @@ -573,7 +572,7 @@ def check_and_call(*args):
# Load the library
_lib = CDLL(_path, mode=RTLD_GLOBAL)

# PySWIP constants
# PySwip constants
PYSWIP_MAXSTR = 1024
c_int_p = c_void_p
c_long_p = c_void_p
Expand Down
2 changes: 1 addition & 1 deletion pyswip/easy.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-


# pyswip.easy -- PySWIP helper functions
# pyswip.easy -- PySwip helper functions
# Copyright (c) 2007-2018 Yüce Tekol
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@


setup(name="pyswip",
version="0.2.6",
version="0.2.7",
url="https://github.com/yuce/pyswip",
download_url="https://github.com/yuce/pyswip/releases",
author="Yuce Tekol",
author_email="[email protected]",
description="PySWIP enables querying SWI-Prolog in your Python programs.",
description="PySwip enables querying SWI-Prolog in your Python programs.",
long_description=long_description,
long_description_content_type="text/markdown",
license="MIT",
Expand Down

0 comments on commit 91c4337

Please sign in to comment.