Skip to content

Commit b6ab54d

Browse files
author
EliuX
committed
fix: Refactor time_tracker_events for deployment #101
1 parent 6d887ea commit b6ab54d

File tree

17 files changed

+32
-23
lines changed

17 files changed

+32
-23
lines changed

.DS_Store

-6 KB
Binary file not shown.

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ automatically [pip](https://pip.pypa.io/en/stable/) as well.
4646
* `prod`: For anything deployed
4747
4848
49-
Remember to do it with Python 3.
49+
Remember to do it with Python 3.
50+
51+
Bear in mind that the requirements for `time_tracker_events`, must be located on its local requirements.txt, by
52+
[convention](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-python#folder-structure).
5053
5154
- Run `pre-commit install`. For more details, check out Development > Git hooks.
5255
@@ -134,6 +137,16 @@ following notes regarding to the manipulation of the data from and towards the A
134137
- The [recommended](https://docs.microsoft.com/en-us/azure/cosmos-db/working-with-dates#storing-datetimes) format for
135138
DateTime strings in Azure Cosmos DB is `YYYY-MM-DDThh:mm:ss.fffffffZ` which follows the ISO 8601 **UTC standard**.
136139

140+
The Azure function project `time_tracker_events` also have some constraints to have into account. It is recommended that
141+
you read the [Azure Functions Python developer guide](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-python#folder-structure).
142+
143+
If you require to deploy `time_tracker_events` from your local machine to Azure Functions, you can execute:
144+
145+
```bash
146+
func azure functionapp publish time-tracker-events --build local
147+
```
148+
149+
137150
## Development
138151

139152
### Git hooks
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# requirements/time_tracker_events/prod.txt
22

3-
# Azure Functions library
4-
azure-functions
5-
3+
# Include the requirements of that folder, required there by convention
4+
-r ../../time_tracker_events/requirements.txt

tests/time_tracker_events/shared_code/__init__.py

Whitespace-only changes.

tests/time_tracker_events/test_handle_events_trigger.py renamed to tests/time_tracker_events/shared_code/test_handle_events_trigger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import azure.functions as func
22
from faker import Faker
33

4-
from time_tracker_events.handle_events_trigger import main as main_handler
4+
from time_tracker_events.shared_code.handle_events_trigger import main as main_handler
55

66
fake = Faker()
77

time_tracker_api/time_entries/time_entries_namespace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def delete(self, id):
163163

164164
@ns.route('/<string:id>/stop')
165165
@ns.response(HTTPStatus.NOT_FOUND, 'Running time entry not found')
166-
@ns.response(HTTPStatus.UNPROCESSABLE_ENTITY, '"The specified time entry is already stopped')
166+
@ns.response(HTTPStatus.UNPROCESSABLE_ENTITY, 'The specified time entry is already stopped')
167167
@ns.param('id', 'The unique identifier of a running time entry')
168168
class StopTimeEntry(Resource):
169169
@ns.doc('stop_time_entry')

time_tracker_events/.funcignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
1+
run.sh
2+
.vscode

time_tracker_events/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ venv.bak/
4040
# Byte-compiled / optimized / DLL files
4141
__pycache__/
4242
*.py[cod]
43-
*$py.class
43+
*$py.class
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from ..handle_events_trigger import main as handler
1+
from ..shared_code import handle_events_trigger
22

3-
main = handler
3+
main = handle_events_trigger.main
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from ..handle_events_trigger import main as handler
1+
from ..shared_code.handle_events_trigger import main as handler
22

33
main = handler

0 commit comments

Comments
 (0)