This repository contains a comprehensive framework for managing and installing various development tools and frameworks, as well as executing commands and handling missing dependencies. Key features include:
Installation Functions:
Utility Functions:
Command Execution:
Integration with IPython:
Svelte Component for Jupyter Notebook Execution:
NotebookExecutor.svelte
: A Svelte component for executing Jupyter notebook commands and displaying the output.Installing Angular CLI:
install_angular_cli()
Executing a Command and Running a Server:
command = "npx create-react-app my-react-app"
execute_command(command)
command_server = "npm start"
folder = "my-react-app"
execute_command(command_server,folder)
Handling Missing Dependencies:
error_message = "Cannot find module 'express'"
original_command = "npm start"
handle_missing_dependency(error_message, original_command)
API Configuration:
const getApiBaseUrl = () => {
if (typeof window !== 'undefined') {
const host = window.location.hostname;
if (host === 'localhost' || host === '127.0.0.1') {
return 'http://127.0.0.1:1337';
} else {
return `http://${host}:1337`;
}
} else {
return 'http://127.0.0.1:1337';
}
};
export const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || getApiBaseUrl();
export const socket = io(API_BASE_URL);
export async function executeNotebookapi(userInput) {
console.log('Executing notebook with input:', userInput);
const projectName = localStorage.getItem("selectedProject");
const response = await fetch(`${API_BASE_URL}/executenotebook`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ input: userInput, project_name: projectName })
});
if (response.ok) {
const data = await response.json();
console.log('Received response:', data);
return data.html;
} else {
console.error('Failed to execute notebook');
return '';
}
}
Using the Svelte Component:
<script>
import { onMount } from 'svelte';
import { executeNotebookapi } from "../api.js";
let userInput = '';
let htmlOutput = '';
async function executeNotebook() {
htmlOutput = await executeNotebookapi(userInput);
}
</script>
<main>
<div class="input-section">
<textarea bind:value={userInput} placeholder="Enter your code here..."></textarea>
<button on:click={executeNotebook}>Execute</button>
</div>
<div class="output-section">
<div class="output">
{@html htmlOutput}
</div>
</div>
</main>
Clone the repository:
git clone https://github.com/darrassi1/Auto_framework_dependency_Installation.git
cd Auto_framework_dependency_Installation
Install required dependencies (if any, like npm
, composer
, flutter
, etc.).
Run example commands to test the functionality.
Feel free to contribute by submitting issues or pull requests. Ensure your code follows the existing structure and includes relevant documentation.
This project is licensed under the MIT License. See the LICENSE
file for more details.