Skip to content

Commit a14034e

Browse files
Merge pull request #59 from Geode-solutions/next
Next
2 parents 8c2a4a9 + fd7bbb9 commit a14034e

19 files changed

+665
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ venv
44
output
55
__pycache__
66
.vscode
7+
uploads

CHANGELOG.md

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,125 @@
22

33

44

5+
## v3.2.0-rc.10 (2023-12-20)
6+
7+
### Fix
8+
9+
* fix(Package): update pyproject.toml ([`8982a04`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/8982a0450dc3324f229cc039eaa2bd655675675a))
10+
11+
* fix(Package): remove MANIFEST.in & namespace ([`f7981cb`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/f7981cb860cf244c0e0606c3cb60621bc5d34c35))
12+
13+
### Unknown
14+
15+
* Merge branch 'next' of https://github.com/Geode-solutions/OpenGeodeWeb-Back into next ([`ccab4e0`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/ccab4e0ce355e723efea351ec742aaa3363cac27))
16+
17+
18+
## v3.2.0-rc.9 (2023-12-20)
19+
20+
### Fix
21+
22+
* fix(Package): test MANIFEST.in ([`0d36b17`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/0d36b175db851ff5a9b8bee96ca1329d3e0c38fc))
23+
24+
### Unknown
25+
26+
* Merge branch 'next' of https://github.com/Geode-solutions/OpenGeodeWeb-Back into next ([`2ee5caf`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/2ee5cafb5288faebfb7698f90c7d86481d7bc728))
27+
28+
29+
## v3.2.0-rc.8 (2023-12-20)
30+
31+
### Fix
32+
33+
* fix(Package): revert pyproject.toml ([`982b1a7`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/982b1a78ae352037e3002c31883b38178f297c75))
34+
35+
36+
## v3.2.0-rc.7 (2023-12-20)
37+
38+
### Fix
39+
40+
* fix(Package): test namespace
41+
remove MANIFEST.in ([`798ec45`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/798ec450719f3cf3defa151a00beaffd177adf7d))
42+
43+
44+
## v3.2.0-rc.6 (2023-12-20)
45+
46+
### Fix
47+
48+
* fix(Package): include schemas folder ([`3197598`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/3197598f4904e6778d634654ab16848ae53c5aa4))
49+
50+
51+
## v3.2.0-rc.5 (2023-12-20)
52+
53+
### Fix
54+
55+
* fix(Package): MANIFEST.in ([`4dfafaf`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/4dfafafbdca4e01a74384a5ca94fc07064a672e2))
56+
57+
58+
## v3.2.0-rc.4 (2023-12-20)
59+
60+
### Fix
61+
62+
* fix(Package): upload json ([`9b78361`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/9b78361f66fc5a43e01daa6424af0bf8d42ddebc))
63+
64+
### Unknown
65+
66+
* test ([`98e3457`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/98e3457c3f1f2c33499169bb777220562ebd8fb6))
67+
68+
* fix path ([`3d1076b`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/3d1076b0334f71ceda7fe03ef3f6171da585bdf5))
69+
70+
* test folder path ([`f357f18`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/f357f188375048f6e4a18a9df02bbb0bd396eafe))
71+
72+
73+
## v3.2.0-rc.3 (2023-12-20)
74+
75+
### Fix
76+
77+
* fix(Package): include json ([`d6c5e15`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/d6c5e15f77f0a6bcb279d84d23afa0bf9fc72d75))
78+
79+
### Unknown
80+
81+
* Merge pull request #58 from Geode-solutions/include-json
82+
83+
fix(Package): include json ([`94d1d6d`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/94d1d6d86a50d1df751b841176cba9b4fe8ba525))
84+
85+
86+
## v3.2.0-rc.2 (2023-12-20)
87+
88+
### Fix
89+
90+
* fix(json files): explicitly export json files ([`678269e`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/678269e9a5fcf9d8737bc00438f38f07d3811807))
91+
92+
### Unknown
93+
94+
* Merge pull request #57 from Geode-solutions/fix/json_imports
95+
96+
fix(json files): explicitly export json files ([`9b754cd`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/9b754cd76ce74758f037d9f52ad94eeb44094810))
97+
98+
99+
## v3.2.0-rc.1 (2023-12-20)
100+
101+
### Fix
102+
103+
* fix(tests): update failing tests ([`e70acfe`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/e70acfeda21f2fffc61700f83f34ca7f81829ae0))
104+
105+
### Unknown
106+
107+
* Merge pull request #50 from Geode-solutions/feat/blueprint_routes
108+
109+
Feat/blueprint_routes ([`925db1b`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/925db1b0f6f09011625bdc8a095723008e12ff14))
110+
111+
* update gitignore ([`51c765e`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/51c765e88767aaec216da2f6b67e0016e7fa63bd))
112+
113+
* Merge branch 'feat/blueprint_routes' of https://github.com/Geode-solutions/OpenGeodeWeb-Back into feat/blueprint_routes ([`95be868`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/95be868f13b6dae9dee5d0d5d400f4ca7e5c534d))
114+
115+
* is_loadable ([`bfc6ba5`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/bfc6ba58dc9f4f12e8d58898036faf3f465ff181))
116+
117+
* pull from website-back ([`fd33bc9`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/fd33bc9502f48ebfe7aa5e8a4ab8815b87a3ddb8))
118+
119+
* Merge branch 'master' of https://github.com/Geode-solutions/OpenGeodeWeb-Back into feat/blueprint_routes ([`57ca416`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/57ca41631eb06eb84c612ae5c47c76467e1af809))
120+
121+
* ([`945e092`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/945e092d88f82c6aa18d99caeb2661ac8135ee76))
122+
123+
5124
## v3.1.0 (2023-12-19)
6125

