A simple library to use GRASS GIS from python. You can specify the GRASS executable that you want to use with an enviromental variable called: GRASSBIN
Status
In development
Install
To install the stable version use:
$ pip install grass-session
To install the current development version use:
$ pip install git+https://github.com/zarch/grass-session.git
Examples
Set the GRASS GIS binary that you want to use with: export GRASSBIN=grass75:
>>> from grass_session import Session
>>> from grass.script import core as gcore
>>> with Session(gisdb="/tmp", location="location",
... create_opts="EPSG:4326"):
... print(gcore.parse_command("g.gisenv", flags="s"))
{u'GISDBASE': u"'/tmp/';",
u'LOCATION_NAME': u"'epsg3035';",
u'MAPSET': u"'PERMANENT';",}
>>> with Session(gisdb="/tmp", location="location", mapset="test",
... create_opts=""):
... print(gcore.parse_command("g.gisenv", flags="s"))
{u'GISDBASE': u"'/tmp/';",
u'LOCATION_NAME': u"'epsg3035';",
u'MAPSET': u"'test';",}
Development
Clone the repository:
$ git clone git@github.com:zarch/grass_session.git
Make sure that py.test, tox and pre-commit are installed:
$ pip install -r requirements-testing.txt
Install pre-commit hook in the local repository:
$ pre-commit install
Test locally with py.test:
$ pytest -vv .
To see the coverage use:
$ pytest -v –cov=grass_session –cov-report=html .
To test with different version of python or grass use:
$ GRASSBIN=~/.local/bin/grassXX PYTHONPATH=”pwd:$PYTHONPATH” pytest .
Test against multiple Python environments using tox:
$ tox ... _______________________ summary _____________________________ py27: commands succeeded py36: commands succeeded py37: commands succeeded py38: commands succeeded congratulations :)
Release files for grass-session 0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| grass-session-0.5.tar.gz | 10.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| grass_session-0.5-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 42.0 kB
Release files / grass-session-0.5.tar.gz
| Download URL | grass-session-0.5.tar.gz |
|---|---|
| Size | 10.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7155314535790145da8e2e31b0d20cd2be91477d54083a738b5c319164e7f03b
|
|
BLAKE2b-256 checksum How to use checksums |
fadfe6929fc29ddaf44dd7f7638cb0e1e9df1baebd2f84dd29d0626a6ddc3ae0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6
|
Release files / grass_session-0.5-py2.py3-none-any.whl
| Download URL | grass_session-0.5-py2.py3-none-any.whl |
|---|---|
| Size | 31.6 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
ce03a53e28cc14bc7fff91482e83ed4f174a1325732c4333ed183dd15de39f8d
|
|
BLAKE2b-256 checksum How to use checksums |
70ef20bf6c2468c57ab74506db4f24557e5a98678900426d0184ae5c63cbba55
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6
|