{"id":17967191,"url":"https://github.com/joeychilson/uvgo","last_synced_at":"2026-05-16T13:31:45.642Z","repository":{"id":259672031,"uuid":"879159872","full_name":"joeychilson/uvgo","owner":"joeychilson","description":"A Go library for running python scripts using the uv python package manager.","archived":false,"fork":false,"pushed_at":"2024-10-27T08:01:09.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-03T21:32:45.627Z","etag":null,"topics":["go","python","uv"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joeychilson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-27T06:38:14.000Z","updated_at":"2024-10-31T06:01:53.000Z","dependencies_parsed_at":"2024-10-27T08:42:22.496Z","dependency_job_id":"277ee491-458d-474d-aef3-bdc27875fdd4","html_url":"https://github.com/joeychilson/uvgo","commit_stats":null,"previous_names":["joeychilson/uvgo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/joeychilson/uvgo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeychilson%2Fuvgo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeychilson%2Fuvgo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeychilson%2Fuvgo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeychilson%2Fuvgo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joeychilson","download_url":"https://codeload.github.com/joeychilson/uvgo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeychilson%2Fuvgo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264545017,"owners_count":23625387,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","python","uv"],"created_at":"2024-10-29T14:04:29.031Z","updated_at":"2026-05-16T13:31:40.620Z","avatar_url":"https://github.com/joeychilson.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# uvgo\n\nA library for running python scripts in Go using the [uv](https://docs.astral.sh/uv/) python package manager.\n\n\n## Installation\n\n```bash\ngo get -u github.com/joeychilson/uvgo\n```\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"log\"\n\t\"strings\"\n\n\t\"github.com/joeychilson/uvgo\"\n)\n\ntype SalesData struct {\n\tDate     string  `json:\"date\"`\n\tProduct  string  `json:\"product\"`\n\tQuantity int     `json:\"quantity\"`\n\tPrice    float64 `json:\"price\"`\n}\n\ntype SalesAnalysis struct {\n\tTotalRevenue     float64            `json:\"total_revenue\"`\n\tAverageOrderSize float64            `json:\"average_order_size\"`\n\tTopProducts      []ProductAnalysis  `json:\"top_products\"`\n\tMonthlySales     map[string]float64 `json:\"monthly_sales\"`\n\tGrowth           float64            `json:\"growth_rate\"`\n}\n\ntype ProductAnalysis struct {\n\tName     string  `json:\"name\"`\n\tRevenue  float64 `json:\"revenue\"`\n\tQuantity int     `json:\"quantity\"`\n}\n\nfunc AnalyzeSalesScript(ctx context.Context, sales []SalesData) (string, error) {\n\tsalesJSON, err := json.Marshal(sales)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to marshal sales data: %w\", err)\n\t}\n\n\tscript := fmt.Sprintf(`\nimport pandas as pd\nimport json\nfrom datetime import datetime\n\n\ninput_data = json.loads('''%s''')\n\ndf = pd.DataFrame(input_data)\n\ndf['date'] = pd.to_datetime(df['date'])\ndf['revenue'] = df['quantity'] * df['price']\n\ntotal_revenue = df['revenue'].sum()\navg_order = df['revenue'].mean()\n\nproduct_analysis = df.groupby('product').agg({\n    'revenue': 'sum',\n    'quantity': 'sum'\n}).reset_index()\n\ntop_products = []\nfor _, row in product_analysis.iterrows():\n    top_products.append({\n        'name': row['product'],\n        'revenue': float(row['revenue']),\n        'quantity': int(row['quantity'])\n    })\n\nmonthly_sales = df.groupby(df['date'].dt.strftime('%%Y-%%m'))['revenue'].sum().to_dict()\n\nfirst_month = df[df['date'].dt.strftime('%%Y-%%m') == df['date'].dt.strftime('%%Y-%%m').min()]['revenue'].sum()\nlast_month = df[df['date'].dt.strftime('%%Y-%%m') == df['date'].dt.strftime('%%Y-%%m').max()]['revenue'].sum()\ngrowth_rate = ((last_month - first_month) / first_month) * 100 if first_month \u003e 0 else 0\n\nanalysis = {\n    'total_revenue': float(total_revenue),\n    'average_order_size': float(avg_order),\n    'top_products': top_products,\n    'monthly_sales': {k: float(v) for k, v in monthly_sales.items()},\n    'growth_rate': float(growth_rate)\n}\n\nprint(json.dumps(analysis))\n`, strings.ReplaceAll(string(salesJSON), \"'\", \"\\\\'\"))\n\n\treturn script, nil\n}\n\nfunc main() {\n\tsalesData := []SalesData{\n\t\t{Date: \"2024-01-01\", Product: \"Product A\", Quantity: 10, Price: 100},\n\t\t{Date: \"2024-01-15\", Product: \"Product B\", Quantity: 5, Price: 150},\n\t\t{Date: \"2024-02-01\", Product: \"Product A\", Quantity: 8, Price: 100},\n\t\t{Date: \"2024-02-15\", Product: \"Product C\", Quantity: 12, Price: 75},\n\t\t{Date: \"2024-03-01\", Product: \"Product B\", Quantity: 6, Price: 150},\n\t}\n\n\tctx := context.Background()\n\tscript, err := AnalyzeSalesScript(ctx, salesData)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tuv, err := uvgo.New(uvgo.WithDependencies(\"pandas\"))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tresult, err := uvgo.StructuredOutputFromString[SalesAnalysis](ctx, uv, script)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Printf(\"Sales Analysis Results:\\n\")\n\tfmt.Printf(\"Total Revenue: $%.2f\\n\", result.Data.TotalRevenue)\n\tfmt.Printf(\"Average Order Size: $%.2f\\n\", result.Data.AverageOrderSize)\n\tfmt.Printf(\"Growth Rate: %.1f%%\\n\", result.Data.Growth)\n\n\tfmt.Printf(\"\\nTop Products:\\n\")\n\tfor _, product := range result.Data.TopProducts {\n\t\tfmt.Printf(\"- %s: $%.2f (Qty: %d)\\n\",\n\t\t\tproduct.Name,\n\t\t\tproduct.Revenue,\n\t\t\tproduct.Quantity,\n\t\t)\n\t}\n\n\tfmt.Printf(\"\\nMonthly Sales:\\n\")\n\tfor month, revenue := range result.Data.MonthlySales {\n\t\tfmt.Printf(\"- %s: $%.2f\\n\", month, revenue)\n\t}\n\n\tfmt.Printf(\"System Time: %s\\n\", result.SystemTime)\n\tfmt.Printf(\"User Time: %s\\n\", result.UserTime)\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoeychilson%2Fuvgo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoeychilson%2Fuvgo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoeychilson%2Fuvgo/lists"}