Skip to content

Commit

Permalink
Update readme and bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tgourdel committed Jan 4, 2025
1 parent b2f2cff commit e4df625
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 22 deletions.
21 changes: 8 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
</p>
<br/>


<p align="center">
<a href="https://github.com/amphi-ai/amphi-etl/stargazers" target="_blank">
<img src="https://img.shields.io/github/stars/amphi-ai/amphi-etl?style=social&label=Star&maxAge=2592000" alt="Test">
Expand All @@ -19,11 +20,12 @@
<a href="https://github.com/amphi-ai/amphi-etl/blob/main/LICENSE" target="_blank">
<img src="https://img.shields.io/static/v1?label=license&message=ELv2&color=white" alt="License">
</a>
<a href="https://badge.fury.io/py/amphi-etl"><img src="https://badge.fury.io/py/amphi-etl.svg" alt="PyPI version"></a>
<a href="https://pepy.tech/projects/amphi-etl"><img src="https://static.pepy.tech/badge/amphi-etl" alt="PyPI Downloads"></a>
</p>

![amphi-github-banner](https://github.com/user-attachments/assets/e13ac7e9-4c6f-47f6-b48e-f62e098cef82)


English · [Try the demo](https://demo.amphi.ai) · [Report Bug](https://github.com/amphi-ai/amphi-etl/issues) · [Request Feature](https://github.com/amphi-ai/amphi-etl/issues)

</div>
Expand All @@ -45,7 +47,7 @@ English · [Try the demo](https://demo.amphi.ai) · [Report Bug](https://github.

## 📦 Installation & Update

Amphi is available as both a standalone applicatiion or as a JupyterLab extension.
Amphi is available as both a standalone application or as a JupyterLab extension.

| Amphi ETL (standalone) | Amphi for JupyterLab (extension) |
|------------------------|----------------------|
Expand Down Expand Up @@ -117,15 +119,6 @@ pip install --upgrade amphi-etl

<br/>

**Features In Progress**

- [ ] **Custom components** - Add the ability to develop your own component and wrap configured ones
- [x] **Implement connections** - ~Add the ability to securely create connections to reuse in components~
- [ ] **Developer documentation** - Write comprehensive documentation to allow extensions
- [x] **Save Components** - ~Save components and reuse them in other pipelines~

<br/>

<!--
## 👀 Showcase
Expand All @@ -144,9 +137,11 @@ Every contribution, big or small, is celebrated. Join us in our mission to refin

<br/>

## Telemetry
## 📡 Telemetry

Amphi collects **anonymous telemetry data** to help us understand users and their use-cases better to improve the product. You can of course **opt out** in the settings and disable any telemetry collection.
Amphi collects **anonymous telemetry data** to help us understand users and their use-cases better to improve the product. You can of course **opt out** in the settings and disable any telemetry data collection.

<br/>

## 🛣️ Ecosystem

Expand Down
2 changes: 1 addition & 1 deletion amphi-etl/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def collect_files(src_dir, dest_dir):
author_email='[email protected]',
license='ELv2',
install_requires=[
'jupyterlab==4.3.2',
'jupyterlab==4.3.3',
'jupyterlab-amphi==0.8.22',
'pandas==2.2.1'
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -576,17 +576,58 @@ export class CodeGenerator {

static formatVariables(code: string): string {
const lines = code.split('\n');
const transformedLines = lines.map(line => {
if (/r(['"]).*\1/.test(line) || /f(['"])/.test(line) || /f("""|''')/.test(line)) {
return line; // Return the line as-is if it's an actual raw string or an f-string
let insideTripleQuotes = false;
let tripleQuoteBuffer: string[] = [];
let transformedLines: string[] = [];

for (const line of lines) {
// Handle multiline triple-quoted strings
if (/f?("""|''')/.test(line)) {
// Check if entering or exiting triple quotes
if (insideTripleQuotes) {
tripleQuoteBuffer.push(line);
const multilineString = tripleQuoteBuffer.join('\n');

// Check if the multiline string contains variables
if (/\{.*?\}/.test(multilineString)) {
const updatedString = multilineString.replace(/("""|''')(.*?\{.*?\}.*?)("""|''')/s, 'f$1$2$3');
transformedLines.push(updatedString);
} else {
transformedLines.push(multilineString);
}

tripleQuoteBuffer = [];
insideTripleQuotes = false;
} else {
insideTripleQuotes = true;
tripleQuoteBuffer.push(line);
}
} else if (insideTripleQuotes) {
tripleQuoteBuffer.push(line);
} else {
// Handle single-line strings
if (/r(['"]).*\1/.test(line) || /f(['"]).*\1/.test(line)) {
transformedLines.push(line); // Raw or f-strings remain unchanged
} else {
const transformedLine = line
.replace(/(['"])\{(\w+)\}\1/g, '$2') // Remove quotes for standalone variables
.replace(/(['"])(.*\{.*\}.*)\1/g, 'f$1$2$1') // Convert to f-string for multiple variables
.replace(/(f?"""\s*)(.*\{.*\}.*)(\s*""")/g, 'f"""$2"""'); // Convert triple quotes to f-strings
transformedLines.push(transformedLine);
}
}
return line
.replace(/(['"])\{(\w+)\}\1/g, '$2') // Remove quotes for standalone variables
.replace(/(['"])(.*\{.*\}.*)\1/g, 'f$1$2$1') // Convert to f-string for multiple variables
.replace(/(f?"""\s*)(.*\{.*\}.*)(\s*""")/g, 'f"""$2"""'); // Convert triple quotes to f-strings, avoid double f
});
}

// Flush any remaining triple-quoted buffer (incomplete block)
if (insideTripleQuotes && tripleQuoteBuffer.length > 0) {
const multilineString = tripleQuoteBuffer.join('\n');
transformedLines.push(multilineString);
}

// Return all transformed lines
return transformedLines.join('\n');
}


static getEnvironmentVariableCode(pipelineJson: string, componentService: any): string {
const flow = PipelineService.filterPipeline(pipelineJson);
Expand Down

0 comments on commit e4df625

Please sign in to comment.