Skip to main content

pyramid_oereb, extension for pyramid web frame work to provide a basic server part for the oereb project

Project description

Project description

pyramid_oereb is an open-source implementation of the server side part for the swiss “Cadastre of Public-law Restrictions on landownership” (PLR-cadastre).

It is written in Python and designed as a plugin for the Pyramid Web Framework. This allows pyramid_oereb to be included in any Pyramid web application.

Please refer to the documentation for detailed information and instructions for installation and configuration.

If you are interested in contributing or extending the project, take a look at the contribution page.

Starting the development server

  1. Build run the initial build depending on your OS:

    • docker network create print-network

    • Linux: docker compose run --rm -u $(id -u):$(id -g) oereb-make build

    • MAC/Windows: docker compose run --rm oereb-make build

  2. docker compose up

Running docker compose up will start the DB (it will automatically import the test/dev data on startup) and start a running instance of the pyramid_oereb DEV server connected to the DB. The project folder is mounted to it. So changes take effect.

The sample static extract should then be available at http://localhost:6543/oereb/extract/json?EGRID=CH113928077734

Running the tests

To run the tests locally:

The docker way:

  • docker network create print-network

  • Linux: docker compose run --rm -u $(id -u):$(id -g) oereb-server make build tests

  • MAC/Windows: docker compose run --rm oereb-server make build tests

For systems having a local make tool, the following recipe can be used: make docker-tests

sometimes the local postgres port is already in use, and you must override it: EXPOSED_PGPORT=5433 make docker-tests

Local tests:

For local tests without the complete docker composition you need a running DB. You can create one based on the oereb image: docker compose up -d oereb-db

or create an empty postgis DB docker run -p 5555:5432 --name pg_oereb --rm -it -e POSTGRES_PASSWORD=pw postgis/postgis

Then you can run the tests easily: make tests

If the DB does not use standard credentials, you can set them as ENV vars: PGPORT=5555 PGPASSWORD=pw make tests

To run one specfic test:

docker compose exec oereb-server PYTEST_OPTS="-k <name_of_the_test>" make tests

Troubleshooting

Some local files may remain from previous builds, and the regular user may not be able to delete them. In this case cleanup can be done like:

docker compose run --rm oereb-make clean-all

Useful make targets

Run the make targets found in the Makefile either in the oereb-server container (if using docker compose) or in your local shell (if running the server locally). Some useful targets:

  • make serve-dev to run the application

  • make tests to run the application tests

  • make docker-tests to run the application tests inside a docker composition, so one does not have to care about local set up

  • make clean to empty the database

  • make clean-all to empty the database, uninstall the application and the virtual env and clear the rendered configuration files

  • make docker-clean-all to clean up everything written by the docker container. This is sometimes useful when docker has created some files with root only permission

If necessary the application is re-installed and the database is filled when running make serve-dev again.

There are further make targets to check the validity of federal data:

  • make check_fed_data downloads currently known federal data definitions and compares them with the active ones

  • make update_fed_data_urls try to retrieve the new urls from the server’s index page. The file fed.urls must then be committed to the repo

  • make update_fed_data_urls generate new json files in the repo. The modified files must then be committed

  • make auto_update_fed_data automagic command which finds the new URLs, generates json data, copies json to project. The files fed.urls and dev/sample_data/ch.*.json must be committed if changed

Using MapFish-Print

To be able to test the OEREB static extract (pdf), you need to run pyramid_oereb with docker compose and to have a running instance of pyramid_oereb_mfp. The Docker network print-network is also required and can be created with:

docker network create print-network

It is also possible to launch a Mapfish Print service on a local URL (via Docker or not) and then run the server via make serve. The correct print url must be provided:

PRINT_URL="http://localhost:8680/print/oereb" EXPOSED_PGPORT=5433 PGPORT=5433 make serve-dev

The sample static extract should then be available at http://localhost:6543/oereb/extract/pdf?EGRID=CH113928077734

CI Status

CI status on master branch:

Master CI status

Daily check status:

Daily check status

Code Quality Status:

Codacy Badge

Project details


Release history Release notifications | RSS feed

This version

2.5.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyramid_oereb-2.5.1.tar.gz (143.1 kB view details)

Uploaded Source

Built Distribution

pyramid_oereb-2.5.1-py3-none-any.whl (283.0 kB view details)

Uploaded Python 3

File details

Details for the file pyramid_oereb-2.5.1.tar.gz.

File metadata

  • Download URL: pyramid_oereb-2.5.1.tar.gz
  • Upload date:
  • Size: 143.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for pyramid_oereb-2.5.1.tar.gz
Algorithm Hash digest
SHA256 9f72ce265d4dbe75a2ebcc781b9c3cd27220b053e36ae605effefe571631c2e1
MD5 3e0faa36c38301247ef214ae4bc364dc
BLAKE2b-256 1bd9853d3c12e3eaa62aaeb8378383124366e583b5128d2b7ba4c7f9ce8c3677

See more details on using hashes here.

Provenance

File details

Details for the file pyramid_oereb-2.5.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pyramid_oereb-2.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e51bc76d0d012a9607d01adc60e17735b3e42209c64819f0564687b4f4048859
MD5 3c36edd525f6716c5ed932ab223490fe
BLAKE2b-256 bed948f5f92bbc5e5ea73ddfccdf6873140e8c2b8857c1457e8fda9ac6c22c63

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page