Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
voisardf committed Jan 19, 2024
2 parents be33be2 + 9470088 commit b84a487
Show file tree
Hide file tree
Showing 43 changed files with 2,066 additions and 347 deletions.
3 changes: 3 additions & 0 deletions .coveragerc.contrib-data_sources-oereblex
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[run]
source =
pyramid_oereb/contrib/data_sources/oereblex/*.py
3 changes: 3 additions & 0 deletions .coveragerc.core_adapter
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[run]
source =
pyramid_oereb/core/adapter.py
16 changes: 8 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
name: Check style (lint)
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- run: sudo rm /etc/apt/sources.list.d/*.list
- run: sudo apt update
- run: sudo apt-get install libpq-dev
Expand All @@ -18,7 +18,7 @@ jobs:
name: Check style (git-attributes)
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- run: sudo rm /etc/apt/sources.list.d/*.list
- run: sudo apt update
- run: sudo apt-get install libpq-dev
Expand Down Expand Up @@ -51,9 +51,9 @@ jobs:
- '3.10'
- '3.11'
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Set up Python v${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: x64
Expand All @@ -77,7 +77,7 @@ jobs:
name: Check federal data definitions
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- run: sudo rm /etc/apt/sources.list.d/*.list
- run: sudo apt update
- run: sudo apt-get install xsltproc
Expand All @@ -94,15 +94,15 @@ jobs:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Make documentation
run: |
sudo rm /etc/apt/sources.list.d/*.list
sudo apt update
sudo apt-get install libpq-dev
make doc-html
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.4.3
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
branch: gh-pages # The branch the action should deploy to.
folder: doc/build/html # The folder the action should deploy.
Expand All @@ -114,7 +114,7 @@ jobs:
steps:
- uses: actions/checkout@master
- name: Set up Python 3.11
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install pypa/build
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/daily_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
name: Check federal data definitions
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- run: sudo rm /etc/apt/sources.list.d/*.list
- run: sudo apt update
- run: sudo apt-get install xsltproc
Expand Down Expand Up @@ -46,7 +46,7 @@ jobs:
- python3.10
- python3.11
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- run: sudo rm /etc/apt/sources.list.d/*.list
- run: sudo apt update
- run: sudo apt-get install libpq-dev
Expand All @@ -55,7 +55,7 @@ jobs:
PYTHON_TEST_VERSION: ${{ matrix.python-version }}
run: make tests
- name: Set up Python 3.11
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install pypa/build
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ __pycache__/
/doc/source/api.rst
/doc/source/contrib/print_proxy/index.rst
/doc/source/contrib/print_proxy/mapfish-print.rst
/doc/source/contrib/print_proxy/xml2pdf.rst
/doc/source/contrib/data_sources/standard/models-main.rst
/doc/source/contrib/data_sources/standard/models-theme.rst
/doc/source/contrib/data_sources/standard/models.rst
Expand Down Expand Up @@ -81,8 +80,10 @@ DataExtract.json

/coverage.contrib-data_sources-standard.xml
/coverage.contrib-data_sources-interlis.xml
/coverage.contrib-data_sources-oereblex.xml
/coverage.contrib-print_proxy-mapfish_print.xml
/coverage.contrib-data_sources-swisstopo.xml
/coverage.core.xml
/coverage.core_adapter.xml
/coverage.contrib-stats.xml
/coverage.xml
9 changes: 9 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Changelog
=========

2.4.7
-----
- Add extract_index to disclaimer and general infomation (#1753)
- Interlis bug fix (#1881)
- Library upgrades (geoalchemy2, SQLAlchemy, jsonschema, lxml, responses, urllib3, pypdf)
- Test coverage improvements
- Python 3.8 is no longer explicitly supported
- Remove print proxy xml2pdf, no longer used by the community (#1889)

2.4.6
-----
- Fix error with large of contents and new pdf library (#1813)
Expand Down
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ DEV_CREATE_OEREBLEX_TABLES_SCRIPT = $(VENV_BIN)/create_oereblex_tables

MODEL_PK_TYPE_IS_STRING ?= true

PRINT_BACKEND = MapFishPrint # Set to XML2PDF if preferred
PRINT_URL ?= http://oereb-print:8080/print/oereb

# ********************
Expand Down Expand Up @@ -207,7 +206,7 @@ BUILD_DEPS += ${VENV_ROOT}/requirements-timestamp
# ***********************

$(DEV_CONFIGURATION_YML): ${VENV_ROOT}/requirements-timestamp $(DEV_CREATE_STANDARD_YML_SCRIPT)
$(DEV_CREATE_STANDARD_YML_SCRIPT) --name $@ --database $(SQLALCHEMY_URL) --print_backend $(PRINT_BACKEND) --print_url $(PRINT_URL)
$(DEV_CREATE_STANDARD_YML_SCRIPT) --name $@ --database $(SQLALCHEMY_URL) --print_url $(PRINT_URL)

# *********************
# END DEV-YAML creation
Expand Down Expand Up @@ -305,10 +304,13 @@ test-postgis:
test-core: ${VENV_ROOT}/requirements-timestamp
$(VENV_BIN)/py.test -vv $(PYTEST_OPTS) --cov-config .coveragerc.core --cov $(PACKAGE)/core --cov-report=term-missing --cov-report=xml:coverage.core.xml tests/core

.PHONY: test-core_adapter
test-core_adapter: ${VENV_ROOT}/requirements-timestamp
$(VENV_BIN)/py.test -vv $(PYTEST_OPTS) --cov-config .coveragerc.core_adapter --cov $(PACKAGE)/core --cov-report=term-missing --cov-report=xml:coverage.core_adapter.xml tests/core_adapter

.PHONY: test-contrib-print_proxy-mapfish_print
test-contrib-print_proxy-mapfish_print: ${VENV_ROOT}/requirements-timestamp
$(VENV_BIN)/py.test -vv $(PYTEST_OPTS) --cov-config .coveragerc.contrib-print_proxy-mapfish_print --cov $(PACKAGE) --cov-report xml:coverage.contrib-print_proxy-mapfish_print.xml tests/contrib.print_proxy.mapfish_print
# $(VENV_BIN)/py.test -vv $(PYTEST_OPTS) --cov-config .coveragerc --cov $(PACKAGE) --cov-report term-missing:skip-covered tests/contrib.print_proxy.xml_2_pdf

.PHONY: test-contrib-data_sources-standard
test-contrib-data_sources-standard: ${VENV_ROOT}/requirements-timestamp
Expand All @@ -322,12 +324,16 @@ test-contrib-data_sources-interlis: ${VENV_ROOT}/requirements-timestamp
test-contrib-data_sources-swisstopo: ${VENV_ROOT}/requirements-timestamp
$(VENV_BIN)/py.test -vv $(PYTEST_OPTS) --cov-config .coveragerc.contrib-data_sources-swisstopo --cov $(PACKAGE)/contrib/data_sources/swisstopo --cov-report=term-missing:skip-covered --cov-report=xml:coverage.contrib-data_sources-swisstopo.xml tests/contrib.data_sources.swisstopo

.PHONY: test-contrib-data_sources-oereblex
test-contrib-data_sources-oereblex: ${VENV_ROOT}/requirements-timestamp
$(VENV_BIN)/py.test -vv $(PYTEST_OPTS) --cov-config .coveragerc.contrib-data_sources-oereblex --cov $(PACKAGE)/contrib/data_sources/oereblex --cov-report=term-missing:skip-covered --cov-report=xml:coverage.contrib-data_sources-oereblex.xml tests/contrib.data_sources.oereblex

.PHONY: test-contrib-stats
test-contrib-stats: ${VENV_ROOT}/requirements-timestamp
$(VENV_BIN)/py.test -vv $(PYTEST_OPTS) --cov-config .coveragerc.contrib-stats --cov $(PACKAGE)/contrib/stats --cov-report=xml:coverage.contrib-stats.xml tests/contrib.stats

.PHONY: tests
tests: ${VENV_ROOT}/requirements-timestamp test-core test-contrib-print_proxy-mapfish_print test-contrib-data_sources-standard test-contrib-data_sources-interlis test-contrib-stats test-contrib-data_sources-swisstopo
tests: ${VENV_ROOT}/requirements-timestamp test-core test-core_adapter test-contrib-print_proxy-mapfish_print test-contrib-data_sources-standard test-contrib-data_sources-interlis test-contrib-stats test-contrib-data_sources-swisstopo test-contrib-data_sources-oereblex

.PHONY: docker-tests
docker-tests:
Expand Down
4 changes: 2 additions & 2 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
flake8==6.1.0
pyflakes==3.1.0
flake8==7.0.0
pyflakes==3.2.0
pycodestyle==2.11.1
Sphinx==7.2.6
sphinx_rtd_theme==2.0.0
Expand Down
11 changes: 0 additions & 11 deletions dev/config/create_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
def _create_yaml_config_(
name='pyramid_oereb.yml',
database='postgresql://postgres:password@localhost/pyramid_oereb',
print_backend='MapFishPrint',
print_url='http://oereb-print:8080/print/oereb'):
"""
Creates the specified YAML file using a template. This YAML file contains the standard
Expand All @@ -28,7 +27,6 @@ def _create_yaml_config_(
)
config = template.render(
sqlalchemy_url=database,
print_backend=print_backend,
print_url=print_url
)
pyramid_oereb_yml = open(name, 'wb+')
Expand Down Expand Up @@ -58,14 +56,6 @@ def create_yaml():
help='The database connection string (default is: '
'postgresql://postgres:password@oereb-db:5432/pyramid_oereb).'
)
parser.add_option(
'-p', '--print_backend',
dest='print_backend',
metavar='PRINT_BACKEND',
type='string',
default='MapFishPrint',
help='The print backend (for PDF generation) to use (default is: MapFishPrint)'
)
parser.add_option(
'-u', '--print_url',
dest='print_url',
Expand All @@ -78,6 +68,5 @@ def create_yaml():
_create_yaml_config_(
name=options.name,
database=options.database,
print_backend=options.print_backend,
print_url=options.print_url
)
19 changes: 2 additions & 17 deletions dev/config/pyramid_oereb.yml.mako
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,8 @@ pyramid_oereb:
# The pyramid renderer which is used as proxy pass through to the desired service for printable static
# extract. Here you can define the path to the logic which prepares the output as payload for print
# service and returns the result to the user.
% if print_backend == 'XML2PDF':
# Configuration for XML2PDF print service
renderer: pyramid_oereb.contrib.print_proxy.xml_2_pdf.xml_2_pdf.Renderer
# Define whether all geometry data must be included when sending the data to the print service
with_geometry: False
# Base URL with application of the print server
base_url: https://oereb-dev.gis-daten.ch/oereb/report/create
token: 24ba4328-a306-4832-905d-b979388d4cab
use_wms: "true"
validate: "false"
# The following parameters are currently not used by xml2pdf, but might be in the future (see issue #873)
buffer: 10
basic_map_size: [493, 280]
pdf_dpi: 300
pdf_map_size_millimeters: [174, 99]
% else:
# This version of pyramid oereb provides only the mapfish_print print proxy.
#
# Configuration for MapFish-Print print service
renderer: pyramid_oereb.contrib.print_proxy.mapfish_print.mapfish_print.Renderer
# Define whether all geometry data must be included when sending the data to the print service
Expand Down Expand Up @@ -116,7 +102,6 @@ pyramid_oereb:
print_canton_logo: true
# Flag to print or not the municipality name
print_municipality_name: true
% endif

# The "app_schema" property contains only one sub property "name". This is directly related to the database
# creation process, because this name is used as schema name in the target database. The app_schema holds
Expand Down
10 changes: 10 additions & 0 deletions doc/source/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ Changes/Hints for migration
This chapter will give you hints on how to handle version migration, in particular regarding what you may need
to adapt in your project configuration, database etc. when upgrading to a new version.

Version 2.4.7
-------------
Bug-fix and maintenance release:

* Interlis bug fix (#1881)
* Library upgrades (geoalchemy2, SQLAlchemy, jsonschema, lxml, responses, urllib3, pypdf)
* Test coverage improvements
* Python 3.8 is no longer explicitly supported
* Remove print proxy xml2pdf, no longer used by the community (#1889)

Version 2.4.6
-------------
Bug-fix and maintenance release:
Expand Down
3 changes: 1 addition & 2 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@
'contrib/data_sources/swisstopo/index.rst',
'contrib/data_sources/index.rst',
'contrib/print_proxy/index.rst',
'contrib/print_proxy/mapfish-print.rst',
'contrib/print_proxy/xml2pdf.rst'
'contrib/print_proxy/mapfish-print.rst'
]

for target_path in target_paths:
Expand Down
4 changes: 1 addition & 3 deletions doc/source/contrib/print_proxy/index.rst.mako
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ Part of ``pyramid_oereb`` plugable system is also the production of PDF files of
It is solved via a proxy approach. The extract is passed to a service which knows how to produce a PDF
satisfying the federal specifications.

As of now ``pyramid_oereb`` offers the following print proxies:
As of now ``pyramid_oereb`` offers the following print proxy:

* :ref:`contrib-print_proxy-mapfish-print`
* :ref:`contrib-print_proxy-xml2pdf`

.. toctree::
:hidden:

mapfish-print
xml2pdf
39 changes: 39 additions & 0 deletions doc/source/contrib/print_proxy/xml2pdf.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
.. _contrib-print_proxy-xml2pdf:

XML2PDF
-------

Configuration
.............


To properly configure the XML2PDF print service of GISDATEN AG, you need specific configuration in the section
``print`` of your ``yaml`` file.
Please see the `standard configuration file
<https://github.com/openoereb/pyramid_oereb/blob/master/pyramid_oereb/standard/pyramid_oereb.yml.mako>`__
as an example, or use the ``create_standard_yaml`` script to regenerate your configuration file with the desired options.




.. _api-pyramid_oereb-contrib-print_proxy-xml_2_pdf:

.. automodule:: pyramid_oereb.contrib.print_proxy.xml_2_pdf


.. _api-pyramid_oereb-contrib-print_proxy-xml_2_pdf-xml_2_pdf:

.. automodule:: pyramid_oereb.contrib.print_proxy.xml_2_pdf.xml_2_pdf


.. _api-pyramid_oereb-contrib-print_proxy-xml_2_pdf-xml_2_pdf-renderer:

*Xml 2 Pdf Renderer*
^^^^^^^^^^^^^^^^^^^^

.. autoclass:: pyramid_oereb.contrib.print_proxy.xml_2_pdf.xml_2_pdf.Renderer
:members:
:inherited-members:

.. automethod:: __init__

Loading

0 comments on commit b84a487

Please sign in to comment.