7126
### Unknown
@@ -81,6 +200,17 @@ Revert "Feat/is loadable" ([`d0f03a7`](https://github.com/Geode-solution
81200

82201
BREAKING CHANGE : arg extension -> file_absolute_path ([`4af7868`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/4af78686c761c1abba86a02df39fc9a75e40e151))
83202

203+
* feat(dependencies): ass flask-cors ([`35e5c30`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/35e5c30455d117e99325a21722b3fe82ce054df9))
204+
205+
* feat(routes): add tests ([`28df816`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/28df816d3c3c1e9456dac092ea94da63d45c43f5))
206+
207+
* feat(routes): add new blueprint with refactored routes ([`210ec38`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/210ec3876283d8aa2c8408fa4b7a5dab6a41894d))
208+
209+
* feat(flask): add flask app & config
210+
edit pytest config ([`15ad3cf`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/15ad3cfe42dcad747acdf470aae9d102a9e2c90d))
211+
212+
* feat(routes): add schemas ([`3afc79f`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/3afc79f6c82960163cbc18c771cfbb3b55e24e0c))
213+
84214
### Unknown
85215

86216
* Merge pull request #49 from Geode-solutions/feat/is_loadable
@@ -89,6 +219,15 @@ Feat/is loadable ([`3ee5c1e`](https://github.com/Geode-solutions/OpenGeodeWeb-Ba
89219

90220
* update requirements ([`9066879`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/9066879e7b037794bbded4184fdb29765261ebc7))
91221

222+
* integrate upload_file changes
223+
route now takes each file one by one ([`2b2807f`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/2b2807febceda5a8268533a3ed20e2da10f29cd2))
224+
225+
* tests ([`3129fe8`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/3129fe83af3ef605ec4ca5ee974eb9897df6f247))
226+
227+
* move data ([`e8fba7c`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/e8fba7c8e87fd62050029b1af7eb0dc612ab47af))
228+
229+
* update dependencies ([`6bfba1d`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/6bfba1dd22ee4f9c98c74b2b8d18653e246d66d8))
230+
92231
* Merge branch 'next' of https://github.com/Geode-solutions/OpenGeodeWeb-Back into feat/is_loadable ([`2de6600`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/2de66004cc3acf735017f7aa41d985af9871bad3))
93232

94233
* update tests & deps ([`4fc793c`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/4fc793cdc1f791f30266706bfc05493f0ef87978))

app.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
""" Packages """
2+
import os
3+
4+
import flask
5+
import flask_cors
6+
from werkzeug.exceptions import HTTPException
7+
8+
from werkzeug.exceptions import HTTPException
9+
10+
from src.opengeodeweb_back.routes import blueprint_routes
11+
12+
13+
""" Global config """
14+
app = flask.Flask(__name__)
15+
16+
""" Config variables """
17+
FLASK_DEBUG = True if os.environ.get("FLASK_DEBUG", default=None) == "True" else False
18+
19+
if FLASK_DEBUG == False:
20+
app.config.from_object("config.ProdConfig")
21+
else:
22+
app.config.from_object("config.DevConfig")
23+
24+
25+
PORT = int(app.config.get("PORT"))
26+
ORIGINS = app.config.get("ORIGINS")
27+
SSL = app.config.get("SSL")
28+
29+
flask_cors.CORS(app, origins=ORIGINS)
30+
app.register_blueprint(
31+
blueprint_routes.routes,
32+
url_prefix="/",
33+
name="blueprint_routes",
34+
)
35+
36+
37+
@app.errorhandler(HTTPException)
38+
def handle_exception(e):
39+
response = e.get_response()
40+
response.data = flask.json.dumps(
41+
{
42+
"code": e.code,
43+
"name": e.name,
44+
"description": e.description,
45+
}
46+
)
47+
response.content_type = "application/json"
48+
return response
49+
50+
51+
# ''' Main '''
52+
if __name__ == "__main__":
53+
print(f"Python is running in {FLASK_DEBUG} mode")
54+
app.run(debug=FLASK_DEBUG, host="0.0.0.0", port=PORT, ssl_context=SSL)

config.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
""" Flask configuration """
2+
import os
3+
4+
5+
class Config(object):
6+
FLASK_DEBUG = os.environ.get("FLASK_DEBUG", default=False)
7+
ID = os.environ.get("ID", default=None)
8+
PORT = "5000"
9+
CORS_HEADERS = "Content-Type"
10+
UPLOAD_FOLDER = "./uploads"
11+
WORKFLOWS_DATA_FOLDER = "./data_workflows/"
12+
LOCK_FOLDER = "./lock/"
13+
TIME_FOLDER = "./time/"
14+
15+
16+
class ProdConfig(Config):
17+
SSL = None
18+
ORIGINS = ["*"]
19+
MINUTES_BEFORE_TIMEOUT = "5"
20+
SECONDS_BETWEEN_SHUTDOWNS = "150"
21+
DATA_FOLDER = "/data/"
22+
23+
24+
class DevConfig(Config):
25+
SSL = None
26+
ORIGINS = "http://localhost:3000"
27+
MINUTES_BEFORE_TIMEOUT = "1000"
28+
SECONDS_BETWEEN_SHUTDOWNS = "60"
29+
DATA_FOLDER = "./data/"

pyproject.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
55

66
[project]
77
name = "OpenGeodeWeb-Back"
8-
version = "3.1.0"
8+
version = "3.2.0-rc.10"
99
dynamic = ["dependencies"]
1010
authors = [
1111
{ name="Geode-solutions", email="[email protected]" },
@@ -26,6 +26,12 @@ classifiers = [
2626
[tool.setuptools.dynamic]
2727
dependencies = {file = ["requirements.txt"]}
2828

29+
[tool.setuptools.packages.find]
30+
where = ["src"]
31+
32+
[tool.setuptools.package-data]
33+
"opengeodeweb_back.routes.schemas" = ["*.json"]
34+
2935
[tool.semantic_release]
3036
version_toml = [
3137
"pyproject.toml:project.version",

requirements.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ geode-explicit
1010
geode-implicit
1111
geode-common
1212
jsonschema
13-
flask[async]
13+
Flask[async]
14+
Flask-Cors
1415
werkzeug

requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ click==8.1.7
1717
colorama==0.4.6
1818
# via click
1919
flask[async]==3.0.0
20+
# via
21+
# -r requirements.in
22+
# flask-cors
23+
flask-cors==4.0.0
2024
# via -r requirements.in
2125
geode-background==7.4.9
2226
# via

src/opengeodeweb_back/geode_functions.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
# Standard library imports
2-
import base64
32
import os
43
import time
54
import threading
65
import uuid
6+
import zipfile
77

88
# Third party imports
99
import flask
1010
import opengeode_geosciences as og_gs
1111
import opengeode as og
1212
import pkg_resources
13-
import werkzeug
1413
from jsonschema import validate
1514
from jsonschema.exceptions import ValidationError
1615

@@ -311,7 +310,7 @@ def send_file(upload_folder, saved_files, new_file_name):
311310
mimetype = "application/octet-binary"
312311
else:
313312
mimetype = "application/zip"
314-
new_file_name = strict_file_name + ".zip"
313+
new_file_name = os.path.splitext(new_file_name)[0] + ".zip"
315314
with zipfile.ZipFile(os.path.join(upload_folder, new_file_name), "w") as zipObj:
316315
for saved_file_path in saved_files:
317316
zipObj.write(

0 commit comments

Comments
 (0)