Skip to content

Commit 4d31c66

Browse files
committed
10.01.05: Default Interpreter for VS Code, allocation fix, F5 note, #als
1 parent 200a80f commit 4d31c66

File tree

20 files changed

+108
-69
lines changed

20 files changed

+108
-69
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@ There are a few articles that provide some orientation to API Logic Server:
242242

243243
### Change Log
244244

245+
01/07/2024 - 10.01.05: Default Interpreter for VS Code, Allocation fix, F5 note, #als signposts
246+
245247
01/03/2024 - 10.01.00: Quoted col names, Default Interpreter for VS Code
246248

247249
12/21/2023 - 10.00.01: Fix < Python 3.11

api_logic_server_cli/api_logic_server.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
Called from api_logic_server_cli.py, by instantiating the ProjectRun object.
1313
'''
1414

15-
__version__ = "10.01.04"
15+
__version__ = "10.01.05"
1616
recent_changes = \
1717
f'\n\nRecent Changes:\n' +\
18-
"\t01/07/2024 - 10.01.04: Default Interpreter for VS Code, allocation fix, F5 note \n"\
18+
"\t01/07/2024 - 10.01.05: Default Interpreter for VS Code, allocation fix, F5 note, #als \n"\
1919
"\t01/03/2024 - 10.01.00: Quoted col names \n"\
2020
"\t12/21/2023 - 10.00.01: Fix < Python 3.11 \n"\
2121
"\t12/19/2023 - 10.00.00: Kafka pub/sub, Fix MySQL CHAR/String, list/hash/set types \n"\
@@ -341,23 +341,22 @@ def copy_md(project: 'ProjectRun', from_doc_file: str, to_project_file: str = "R
341341

342342

343343

344-
def create_nw_tutorial(project_name, api_logic_server_dir_str):
345-
""" copy tutorial from docs, and link to it from readme.md
346-
347-
1. prototype/nw/readme.md is the short preamble to "go see tutorial"
348-
349-
2. append the standard readme
344+
def create_nw_tutorial_and_readme(project: 'ProjectRun'):
345+
""" append standard readme to nw readme, and copy Tutorial from docs
350346
351347
Alert: 2 copies of the Tutorial:
352348
* ~/dev/ApiLogicServer/api_logic_server_cli/prototypes/nw/Tutorial.md
353349
* ~/dev/Org-ApiLogicServer/Docs/docs/Tutorial.md
354-
* cli version is master -->
350+
* docs version is master -->
355351
* cp api_logic_server_cli/project_prototype_nw/Tutorial.md ../Org-ApiLogicServer/Docs/docs/Tutorial.md
356352
"""
357353

358-
project_readme_file_path = project_name + '/readme.md' # brief 'go read tutorial' - add std readme
359-
standard_readme_file_path = str(Path(api_logic_server_dir_str).\
360-
joinpath('prototypes/base').joinpath("readme.md"))
354+
copy_md(project = project,
355+
from_doc_file="Tutorial.md",
356+
to_project_file='Tutorial.md')
357+
358+
project_readme_file_path = project.project_directory + '/readme.md' # brief 'go read tutorial' - add std readme
359+
standard_readme_file_path = project.api_logic_server_dir_path.joinpath('prototypes/base').joinpath("readme.md")
361360
with open(project_readme_file_path, 'a') as project_readme_file:
362361
with open(standard_readme_file_path) as standard_readme_file:
363362
project_readme_file.write(standard_readme_file.read())
@@ -428,11 +427,11 @@ def create_project_and_overlay_prototypes(project: 'ProjectRun', msg: str) -> st
428427
f'Suggestions:\n'
429428
f'.. Verify the --project_name argument\n'
430429
f'.. If you are using Docker, verify the -v argument\n\n')
430+
431431
if project.nw_db_status in ["nw", "nw+"]:
432432
log.debug(".. ..Copying nw customizations: logic, custom api, readme, tests, admin app")
433433
project.add_nw_customizations(do_security=False, do_show_messages=False)
434434

435-
436435
if project.nw_db_status in ["nw+"]:
437436
log.debug(".. ..Copy in nw+ customizations: readme, perform_customizations")
438437
nw_dir = (Path(api_logic_server_dir_str)).\
@@ -1206,7 +1205,7 @@ def add_nw_customizations(self, do_show_messages: bool = True, do_security: bool
12061205
12071206
2. Deep copy project_prototype_nw (adds logic)
12081207
1209-
3. Create readme files: Tutorial, api/integration_defs/readme.md
1208+
3. Create readme files: Tutorial (copy_md), api/integration_defs/readme.md
12101209
12111210
Args:
12121211
"""
@@ -1222,7 +1221,7 @@ def add_nw_customizations(self, do_show_messages: bool = True, do_security: bool
12221221
joinpath('prototypes/nw') # PosixPath('/Users/val/dev/ApiLogicServer/ApiLogicServer-dev/org_git/ApiLogicServer-src/api_logic_server_cli/prototypes/nw')
12231222
recursive_overwrite(nw_path, self.project_directory) # '/Users/val/dev/ApiLogicServer/ApiLogicServer-dev/org_git/tutorial/1. Instant_Creation'
12241223

1225-
create_nw_tutorial(self.project_directory, str(self.api_logic_server_dir_path))
1224+
create_nw_tutorial_and_readme(project = self)
12261225

12271226
copy_md(project = self,
12281227
from_doc_file="Sample-Integration.md",

api_logic_server_cli/prototypes/base/api/customize_api.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,16 @@
1111
app_logger = logging.getLogger(__name__)
1212

1313
def expose_services(app, api, project_dir, swagger_host: str, PORT: str):
14-
""" Customize API - new end points for services
14+
""" #als: Customize API - new end points for services
1515
1616
Brief background: see readme_customize_api.md
17+
18+
Your Code Goes Here
1719
1820
"""
1921

2022
app_logger.debug("api/customize_api.py - expose custom services")
2123

22-
#########################
23-
# Define custom apis here
24-
#########################
25-
2624
@app.route('/hello_world')
2725
def hello_world(): # test it with: http://api_logic_server_host:api_logic_server_port/hello_world?user=ApiLogicServer
2826
"""

api_logic_server_cli/prototypes/base/config.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@
99
import socket
1010
import json
1111

12-
# for complete flask_sqlachemy config parameters and session handling,
13-
# read: file flask_sqlalchemy/__init__.py AND flask/config.py
1412
'''
13+
#als: configuration settings
14+
15+
For complete flask_sqlachemy config parameters and session handling,
16+
see: file flask_sqlalchemy/__init__.py AND flask/config.py
17+
1518
app.config.setdefault('SQLALCHEMY_DATABASE_URI', 'sqlite:///:memory:')
1619
app.config.setdefault('SQLALCHEMY_BINDS', None)
1720
app.config.setdefault('SQLALCHEMY_NATIVE_UNICODE', None)

