diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..75b7fee42a8b76b147e3c49fcf89a47cd22997e3 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,27 @@ +image: python:3.9-bullseye + +# Make pip cache the installed dependencies +variables: + PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" + +cache: + paths: + - .cache/pip + - venv/ + +before_script: + - python3 -V + - pip3 install virtualenv + - virtualenv venv + - source venv/bin/activate + - pip3 install . + - pip3 install .[tests] + +linters: + script: + - pip3 install .[linters] + - make check + +tests: + script: + - pytest tests diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..a1b2560dbc5ac383f701862b917dca0c8f5c5225 --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +SOURCES=gdeexporter tests setup.py +LENGTH=96 + +check: $(SOURCES) + flake8 --max-line-length=$(LENGTH) --ignore=E203,W503 $^ + black --check --line-length $(LENGTH) $^ + pylint -E $^ + +format: $(SOURCES) + black --line-length $(LENGTH) $^ diff --git a/gdeexporter/__init__.py b/gdeexporter/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..4875bf7e1587905b5d55042a1a44ec202aa33ced --- /dev/null +++ b/gdeexporter/__init__.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python3 + +# Copyright (C) 2022: +# Helmholtz-Zentrum Potsdam Deutsches GeoForschungsZentrum GFZ +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero +# General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. diff --git a/gdeexporter/gdeexporter.py b/gdeexporter/gdeexporter.py new file mode 100644 index 0000000000000000000000000000000000000000..222e43ac8f117de56d0ccb1c14cb5bab9c7f70c9 --- /dev/null +++ b/gdeexporter/gdeexporter.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 + +# Copyright (C) 2022: +# Helmholtz-Zentrum Potsdam Deutsches GeoForschungsZentrum GFZ +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero +# General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. + +import logging +import sys + +# Add a logger printing error, warning, info and debug messages to the screen +logger = logging.getLogger() +logger.setLevel(logging.INFO) +logger.addHandler(logging.StreamHandler(sys.stdout)) + + +def main(): + """Run the gde-exporter.""" + + # Log the start of the run + logger.info("gde-exporter has started") + + # Leave the program + logger.info("gde-exporter has finished") + sys.exit() + + +if __name__ == "__main__": + main() diff --git a/setup.py b/setup.py new file mode 100644 index 0000000000000000000000000000000000000000..e8046db658d05a855bf2532c87896285b30a62d9 --- /dev/null +++ b/setup.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 + +# Copyright (C) 2022: +# Helmholtz-Zentrum Potsdam Deutsches GeoForschungsZentrum GFZ +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero +# General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. + +from setuptools import setup, find_packages + +tests_require = ["pytest"] +linters_require = ["black>=22.1.0", "pylint", "flake8"] + +setup( + name="gdeexporter", + version="0.0.1", + description="Exporter of the GDE model", + keywords="Global Dynamic Exposure, GDE, buildings, exposure model", + author="Helmholtz-Zentrum Potsdam Deutsches GeoForschungsZentrum GFZ", + license="AGPLv3+", + install_requires=["numpy"], + extras_require={ + "tests": tests_require, + "linters": linters_require, + }, + packages=find_packages(), + entry_points={"console_scripts": ["gdeexporter = gdeexporter.gdeexporter:main"]}, + python_requires=">=3.7, <3.10", +) diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..4875bf7e1587905b5d55042a1a44ec202aa33ced --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python3 + +# Copyright (C) 2022: +# Helmholtz-Zentrum Potsdam Deutsches GeoForschungsZentrum GFZ +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero +# General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. diff --git a/tests/test_gdeexporter.py b/tests/test_gdeexporter.py new file mode 100644 index 0000000000000000000000000000000000000000..05a70f7565fd3d9ef13a45c6cb48eb14af7d1b1f --- /dev/null +++ b/tests/test_gdeexporter.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 + +# Copyright (C) 2022: +# Helmholtz-Zentrum Potsdam Deutsches GeoForschungsZentrum GFZ +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero +# General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. + +import logging + +logger = logging.getLogger() + + +def test_main(): + pass