Skip to content

Commit abc97f7

Browse files
committed
Resolve merge conflicts and readding miss configured files from develop branch
1 parent e342669 commit abc97f7

File tree

6 files changed

+173
-164
lines changed

6 files changed

+173
-164
lines changed

docs/setup-development-env-WSL.md

Lines changed: 88 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -1,169 +1,126 @@
1-
# Development Environment Setup Guide on Windows using WSL(Windows Subsystem for Linux)
2-
# Introduction
1+
# Development Environment Setup Guide on Windows using WSL
2+
3+
## Introduction
34
This guide establishes a WSL-based development environment on Windows, specifically designed for the GenAI IDP accelerator.
45

5-
Purpose: Provides a Linux development environment directly on Windows without virtualization overhead, combining native Windows tools with a complete Linux
6-
development stack. This approach eliminates cross-platform compatibility issues while maintaining familiar Windows workflows.
6+
**Purpose**: Provides a Linux development environment directly on Windows without virtualization overhead, combining native Windows tools with a complete Linux development stack.
7+
8+
**When to use this guide**:
9+
- You're developing on Windows and need Linux compatibility
10+
- You want to avoid Docker Desktop or VM overhead
11+
- You need consistent behavior with the project's Linux-based AWS infrastructure
12+
- You prefer integrated Windows/Linux development workflows
13+
14+
**What you'll achieve**: A seamless development setup where you can use Windows tools (VS Code, browsers, file explorers) while running the GenAI IDP accelerator in a native Linux environment.
715

8-
When to use this guide:
9-
• You're developing on Windows and need Linux compatibility
10-
• You want to avoid Docker Desktop or VM overhead
11-
• You need consistent behavior with the project's Linux-based AWS infrastructure
12-
• You prefer integrated Windows/Linux development workflows
16+
## Prerequisites
1317

14-
What you'll achieve:
15-
A seamless development setup where you can use Windows tools (VS Code, browsers, file explorers) while running the GenAI IDP accelerator in a native Linux
16-
environment, ensuring compatibility with AWS Lambda's Linux runtime and deployment targets.
17-
# Official Microsoft WSL Installation Guide:
18-
https://docs.microsoft.com/en-us/windows/wsl/install
18+
**Official Microsoft WSL Installation Guide**: https://docs.microsoft.com/en-us/windows/wsl/install
1919