api_logic_server_cli/prototypes/base/database/customize_models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@
1111
and preserve customizations over iterations (regenerations of models.py).
1212
1313
Called from models.py (classes describing schema, per introspection).
14+
15+
Your Code Goes Here
1416
"""

api_logic_server_cli/prototypes/base/devops/docker-image/env.list

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# these values override the Config values, and the CLI arguments
22
# the values below are for testing - uncomment and view them on console log on server start
3+
# #als: configure environment variables
34

45
# ip to which flask will be bound (default: 0.0.0.0)
56
# APILOGICPROJECT_FLASK_HOST=flask-host-e

api_logic_server_cli/prototypes/base/integration/kafka/kafka_consumer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ def kafka_consumer(safrs_api: safrs.SAFRSAPI = None):
4949

5050
logger.debug(f'Kafka Listener thread activated {bus}')
5151

52-
''' Define topic handlers here, e.g.
52+
''' Your Code Goes Here
53+
54+
Define topic handlers here, e.g.
5355
5456
@bus.handle('order_shipping')
5557
def order_shipping(msg: object, safrs_api: safrs.SAFRSAPI):

api_logic_server_cli/prototypes/base/logic/declare_logic.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
app_logger = logging.getLogger(__name__)
1212

1313
def declare_logic():
14-
''' Declarative multi-table derivations and constraints, extensible with Python.
15-
14+
''' Declarative multi-table derivations and constraints, extensible with Python.
15+
1616
Brief background: see readme_declare_logic.md
1717
18-
Use code completion (Rule.) to declare rules here:
18+
Your Code Goes Here - Use code completion (Rule.) to declare rules
1919
'''
2020

2121
def handle_all(logic_row: LogicRow): # OPTIMISTIC LOCKING, [TIME / DATE STAMPING]

api_logic_server_cli/prototypes/base/readme.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@ To run your project, the system requires various runtime systems for data access
2323

2424
Setup your Python environment, according to whether you did a *local install*, or *Docker*. Choose the appropriate section, then run.
2525

26+
API Logic Server CLI provides commands you can use to ugrade your project, e.g., to add security. Discover the CLI commands with `ApiLogicServer`.
27+
2628
&nbsp;
2729

2830
## Establish Your Python Environment - Local Install
2931

30-
VSCode projects automatically use installed API Logic Server `venv`, so this step is not required until you want to create a local `venv` for additional packages.
32+
> VSCode projects automatically use installed API Logic Server `venv`, so this step is ***not required*** until you want to create a local `venv` for additional packages.
3133
32-
You `requirements.txt` has already been created, so...
34+
Your `requirements.txt` has already been created, so...
3335

3436
```bash title="Install API Logic Server in a Virtual Environment"
3537
python -m venv venv # may require python3 -m venv venv
@@ -43,8 +45,6 @@ Notes:
4345

4446
* If using SqlServer, install `pyodbc`. Not required for docker-based projects. For local installs, see the [Quick Start](https://apilogicserver.github.io/Docs/Install-pyodbc/).
4547

46-
* If you are creating multiple projects, you may wish to use a [Shared venv](https://apilogicserver.github.io/Docs/Project-Env/).
47-
4848
&nbsp;
4949

5050
## Establish Your Python Environment - Docker
@@ -93,6 +93,8 @@ the created API, Logic and Web App.
9393

9494
Please see the `nw` sample for examples of typical customizations. You can open it in GitHub (use Shift + "." to view in project mode) - [click here](https://github.com/ApiLogicServer/demo).
9595

96+
Search for `Your Code Goes Here`. Key files summarized below:
97+
9698
| Directory | Usage | Key Customization File | Typical Customization |
9799
|:-------------- |:------------------------------|:-----------------------------------|:--------------------------------------------------------------------------------------|
98100
| ```api``` | **JSON:API**<br>*Ready to Run* | ```api/customize_api.py``` | Add new end points / services |

api_logic_server_cli/prototypes/base/security/declare_security.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@
99
app_logger = logging.getLogger(__name__)
1010

1111
"""
12-
1312
First, Activate Security: https://apilogicserver.github.io/Docs/Security-Activation/
1413
1514
Then, Declare Security here: https://apilogicserver.github.io/Docs/Security-Authorization/
1615
1716
See documentation: https://apilogicserver.github.io/Docs/Security-Overview/
1817
1918
Security is invoked on server start (api_logic_server_run), per activation in `config.py`
19+
20+
Your Code Goes Here
2021
"""

0 commit comments

Comments
 (0)