Skip to content

Commit

Permalink
Merge pull request #48 from kbevers/prep-1.2
Browse files Browse the repository at this point in the history
Preparation for 1.2.0 release
  • Loading branch information
kbevers authored Oct 12, 2022
2 parents ae8cce0 + aabf4c6 commit 57bc0a7
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 11 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ COPY /README.md /webproj/README.md
COPY /app/main.py /app/main.py

RUN pip install --upgrade pip
RUN pip install "pyproj>=3.3.0,<3.4.0"
RUN pip install flask-restx flask-cors Werkzeug
RUN pip install pyproj
RUN pip install flask-restx flask-cors
run pip install "Werkzeug>=2.1.0,<2.2.0"
RUN pip install /webproj
RUN pyproj sync --source-id dk_sdfe
38 changes: 37 additions & 1 deletion HOWTORELEASE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,42 @@
# Release instructions for WEBPROJ

(insert GitHub release instructions here)
1. Checkout maintenance branch

If issueing a patch release a maintenance branch should already exists. Check it out:

> git checkout 1.1
and ensure sure that all relevant commits have been backported to the maintenance branch in question.

If a major or minor version release is being prepared, a new maintenance branch based on the
master branch needs to be created:

> git checkout -b 1.1
2. Tag the latest commit on the the maintenance branch with the new version number

On the maintenance branch the latest commit can now be tagged with the version number, e.g.:

> git tag 1.1.1
> git push --tags
3. Close the GitHub milestone for the version to be released

4. Write release notes on GitHub based on the tag created in step 2

5. Bump version number

We update the version number right away in preparation for the next release. This way we can distinguish
between released versions and to-be-released versions easily. If we see an unrelease version number we know
that we are using a development version of WEBPROJ.

`version` in `webproj\api.py` needs to be updated. After a patch release the version number is only updated
on the maintenance branch. After a major or minor release it should be updated on the master branch and subsequently
cherry-picked to the maintenance branch.

6. Deploy in production

After a release WEBPROJ needs to be deployed in Jenkins.

### Update docs on docs.dataforsyningen.dk
WEBPROJ generates Swagger documentation through flask_restx, and Dataforsyningen uses the newer OpenAPI spec, so for now we manually convert to OpenAPI and tweak the result.
Expand Down
2 changes: 1 addition & 1 deletion environment-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ channels:
dependencies:
- python=3.9
- pip>=20.0
- werkzeug>=1.0
- werkzeug=2.1
- flask>=1.0
- flask-restx>=0.1.1
- flask-cors>=3.0
Expand Down
2 changes: 1 addition & 1 deletion environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ channels:
dependencies:
- python=3.9
- pip>=20.0
- werkzeug>=1.0
- werkzeug=2.1
- flask>=1.0
- flask-restx>=0.1.1
- flask-cors>=3.0
Expand Down
12 changes: 12 additions & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys
import re
import json
import pprint

Expand Down Expand Up @@ -372,3 +373,14 @@ def test_crs_units(api_from_v1_2):
for srid, crsinfo in testdata.items():
api_entry = f"/{api_from_v1_2}/crs/{srid}"
_assert_key_value_set(api_entry, crsinfo)


def test_info(api_from_v1_2):
"""
Test that the info entrypoint returns sensible values.
"""
response = _get_and_decode_response(f"/{api_from_v1_2}/info/")

for software, version_number in response.items():
print(software, version_number)
assert re.match(r"^\d+\.\d+\.\d+$", version_number)
31 changes: 25 additions & 6 deletions webproj/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from webproj.utils import IntFloatConverter

version = "1.1.0"
version = "1.2.0"

if "WEBPROJ_LIB" in os.environ:
pyproj.datadir.append_data_dir(os.environ["WEBPROJ_LIB"])
Expand All @@ -25,14 +25,21 @@
app,
version=version,
title="WEBPROJ",
description="## API til koordinattransformationer\n\nAPIet "
"__WEBPROJ__ giver adgang til at transformere "
"multidimensionelle koordinatsæt. \n\nTil adgang "
"benyttes Dataforsyningens brugeradgang som ved andre "
"tjenester.\n\n[Versionshistorik](/webproj.txt)",
description=(
"## API til koordinattransformationer"
"\n\n"
"API'et __WEBPROJ__ giver adgang til at transformere "
"multidimensionelle koordinatsæt."
"\n\n"
"Til adgang benyttes Dataforsyningens brugeradgang som ved andre "
"tjenester."
"\n\n"
"[Versionshistorik](/webproj.txt)"
),
terms_url="https://dataforsyningen.dk/Vilkaar",
contact="[email protected]",
license="MIT License",
license_url="https://raw.githubusercontent.com/SDFIdk/WEBPROJ/master/LICENSE",
)

_DATA = Path(__file__).parent / Path("data.json")
Expand Down Expand Up @@ -377,3 +384,15 @@ def get(self, src, dst, v1, v2, v3=None, v4=None):
abort(404, message=error)

return {"v1": v1, "v2": v2, "v3": v3, "v4": v4}


@api.route("/v1.2/info/")
class Info(Resource):
def get(self):
"""
Retrieve information about the running instance of WEBPROJ and it's constituent components.
"""
return {
"webproj_version": version,
"proj_version": pyproj.__proj_version__,
}

0 comments on commit 57bc0a7

Please sign in to comment.