diff --git a/.github/workflows/deploy_gh_pages.yml b/.github/workflows/build_check_deploy_gh_pages.yml similarity index 78% rename from .github/workflows/deploy_gh_pages.yml rename to .github/workflows/build_check_deploy_gh_pages.yml index 2eb0b392..5df654ea 100644 --- a/.github/workflows/deploy_gh_pages.yml +++ b/.github/workflows/build_check_deploy_gh_pages.yml @@ -3,6 +3,8 @@ name: Deploy to gh-pages on: push: branches: [ main ] + pull_request: + branches: [main] repository_dispatch: types: [ rebuild-website ] workflow_dispatch: @@ -36,6 +38,12 @@ jobs: cd utils/models python3 get_models.py + - name: fetch and convert layer data + run: | + cd new-website + cd utils/layers + python3 get_layers.py + - name: fetch and convert tutorial data run: | sudo apt-get install jq @@ -52,7 +60,9 @@ jobs: npm run lint npm run export + # Run the deploy action if the push is to the main branch - name: Deploy 🚀 + if: ${{ github.ref == 'refs/heads/main' }} uses: JamesIves/github-pages-deploy-action@v4 with: folder: new-website/deepchem/out diff --git a/new-website/deepchem/components/Layers/LayerCard.js b/new-website/deepchem/components/Layers/LayerCard.js index 69e4de7c..a7795d77 100644 --- a/new-website/deepchem/components/Layers/LayerCard.js +++ b/new-website/deepchem/components/Layers/LayerCard.js @@ -11,49 +11,48 @@ import deepchemKeras from "../../public/icons/deepchem-keras.png"; * @return {string} - The parsed and formatted string */ function parseName(name) { - name = name.replaceAll(/([A-Z]+)/g, " $1"); - name = name.replace(/([^ ])(Layer)/, "$1 Layer"); - return name; - } + name = name.replaceAll(/([A-Z]+)/g, " $1"); + name = name.replace(/([^ ])(Layer)/, "$1 Layer"); + return name; +} const LayerCard = ({ layer }) => { - let models = layer.models.length - ? layer.models.join(", ") - : "N/A"; - models = models + " " + "\xa0".repeat(300); + let models = layer.models.length ? layer.models.join(", ") : "N/A"; + models = models + " " + "\xa0".repeat(300); - return ( - <> - -
-
-
- {parseName(layer.name)} -
-
- {layer.category === "torch" && ( - PyTorch - )} - {layer.category === "keras" && ( - Keras - )} -
-
- {layer.category} -
-
- { -
-

Acceptable Models

-

- {models} -

-
- } + return ( + <> + +
+
+
+ {parseName(layer.name)}
- - - ); +
+ +
+ {layer.category === "torch" && ( + PyTorch + )} + {layer.category === "keras" && ( + Keras + )} +
+ {layer.category} +
+
+ { +
+

Acceptable Models

+

+ {models} +

+
+ } +
+ + + ); }; -export default LayerCard; \ No newline at end of file +export default LayerCard; diff --git a/new-website/deepchem/package-lock.json b/new-website/deepchem/package-lock.json index 985741f0..ca96f25b 100644 --- a/new-website/deepchem/package-lock.json +++ b/new-website/deepchem/package-lock.json @@ -7527,8 +7527,7 @@ "@emotion/use-insertion-effect-with-fallbacks": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@emotion/use-insertion-effect-with-fallbacks/-/use-insertion-effect-with-fallbacks-1.0.0.tgz", - "integrity": "sha512-1eEgUGmkaljiBnRMTdksDV1W4kUnmwgp7X9G8B++9GYwl1lUdqSndSriIrTJ0N7LQaoauY9JJ2yhiOYK5+NI4A==", - "requires": {} + "integrity": "sha512-1eEgUGmkaljiBnRMTdksDV1W4kUnmwgp7X9G8B++9GYwl1lUdqSndSriIrTJ0N7LQaoauY9JJ2yhiOYK5+NI4A==" }, "@emotion/utils": { "version": "1.2.0", @@ -7784,8 +7783,7 @@ "@mui/types": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/@mui/types/-/types-7.2.3.tgz", - "integrity": "sha512-tZ+CQggbe9Ol7e/Fs5RcKwg/woU+o8DCtOnccX6KmbBc7YrfqMYEYuaIcXHuhpT880QwNkZZ3wQwvtlDFA2yOw==", - "requires": {} + "integrity": "sha512-tZ+CQggbe9Ol7e/Fs5RcKwg/woU+o8DCtOnccX6KmbBc7YrfqMYEYuaIcXHuhpT880QwNkZZ3wQwvtlDFA2yOw==" }, "@mui/utils": { "version": "5.11.7", @@ -8313,15 +8311,13 @@ "version": "1.8.0", "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz", "integrity": "sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw==", - "dev": true, - "requires": {} + "dev": true }, "acorn-jsx": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "dev": true, - "requires": {} + "dev": true }, "acorn-node": { "version": "1.8.2", @@ -8364,8 +8360,7 @@ "version": "3.5.2", "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", - "dev": true, - "requires": {} + "dev": true }, "align-text": { "version": "0.1.4", @@ -9215,8 +9210,7 @@ "version": "0.14.0", "resolved": "https://registry.npmjs.org/eslint-config-google/-/eslint-config-google-0.14.0.tgz", "integrity": "sha512-WsbX4WbjuMvTdeVL6+J3rK1RGhCTqjsFjX7UMSMgZiyxxaNLkoJENbrGExzERFeoTpGw3F3FypTiWAP9ZXzkEw==", - "dev": true, - "requires": {} + "dev": true }, "eslint-config-next": { "version": "13.0.4", @@ -9239,8 +9233,7 @@ "version": "8.6.0", "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.6.0.tgz", "integrity": "sha512-bAF0eLpLVqP5oEVUFKpMA+NnRFICwn9X8B5jrR9FcqnYBuPbqWEjTEspPWMj5ye6czoSLDweCzSo3Ko7gGrZaA==", - "dev": true, - "requires": {} + "dev": true }, "eslint-import-resolver-node": { "version": "0.3.7", @@ -9465,8 +9458,7 @@ "version": "4.6.0", "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz", "integrity": "sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g==", - "dev": true, - "requires": {} + "dev": true }, "eslint-scope": { "version": "7.1.1", @@ -11172,8 +11164,7 @@ "react-frame-component": { "version": "5.2.6", "resolved": "https://registry.npmjs.org/react-frame-component/-/react-frame-component-5.2.6.tgz", - "integrity": "sha512-CwkEM5VSt6nFwZ1Op8hi3JB5rPseZlmnp5CGiismVTauE6S4Jsc4TNMlT0O7Cts4WgIC3ZBAQ2p1Mm9XgLbj+w==", - "requires": {} + "integrity": "sha512-CwkEM5VSt6nFwZ1Op8hi3JB5rPseZlmnp5CGiismVTauE6S4Jsc4TNMlT0O7Cts4WgIC3ZBAQ2p1Mm9XgLbj+w==" }, "react-is": { "version": "18.2.0", @@ -11193,8 +11184,7 @@ "react-placeholder": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/react-placeholder/-/react-placeholder-4.1.0.tgz", - "integrity": "sha512-z1HGD86NWJTYTQumHsmGH9jkozv4QHa9dju/vHVUd4f1svu23pf5v7QoBLBfs3kA1S9GLJaCeRMHLbO2SCdz5A==", - "requires": {} + "integrity": "sha512-z1HGD86NWJTYTQumHsmGH9jkozv4QHa9dju/vHVUd4f1svu23pf5v7QoBLBfs3kA1S9GLJaCeRMHLbO2SCdz5A==" }, "react-responsive-carousel": { "version": "3.2.23", @@ -11217,8 +11207,7 @@ "react-scroll-to-top": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/react-scroll-to-top/-/react-scroll-to-top-3.0.0.tgz", - "integrity": "sha512-I/k45Ujai097du59tHBbzGxN7Lyc6K8Uc3IChq6HMXaBfB8N/rrfm055T5Yv0DWfVpf6pOFaBmhD3LOfH5unGw==", - "requires": {} + "integrity": "sha512-I/k45Ujai097du59tHBbzGxN7Lyc6K8Uc3IChq6HMXaBfB8N/rrfm055T5Yv0DWfVpf6pOFaBmhD3LOfH5unGw==" }, "react-tooltip": { "version": "5.7.5", @@ -11243,8 +11232,7 @@ "react-type-animation": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/react-type-animation/-/react-type-animation-2.1.2.tgz", - "integrity": "sha512-6/t4Whl87sLR0c8kzvJngTrCV6OVy3jEeUZoe2svVu9VaYr951VD7OeUie1rIyeD8JfpBIqZGYrPFHZQ04XHrw==", - "requires": {} + "integrity": "sha512-6/t4Whl87sLR0c8kzvJngTrCV6OVy3jEeUZoe2svVu9VaYr951VD7OeUie1rIyeD8JfpBIqZGYrPFHZQ04XHrw==" }, "read-cache": { "version": "1.0.0", @@ -11923,8 +11911,7 @@ "use-sync-external-store": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz", - "integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==", - "requires": {} + "integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==" }, "util-deprecate": { "version": "1.0.2", diff --git a/new-website/deepchem/pages/layers.js b/new-website/deepchem/pages/layers.js index f9eeca0d..1233356a 100644 --- a/new-website/deepchem/pages/layers.js +++ b/new-website/deepchem/pages/layers.js @@ -8,18 +8,15 @@ import FilterButton from "/components/common/FilterButton"; import layers from "/data/layers/layers.json"; import modelList from "/data/layers/models.json"; -import deepchemPyTorch from "/public/icons/deepchem-pytorch.png"; -import deepchemKeras from "/public/icons/deepchem-keras.png"; import deepchemFilter from "/public/icons/deepchem-filter.png"; - /** * Models component that displays the models page of the application * @component * @return {JSX.Element} The JSX element to render the Model component */ -const Layers = () => { +const Layers = () => { const [filteredLayers, setFilteredLayers] = useState(layers); const [models, setModels] = useState([]); const [isPopUp, setIsPopUp] = useState(false); @@ -43,9 +40,7 @@ const Layers = () => { useEffect(() => { let newlayers = []; const flayers = layers; - if ( - models.length === 0 - ) { + if (models.length === 0) { newlayers = layers; } else { flayers.map((flayer) => { @@ -73,7 +68,6 @@ const Layers = () => { }, []); return ( -
{ } fixed bg-dc-gray/80 w-full h-[100vh] top-0 lg:hidden`} onClick={handlePopUp} >
-
+
{/* HEADING BEGIN */} -
+
Our Layers
- {/* HEADING END */} - {/* BODY BEGIN */} -
- {/* FILTER SECTION BEGIN */} -
- {/* MODEL BEGIN */} -
-
Model
-
- {modelList.map((model, index) => ( -
- -
- ))} -
+
+ {/* HEADING END */} + + {/* BODY BEGIN */} +
+ {/* FILTER SECTION BEGIN */} +
+ {/* MODEL BEGIN */} +
+
Model
+
+ {modelList.map((model, index) => ( +
+ +
+ ))}
- {/* MODEL END */} - {/* LAYER CARDS SECTION BEGIN */} -
- {filteredLayers.length ? ( - filteredLayers.map((layer) => ( - - )) - ) : ( -
- -

No such layers exist!

-
- )}
- {/* MODEL CARDS SECTION END */} + {/* MODEL END */} +
+ {/* FILTER SECTION END */} + + {/* LAYER CARDS SECTION BEGIN */} +
+ {filteredLayers.length ? ( + filteredLayers.map((layer) => ( + + )) + ) : ( +
+ +

No such layers exist!

+
+ )}
- {/*BODY END*/} + {/* MODEL CARDS SECTION END */}
+ {/* BODY END */}
); diff --git a/new-website/utils/layers/get_layers.py b/new-website/utils/layers/get_layers.py index df2082e6..aeafcd27 100644 --- a/new-website/utils/layers/get_layers.py +++ b/new-website/utils/layers/get_layers.py @@ -12,13 +12,16 @@ PATH = '../../deepchem/data/layers/' REDIRECT_URL = 'https://deepchem.readthedocs.io/en/latest/api_reference/layers.html#' CHEATSHEETS = { - 'keras': 'https://raw.githubusercontent.com/deepchem/deepchem/master/docs/source/api_reference/keras_layers.csv', - 'torch': 'https://raw.githubusercontent.com/deepchem/deepchem/master/docs/source/api_reference/torch_layers.csv' + 'keras': + 'https://raw.githubusercontent.com/deepchem/deepchem/master/docs/source/api_reference/keras_layers.csv', + 'torch': + 'https://raw.githubusercontent.com/deepchem/deepchem/master/docs/source/api_reference/torch_layers.csv' } layer_list = [] model_list = [] + @dataclasses.dataclass class Layer: """ @@ -37,14 +40,16 @@ class Layer: """ name: str url: str - category: str - models : list + category: str + models: list layer_id: int - + + class LayerListEncoder(JSONEncoder): """ LayerEncoder class to encode the Layer object to JSON """ + def default(self, o): """ Default function to encode the Layer object to JSON @@ -55,6 +60,7 @@ def default(self, o): """ return o.__dict__ + def convert_to_json(data, name, is_layer=False): """ Convert the list of data to JSON format and write to a file @@ -78,25 +84,30 @@ def convert_to_json(data, name, is_layer=False): with open(PATH + name, 'w', encoding="utf-8") as file: file.write(data) + def fetch_data(): """ Function to fetch the layer csv files and extract necessary data """ for category in CHEATSHEETS.items(): - subprocess.call(f'curl -o {PATH}{category[0] + ".csv"} {category[1]}', shell=True) + subprocess.call(f'curl -o {PATH}{category[0] + ".csv"} {category[1]}', + shell=True) index = -1 for filename in os.listdir(PATH): - for row in pd.read_csv(PATH + filename, on_bad_lines='skip').replace(np.nan, '').iterrows(): + for row in pd.read_csv(PATH + filename, + on_bad_lines='skip').replace(np.nan, + '').iterrows(): name = row[1]['Layer'] url = REDIRECT_URL + name.lower() category = filename.split('.')[0] - models = row['Model'].split(' ') if row['Model'] != '' else [] + models = row[1][' Model'].split( + ' ') if row[1][' Model'] != '' else [] index += 1 - model_list.append(models) + model_list.append(models) layer_list.append(Layer(name, url, category, models, index)) - + def main(): """ @@ -107,6 +118,6 @@ def main(): convert_to_json(layer_list, 'layers.json', is_layer=True) convert_to_json(model_list, 'models.json') + if __name__ == '__main__': main() -