Skip to content

Commit

Permalink
reorganize folder structure
Browse files Browse the repository at this point in the history
For e-mission-common to function as both a JS and Python package (compatible with npm and pip respectively), there need to be a few changes.
First, the directory that contains __init__.js needs to be the name of the Python package. We will call it `emcommon` and rename the directory accordingly.

Second, it's simpler and easier to just have the npm package at the same level as the Python package. So instead of tucking it away under the /js directory, we can keep package.json at the root level. The compiled JS files can go under a directory called `emcommon_translated_js`.

Moved all these files, updated imports, updated compile_to_js.sh, updated README.
  • Loading branch information
JGreenlee committed Apr 11, 2024
1 parent b870cf2 commit 961ea84
Show file tree
Hide file tree
Showing 25 changed files with 17 additions and 62 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ This repository uses the [Transcrypt](https://www.transcrypt.org/) library to co

## To contribute

1. Make your changes to Python code under the `src` directory.
2. Run `compile_to_js.sh` to build the JavaScript. This will produce output JS files in the `__js__` directory.
3. Commit your changes from both the `src` and `__js__` directories.
1. Make your changes to Python code under the `emcommon` directory.
2. Run `compile_to_js.sh` to build the JavaScript. This will produce output JS files in the `emcommon_translated_js` directory.
3. Commit your changes from both the `emcommon` and `emcommon_translated_js` directories.
2 changes: 1 addition & 1 deletion compile_to_js.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
transcrypt --nomin --ecom ./src/__init__.py -od ../js/__translated_src__
transcrypt --nomin --ecom ./emcommon/__init__.py -od ../emcommon_translated_js
2 changes: 1 addition & 1 deletion src/__init__.py → emcommon/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logger as Logger
import metrics.metrics_summaries as MetricsSummaries
import src.metrics.surveys.surveys_summary as SurveysSummary
import metrics.surveys.surveys_summary as SurveysSummary
import metrics.carbon.carbon_calculations as CarbonCalculations
import metrics.active_travel.active_travel_calculations as ActiveTravelCalculations
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions emcommon_translated_js/__init__.project
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"options": {"source": "./emcommon/__init__.py", "anno": false, "alimod": false, "build": false, "complex": false, "docat": false, "dassert": false, "dcheck": false, "dextex": false, "dlog": false, "dmap": false, "dnostrip": false, "dstat": false, "dtree": false, "esv": null, "ecom": true, "fcall": false, "gen": false, "iconv": false, "jscall": false, "jskeys": false, "jsmod": false, "kwargs": false, "keycheck": false, "license": false, "map": false, "nomin": true, "opov": false, "outdir": "../emcommon_translated_js", "parent": null, "run": false, "symbols": null, "sform": false, "tconv": false, "unit": null, "verbose": false, "x": null, "xreex": false, "xglobs": false, "xpath": null, "xtiny": false, "star": false}, "modules": [{"source": "/Users/jgreenle/miniconda3/lib/python3.11/site-packages/transcrypt/modules/org/transcrypt/__runtime__.py", "target": "/Users/jgreenle/openpath/e-mission-common/emcommon/../emcommon_translated_js/org.transcrypt.__runtime__.js"}, {"source": "./emcommon/__init__.py", "target": "/Users/jgreenle/openpath/e-mission-common/emcommon/../emcommon_translated_js/__init__.js"}, {"source": "./emcommon/metrics/active_travel/active_travel_calculations.py", "target": "/Users/jgreenle/openpath/e-mission-common/emcommon/../emcommon_translated_js/metrics.active_travel.active_travel_calculations.js"}, {"source": "./emcommon/metrics/active_travel/standard_met_mode_map.py", "target": "/Users/jgreenle/openpath/e-mission-common/emcommon/../emcommon_translated_js/metrics.active_travel.standard_met_mode_map.js"}, {"source": "./emcommon/logger.py", "target": "/Users/jgreenle/openpath/e-mission-common/emcommon/../emcommon_translated_js/logger.js"}, {"source": "./emcommon/metrics/carbon/carbon_calculations.py", "target": "/Users/jgreenle/openpath/e-mission-common/emcommon/../emcommon_translated_js/metrics.carbon.carbon_calculations.js"}, {"source": "./emcommon/metrics/surveys/surveys_summary.py", "target": "/Users/jgreenle/openpath/e-mission-common/emcommon/../emcommon_translated_js/metrics.surveys.surveys_summary.js"}, {"source": "./emcommon/survey/conditional_surveys.py", "target": "/Users/jgreenle/openpath/e-mission-common/emcommon/../emcommon_translated_js/survey.conditional_surveys.js"}, {"source": "./emcommon/metrics/metrics_summaries.py", "target": "/Users/jgreenle/openpath/e-mission-common/emcommon/../emcommon_translated_js/metrics.metrics_summaries.js"}]}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/index.js → index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as TranslatedCode from './__translated_src__/__init__.js';
import * as TranslatedCode from './emcommon_translated_js/__init__.js';

/**
* @description Converts a Python dict object to a plain JS object
Expand Down
1 change: 0 additions & 1 deletion js/__translated_src__/__init__.project

This file was deleted.

Loading

0 comments on commit 961ea84

Please sign in to comment.