Skip to content

Commit

Permalink
Merge pull request #23 from internetofwater/dev-tooling
Browse files Browse the repository at this point in the history
Major re-write/re-org
  • Loading branch information
gzt5142 authored Nov 12, 2024
2 parents aa1abf2 + e91a9d0 commit 3f0b038
Show file tree
Hide file tree
Showing 104 changed files with 13,686 additions and 4,640 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ share/python-wheels/
.installed.cfg
*.egg
MANIFEST
public/

# PyInstaller
# Usually these files are written by a python script from a template
Expand All @@ -49,6 +50,7 @@ coverage.xml
*.py,cover
.hypothesis/
.pytest_cache/
.ruff_cache/
cover/

# Translations
Expand Down Expand Up @@ -158,3 +160,8 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

.vscode/

secret.env
dist/
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"python.testing.pytestArgs": [
"."
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
25 changes: 18 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
# Network Linked Data Index Contribution Guidelines
# NLDI Contribution Guidelines

First, Thank you for considering a contribution. This project is a community resource, its success is contingent on your contributions.
First, Thank you for considering a contribution. This project is
a community resource, its success is contingent on your contributions.

## Linked Data Contribution

Linked data contributions are made through a configuration of the [NLDI Crawler](https://github.com/internetofwater/nldi-crawler#contributing) in the [NLDI Database](https://github.com/internetofwater/nldi-db/blob/master/liquibase/changeLogs/nldi/nldi_data/update_crawler_source/crawler_source.tsv).
Linked data contributions are made through a configuration of the
[NLDI Crawler](https://github.com/internetofwater/nldi-crawler#contributing) in the
[NLDI Database](https://github.com/internetofwater/nldi-db/blob/master/liquibase/changeLogs/nldi/nldi_data/update_crawler_source/crawler_source.tsv).

For support in this process, open [an issue in the NLDI-Services](https://github.com/internetofwater/nldi-services/issues) repository.
For support in this process, open
[an issue in the NLDI-Services](https://github.com/internetofwater/nldi-services/issues) repository.

## Code Contribution

Contribution to the overall project are more than welcome. Please open an issue describing the goal of your contribution in the [NLDI-Services](https://github.com/internetofwater/nldi-services/issues) repository prior to opening a pull request.
Contribution to the overall project are more than welcome. Please open
an issue describing the goal of your contribution in the
[NLDI-Services](https://github.com/internetofwater/nldi-services/issues)
repository prior to opening a pull request.

Contributions may ultimately reside in the services, database, or crawler repositories. All pull requests should link back to the issues in the services repository to ensure we track contributions in a single location.
Contributions may ultimately reside in the services, database, or crawler
repositories. All pull requests should link back to the issues in the
services repository to ensure we track contributions in a single location.

## Ideas and Bug Reports

For ideas for new features and bug reports, please register them as issues in the [NLDI-Services](https://github.com/internetofwater/nldi-services/issues) repository.
For ideas for new features and bug reports, please register them as
issues in the [NLDI-Services](https://github.com/internetofwater/nldi-services/issues)
repository.
78 changes: 24 additions & 54 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,71 +1,41 @@
# =================================================================
# SPDX-License-Identifier: CC0
# See the full copyright notice in LICENSE.md
#
# Author: Benjamin Webb <[email protected]>
#
# Copyright (c) 2023 Benjamin Webb
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# =================================================================

FROM python:3.11-alpine as build
FROM python:3.12-alpine AS build
# NOTE: This is a multi-stage build.... the first stage is for building the
# compiled dependencies, which requires gcc and other dev pipeline tools.
# Once those binaries are built, we don't need the build tools anymore, so
# we can copy the compiled binaries to a new image (without dev tooling).
# This keeps the final image smaller and more secure.

LABEL maintainer="Benjamin Webb <[email protected]>"
LABEL description="Docker image for the NLDI API"
# ENV settings
ENV TZ=${TZ} \
# ENV TZ=${TZ} \

ENV \
LANG=${LANG} \
PIP_NO_CACHE_DIR=1

# Install operating system dependencies
RUN \
apk update && apk add curl build-base libpq-dev proj-util proj-dev gdal-dev geos-dev

COPY ./requirements-docker.txt ./requirements.txt ./req/
apk update && \
apk add --no-cache curl build-base libpq-dev


RUN pip install --no-cache-dir -r ./req/requirements.txt
RUN pip install --no-cache-dir -r ./req/requirements-docker.txt



FROM python:3.11-alpine as nldi
RUN apk update && apk add --no-cache gcompat libstdc++ curl proj-util libpq-dev
ADD . /nldi
WORKDIR /nldi
COPY --from=build /usr/local/lib/python3.11/site-packages/ /usr/local/lib/python3.11/site-packages/
COPY --from=build /usr/lib/libgdal.so.35 /usr/lib/libgeos.so.3.12.2 /usr/lib/libproj.so.25 /usr/lib/libgeos_c.so.1.18.2 /usr/lib/
COPY --from=build /usr/local/bin/pygeoapi /usr/local/bin/gunicorn /usr/local/bin/

RUN \
ln -s /usr/lib/libgdal.so.35 /usr/lib/libgdal.so \
&& ln -s /usr/lib/libgeos.so.3.12.2 /usr/lib/libgeos.so \
# && ln -s /usr/lib/libproj.so.25 /usr/lib/libproj.so \
&& ln -s /usr/lib/libgeos_c.so.1.18.2 /usr/lib/libgeos_c.so.1 \
&& ln -s /usr/lib/libgeos_c.so.1 /usr/lib/libgeos_c.so
RUN pip install --no-cache-dir . && rm -rf /root/.cache/pip
RUN pip install --no-cache-dir pyyaml

RUN pip install -e . \
&& cp /nldi/docker/default.source.yml /nldi/local.source.yml \
&& cp /nldi/docker/pygeoapi.config.yml /nldi/pygeoapi.config.yml \
&& cp /nldi/docker/entrypoint.sh /entrypoint.sh
# This will be the final image:
FROM python:3.12-alpine AS nldi
ADD . /nldi
WORKDIR /nldi
COPY --from=build /usr/local/lib/python3.12/site-packages/ /usr/local/lib/python3.12/site-packages/
COPY --from=build /usr/local/bin/gunicorn /usr/local/bin/
COPY --from=build /usr/lib/libpq.so.5 /usr/lib/
RUN mv /nldi/tests/data/sources_config.yml /nldi/local.source.yml

ENTRYPOINT ["/entrypoint.sh"]
ENTRYPOINT ["/nldi/start_nldi_server.sh"]
116 changes: 0 additions & 116 deletions LICENSE

This file was deleted.

70 changes: 70 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# LICENSE

Unless otherwise noted, This project is in the public domain in the United
States. It is licenced under CC0 1.0 Universal (see <http://creativecommons.org/publicdomain/zero/1.0/>).

## CC0 1.0 Universal Summary

This is a human-readable summary of the Legal Code ([read the full text](https://creativecommons.org/publicdomain/zero/1.0/legalcode)).

### No Copyright

The person who associated a work with this deed has dedicated the work to
the public domain by waiving all of his or her rights to the work worldwide
under copyright law, including all related and neighboring rights, to the
extent allowed by law.

You can copy, modify, distribute and perform the work, even for commercial
purposes, all without asking permission.

### Other Information

In no way are the patent or trademark rights of any person affected by CC0,
nor are the rights that other persons may have in the work or in how the
work is used, such as publicity or privacy rights.

Unless expressly stated otherwise, the person who associated a work with
this deed makes no warranties about the work, and disclaims liability for
all uses of the work, to the fullest extent permitted by applicable law.
When using or citing the work, you should not imply endorsement by the
author or the affirmer.

## Prior Work

### nldi-py

This software is derived from the original `nldi-py` project, which bears
the following copyright notice:

```text
# =================================================================
#
# Author: Benjamin Webb <[email protected]>
#
# Copyright (c) 2023 Benjamin Webb
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# =================================================================
```


4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# NLDI
Python package for Network Linked Data Index

Python package for Network Linked Data Index (NLDI) API.

Loading

0 comments on commit 3f0b038

Please sign in to comment.