forked from BayAreaMetro/tm2py
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix docs build fail - lots of dependencies fixing (BayAreaMetro#51)
1. Adds test docs build on github actions 2. Combines dependencies for docs and general requirements 3. Pins jinja2 version <3.10 because of deprecation of something that MkDocs uses (and sphinx) - can be considered for removal later.
- Loading branch information
Showing
70 changed files
with
6,549 additions
and
437 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Publish docs | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- develop | ||
|
||
jobs: | ||
mkdocs: | ||
name: Publish docs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Deploy docs | ||
uses: mhausenblas/mkdocs-deploy-gh-pages@master | ||
env: | ||
REQUIREMENTS: docs/requirements.txt | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# includes/excludes all rules by default | ||
default: true | ||
|
||
# 4-space list indentation works best with MkDocs | ||
MD007: | ||
indent: 4 | ||
|
||
# Remove line length limit | ||
MD013: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
# Copies test data to examples directory or a given directory as an input argument | ||
# USAGE: get_test_data <optional: directory to put test data> | ||
|
||
TEST_DATA_LOCATION=https://mtcdrive.box.com/s/3entr016e9teq2wt46x1os3fjqylfoge | ||
TEST_DATA_NAME="UnionCity" | ||
DEFAULT_DIRECTORY="examples" | ||
|
||
echo "Retreiving $TEST_DATA_NAME data from $TEST_DATA_LOCATION" | ||
|
||
if [ "$#"==0 ] | ||
then | ||
DIR=$(find . -name $DEFAULT_DIRECTORY) | ||
echo "Finding directory:" $DIR | ||
cd $DIR | ||
else | ||
OUTDIR=$1 | ||
[ ! -d $OUTDIR ] && mkdir -p $OUTDIR | ||
cd $OUTDIR | ||
echo "Moved to provided directory:" $OUTDIR | ||
fi | ||
|
||
echo "Writing to $PWD" | ||
|
||
curl $TEST_DATA_LOCATION -L -o test_data.zip | ||
unzip test_data.zip -d $TEST_DATA_NAME | ||
rm test_data.zip /y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
REM Copies test data to examples directory or a given directory as an input argument | ||
REM USAGE: get_test_data.bat Optional <directory to put test data> | ||
REM ECHO OFF | ||
|
||
SET CWD=%cd% | ||
SET TEST_DATA_LOCATION=https://mtcdrive.box.com/s/3entr016e9teq2wt46x1os3fjqylfoge | ||
REM SET TEST_DATA_NAME=UnionCity | ||
SET DEFAULT_DIRECTORY=examples | ||
|
||
ECHO "Retreiving %TEST_DATA_NAME% data from %TEST_DATA_LOCATION% | ||
|
||
SET OUTDIR=%1 | ||
if "%OUTDIR%"=="" SET OUTDIR=DEFAULT_DIRECTORY | ||
if not exist %OUTDIR% mkdir %OUTDIR% | ||
CD %OUTDIR% | ||
ECHO "Writing to %CD%" | ||
|
||
curl -i -X GET %TEST_DATA_LOCATION% -L -o test_data.zip | ||
|
||
CD %CWD% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env python | ||
|
||
import argparse | ||
|
||
from tm2py.controller import RunController | ||
|
||
def usage(): | ||
print("tm2py -s scenario.toml -m model.toml") | ||
|
||
def run(): | ||
parser = argparse.ArgumentParser(description="Main: run MTC TM2PY") | ||
|
||
parser.add_argument( | ||
"-s", "--scenario", required=True, help=r"Scenario config file path" | ||
) | ||
parser.add_argument("-m", "--model", required=True, help=r"Model config file path") | ||
|
||
args = parser.parse_args() | ||
controller = RunController([args.scenario, args.model]) | ||
controller.run() | ||
|
||
if __name__ == "__main__": | ||
run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env python | ||
import logging | ||
import os | ||
|
||
import tm2py | ||
|
||
# High-level settings | ||
MODULE_CLASS_DOC_LIST = [ | ||
("classes_components.md",[("## Components", tm2py.components, 1)]), | ||
("classes_basic.md", [("## Basic", tm2py, 1)]), | ||
("classes_config.md", [("## Config", tm2py.config, 1)]), | ||
("classes_emme.md",[("## Emme", tm2py.emme, 3) ], | ||
), | ||
] | ||
|
||
# Basic setup | ||
logger = logging.getLogger() | ||
logger.setLevel(logging.INFO) | ||
|
||
base_dir = os.path.dirname(os.path.dirname(__file__)) | ||
docs_dir = os.path.join(base_dir,"docs") | ||
logger.info(f"Using docs directory:\n {docs_dir}") | ||
|
||
# Update class diagrams (currently using defaults) | ||
|
||
logger.info("Updating class diagrams") | ||
|
||
from tm2py.utils import doc_modules | ||
|
||
for _class_diagram_md,_module_list in MODULE_CLASS_DOC_LIST: | ||
class_diagram_str = doc_modules.generate_md_class_diagram(_module_list) | ||
class_diagram_outfile = os.path.join(docs_dir,"includes","class_diagrams",_class_diagram_md) | ||
with open(class_diagram_outfile,'w') as f: | ||
f.write(class_diagram_str) | ||
logger.info(f"Updated class diagrams in:\n{class_diagram_outfile}") |
Oops, something went wrong.