Merge modifications for more separate backend functions #69
| @@ -18,17 +18,17 @@ jobs: | |||||||
|     - name: Install dependencies |     - name: Install dependencies | ||||||
|       run: | |       run: | | ||||||
|         apt-get update && apt-get install -y python3 python3-pip |         apt-get update && apt-get install -y python3 python3-pip | ||||||
|         pip install pipenv         |         pip install uv         | ||||||
|  | |||||||
|  |  | ||||||
|     - name: Install packages |     - name: Install packages | ||||||
|       run: | |       run: | | ||||||
|         ls -la |         ls -la | ||||||
|         # install all packages, including dev-packages |         # install all packages, including dev-packages | ||||||
|         pipenv install --dev |         uv sync | ||||||
|       working-directory: backend |       working-directory: backend | ||||||
|  |  | ||||||
|     - name: Run Tests |     - name: Run Tests | ||||||
|       run: pipenv run pytest src --html=report.html --self-contained-html --log-cli-level=DEBUG |       run: uv run pytest src --html=report.html --self-contained-html --log-cli-level=DEBUG | ||||||
|       working-directory: backend |       working-directory: backend | ||||||
|  |  | ||||||
|     - name: Upload HTML report |     - name: Upload HTML report | ||||||
|   | |||||||
							
								
								
									
										6
									
								
								backend/main.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								backend/main.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | |||||||
|  | def main(): | ||||||
|  |     print("Hello from backend!") | ||||||
|  |  | ||||||
|  |  | ||||||
|  | if __name__ == "__main__": | ||||||
|  |     main() | ||||||
| @@ -114,9 +114,11 @@ def optimize_trip( | |||||||
|  |  | ||||||
|     # Second stage optimization |     # Second stage optimization | ||||||
|     try : |     try : | ||||||
|         refined_tour = refiner.refine_optimization(landmarks, base_tour, |         refined_tour = refiner.refine_optimization( | ||||||
|  |             landmarks, base_tour, | ||||||
|             preferences.max_time_minute, |             preferences.max_time_minute, | ||||||
|                                                preferences.detour_tolerance_minute) |             preferences.detour_tolerance_minute | ||||||
|  |         ) | ||||||
|     except Exception as exc : |     except Exception as exc : | ||||||
|         logger.warning(f"Refiner failed. Proceeding with base trip {str(exc)}") |         logger.warning(f"Refiner failed. Proceeding with base trip {str(exc)}") | ||||||
|         refined_tour = base_tour |         refined_tour = base_tour | ||||||
|   | |||||||
| @@ -6,7 +6,6 @@ from shapely import buffer, LineString, Point, Polygon, MultiPoint, concave_hull | |||||||
|  |  | ||||||
| from ..structs.landmark import Landmark | from ..structs.landmark import Landmark | ||||||
| from ..utils.get_time_distance import get_time | from ..utils.get_time_distance import get_time | ||||||
| from ..utils.take_most_important import take_most_important |  | ||||||
| from .optimizer import Optimizer | from .optimizer import Optimizer | ||||||
| from ..constants import OPTIMIZER_PARAMETERS_PATH | from ..constants import OPTIMIZER_PARAMETERS_PATH | ||||||
|  |  | ||||||
| @@ -238,7 +237,7 @@ class Refiner : | |||||||
|             if self.is_in_area(area, landmark.location) and landmark.name not in visited_names: |             if self.is_in_area(area, landmark.location) and landmark.name not in visited_names: | ||||||
|                 second_order_landmarks.append(landmark) |                 second_order_landmarks.append(landmark) | ||||||
|  |  | ||||||
|         return take_most_important(second_order_landmarks, int(self.max_landmarks_refiner*0.75)) |         return sorted(second_order_landmarks, key=lambda x: x.attractiveness, reverse=True)[:int(self.max_landmarks_refiner*0.75)] | ||||||
|  |  | ||||||
|  |  | ||||||
|     # Try fix the shortest path using shapely |     # Try fix the shortest path using shapely | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	
Using the uv action would be cleaner:
See https://docs.astral.sh/uv/guides/integration/github/#installation
Using this works in the
backend_run_lint.yamlstep as well. Just runuv run pylint ....