20-
# Step 1: Enable WSL on Windows
21-
### 1.1 Enable WSL Feature for example Ubuntu
20+
## Step 1: Enable WSL on Windows
21+
22+
### 1.1 Install WSL with Ubuntu
2223
1. Open PowerShell as Administrator
2324
2. Run the installation command:
24-
```
25+
```bash
2526
wsl --install -d Ubuntu
2627
```
27-
3. Restart your computer when prompted
28-
4. Complete Ubuntu setup with username/password
29-
### 1.2 Verify Installation
30-
```
31-
wsl --version
32-
```
33-
# Step 2: Install Development Tools in WSL
34-
Open "Ubuntu" in local machine
35-
### 2.1 Update System Packages
36-
```
37-
sudo apt update && sudo apt upgrade -y
38-
```
39-
### 2.2 Install Essential Tools
40-
### Install Git
41-
```
42-
sudo apt install git -y
43-
```
44-
# Step 3: Clone and Setup Project
45-
### Clone Repository
28+
3. Complete Ubuntu setup with username/password
29+
4. You will enter into linux shell directly, then go to your WSL home directory using ``` cd ~ ```
30+
31+
## Step 2: Clone Repository and Run Setup Script
32+
33+
### 2.1 Clone Repository
4634
```
4735
git clone https://github.com/aws-solutions-library-samples/accelerated-intelligent-document-processing-on-aws
4836
```
49-
### Go to directory
5037
```
5138
cd accelerated-intelligent-document-processing-on-aws
5239
```
53-
### Install Python and pip
54-
```
55-
sudo apt install python3 python3-pip -y
56-
```
57-
### Verify Python version
40+
41+
### 2.2 Run Automated Setup Script
5842
```
59-
python3 --version
43+
./scripts/wsl_setup.sh
6044
```
61-
### Create and setup Python Environment
45+
This script automatically installs:
46+
- Git, Python 3, pip, and build tools
47+
- Node.js 18
48+
- AWS CLI v2
49+
- AWS SAM CLI
50+
- Python dependencies
51+
52+
After running the setup script, go to your WSL home directory using ```cd ~```
53+
54+
## Step 3: Complete Manual Setup
55+
56+
### 3.1 Create Python Virtual Environment
6257
```
6358
python3 -m venv venv
6459
source venv/bin/activate
6560
```
66-
### Build tools and make
67-
```
68-
sudo apt install build-essential make -y
69-
```
70-
### Install Node.js for UI development
71-
```
72-
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
73-
```
74-
```
75-
sudo apt-get install -y nodejs
76-
```
77-
### AWS CLI
78-
#### Downloads the latest AWS CLI zip file for Linux x86_64 architecture
79-
```
80-
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscli.zip"
81-
```
82-
#### Unzip aws-cli-linux-x86_64.zip -d
83-
```
84-
unzip awscli.zip
85-
```
86-
#### Installation
87-
```
88-
sudo ./aws/install
89-
```
90-
#### Remove Zip file
91-
```
92-
rm -rf aws awscli.zip
93-
```
94-
### Verify AWS CLI installation
95-
```
96-
aws --version
97-
```
98-
### AWS SAM CLI
99-
#### Downloads the latest AWS SAM CLI zip file for Linux x86_64 architecture from GitHub releases
100-
```
101-
wget https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip
102-
```
103-
#### Unzip aws-sam-cli-linux-x86_64.zip -d sam-installation
104-
```
105-
unzip aws-sam-cli-linux-x86_64.zip -d sam-installation
106-
```
107-
#### Installation
108-
```
109-
sudo ./sam-installation/install
110-
```
111-
#### Remove Zip file
112-
```
113-
rm -rf sam-installation aws-sam-cli-linux-x86_64.zip
114-
```
115-
### Verify SAM Installation
116-
```
117-
sam --version
118-
```
119-
### Install package building tools
120-
```
121-
pip install setuptools wheel
122-
```
123-
### Install all dependencies required for python
124-
```
125-
pip install boto3 rich PyYAML botocore
126-
```
127-
### Install development tools
128-
```
129-
pip install ruff pytest
130-
```
131-
### Install IDP common package in development mode
61+
62+
### 3.2 Install Python Dependencies
63+
```bash
64+
pip install setuptools wheel boto3 rich PyYAML botocore ruff pytest typer
13265
```
133-
pip install -e lib/idp_common_pkg/
66+
### 3.3 Configure AWS CLI
67+
```bash
68+
aws configure
13469
```
135-
# Step 4: AWS Configure
136-
### Refer this link for AWS configure
137-
https://docs.aws.amazon.com/cli/latest/userguide/getting-started-quickstart.html
70+
Enter your AWS credentials when prompted. Refer to: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-quickstart.html
13871

139-
# Step 5: Run Publish Script
140-
## Using publish.py (Recommended)
72+
## Step 4: Test the Setup
14173

142-
### Test publish script help
74+
### 4.1 Verify All Tools
75+
```bash
76+
# Check versions
77+
python3 --version (Example: Python 3.12.3)
78+
aws --version (Example: aws-cli/2.28.26)
79+
sam --version (Example: SAM CLI, version 1.143.0)
80+
node --version (Example: v18.20.8)
81+
npm --version (Example: 10.8.2)
14382
```
144-
python3 publish.py --help
83+
### 4.2 Test Build Process
14584
```
146-
### Test build using publish.py
85+
cd accelerated-intelligent-document-processing-on-aws
14786
```
148-
python3 publish.py bucket_name build-test us-east-1
14987
```
150-
### Troubleshooting Build Issues
151-
If the build fails, use the `--verbose` flag to see detailed error messages:
88+
# Test publish script help
89+
python3 publish.py --help
90+
91+
# Test build (replace with your S3 bucket name)
92+
python3 publish.py your-bucket-name build-test us-east-1
15293
```
153-
python3 publish.py bucket_name build-test us-east-1 --verbose
94+
95+
### 4.3 Troubleshooting Build Issues
96+
If the build fails, use the `--verbose` flag:
97+
```bash
98+
python3 publish.py your-bucket-name build-test us-east-1 --verbose
15499
```
155-
The verbose flag will show:
100+
101+
The verbose flag shows:
156102
- Exact SAM build commands being executed
157103
- Complete error output from failed builds
158104
- Python version compatibility issues
159105
- Missing dependencies or configuration problems
160106

161-
## Using publish.sh (Legacy)
162-
### Test publish script help
163-
```
164-
./publish.sh --help
165-
```
166-
### Test build using publish.sh
107+
## Step 5: Install Visual Studio Code on Local Machine for using WSL as a terminal
108+
### Visit the official website: Go to [https://code.visualstudio.com/](https://code.visualstudio.com/)
109+
Download: Click the "Download for Windows" button
110+
- This will download the User Installer (recommended for most users)
111+
- File name will be something like VSCodeUserSetup-x64-1.x.x.exe
112+
113+
Install:
114+
- Run the downloaded installer
115+
- Choose installation location (default is recommended)
116+
117+
Launch: Click "Launch Visual Studio Code" when installation completes
118+
119+
### Install VSCode Extensions
120+
Install **WSL** extension
121+
122+
### Open Project in WSL
123+
From WSL terminal, navigate to project and open in VSCode
167124
```
168-
./publish.sh bucket_name build-test us-east-1
125+
cd accelerated-intelligent-document-processing-on-aws
169126
```

lib/idp_common_pkg/idp_common/assessment/granular_service.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,11 +1435,9 @@ def process_document_section(self, document: Document, section_id: str) -> Docum
14351435
f"Assessment completed: {len(successful_tasks)}/{len(tasks)} tasks successful"
14361436
)
14371437
if failed_tasks:
1438-
logger.warning(f"Failed tasks: {[t.task_id for t in failed_tasks]}")
14391438
error_message = self._handle_parsing_errors(
14401439
document, failed_tasks, document_text, extraction_results
14411440
)
1442-
logger.info(f"error_message: {error_message}")
14431441
if error_message:
14441442
logger.error(f"Error: {error_message}")
14451443
document.status = Status.FAILED

patterns/pattern-2/src/assessment_function/assessment_validator.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def validate_all(self):
138138
else:
139139
logger.debug("Skipping missing explainability check is disabled.")
140140

141-
# Check count (only if enabled)
141+
# Check count if enabled
142142
if self.enable_count_check:
143143
count_result = self.check_explainability_count()
144144
if not count_result['is_valid']:
@@ -148,12 +148,12 @@ def validate_all(self):
148148
else:
149149
logger.debug("Skipping explainability count check disabled.")
150150

151-
# Check top_k configuration
152-
top_k_result = self.check_top_k_config()
153-
if not top_k_result['is_valid']:
151+
# Check explainability exists
152+
exists_result = self.check_explainability_exists()
153+
if not exists_result['is_valid']:
154154
validation_results['is_valid'] = False
155-
validation_results['failed_attributes'].extend(top_k_result['failed_attributes'])
156-
validation_results['validation_errors'].append(top_k_result['error_message'])
155+
validation_results['failed_attributes'].extend(exists_result['failed_attributes'])
156+
validation_results['validation_errors'].append(exists_result['error_message'])
157157

158158
# Log final validation result
159159
if validation_results['is_valid']:

patterns/pattern-2/src/assessment_function/index.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ def handler(event, context):
7878
extraction_data = s3.get_json_content(section.extraction_result_uri)
7979
validator = AssessmentValidator(extraction_data,
8080
assessment_config=config.get('assessment', {}),
81-
enable_missing_check=True)
81+
enable_missing_check=False,
82+
enable_count_check=False)
8283
validation_results = validator.validate_all()
8384
if not validation_results['is_valid']:
8485
# Handle validation failure
@@ -88,12 +89,6 @@ def handler(event, context):
8889
logger.error(f"Validation Error: {validation_errors}")
8990
logger.info("--- End: Assessment Validation ---")
9091

91-
# # Check if document processing failed
92-
# if updated_document.status == Status.FAILED:
93-
# error_message = f"Assessment failed for document {updated_document.id}, section {section_id}"
94-
# logger.error(error_message)
95-
# raise Exception(error_message)
96-
9792
# Prepare output with automatic compression if needed
9893
result = {
9994
'document': updated_document.serialize_document(working_bucket, f"assessment_{section_id}", logger),

scripts/wsl_setup.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ set -ex
2121
sudo apt update && sudo apt upgrade -y
2222

2323
# Install essential tools
24-
sudo apt install git -y
24+
sudo apt install git unzip -y
2525
sudo apt install python3 python3-pip python3-venv python3-full -y
2626
sudo apt install build-essential make -y
2727

@@ -50,4 +50,10 @@ rm -rf sam-installation aws-sam-cli-linux-x86_64.zip
5050
# Verify SAM installation
5151
sam --version
5252

53-
echo "Packages setup complete."
53+
echo "DONE - WSL development environment setup complete."
54+
echo "Next steps:"
55+
echo "1. Create Python virtual environment: python3 -m venv venv"
56+
echo "2. Activate virtual environment: source venv/bin/activate"
57+
echo "3. Install Python packages: pip install setuptools wheel boto3 rich PyYAML botocore ruff pytest"
58+
echo "4. Install IDP common package: pip install -e lib/idp_common_pkg/"
59+
echo "5. Configure AWS CLI: aws configure"

0 commit comments

Comments
 (0)