Skip to content

Commit

Permalink
Visualize Maven parent POM artifactIds & versions in use (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek authored Sep 30, 2023
1 parent b35b5a8 commit f223ef4
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
80 changes: 80 additions & 0 deletions moderne_visualizations_misc/maven_parent_poms.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "ef753160-169b-452a-9c8c-9e0940820f9e",
"metadata": {},
"outputs": [],
"source": [
"from code_data_science import data_table as dt\n",
"\n",
"df = dt.read_csv(\"../samples/maven_parent_poms.csv\")\n",
"df.head()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "86cc5354-5bf9-4682-999b-62e91ea05d1b",
"metadata": {},
"outputs": [],
"source": [
"data = df.drop(columns=[\"repositoryOrigin\", \"repositoryPath\", \"repositoryBranch\", \"projectName\", \"groupId\", \"datedSnapshotVersion\", \"relativePath\"])\n",
"data"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2a0d241e-8523-4e45-a3f7-33c13bda9927",
"metadata": {},
"outputs": [],
"source": [
"versions = (\n",
" data.groupby([\"artifactId\", \"version\"], as_index=False)\n",
" .value_counts()\n",
" .pivot(index=\"artifactId\", columns=\"version\")\n",
" .fillna(0)\n",
")\n",
"versions"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "94a5f63e-670e-4321-94fe-d3a57770b4c5",
"metadata": {},
"outputs": [],
"source": [
"import code_data_science.palette as palette\n",
"import matplotlib.pyplot as plt\n",
"\n",
"colors = palette.qualitative()\n",
"\n",
"ax = versions.plot.bar(stacked=True, colormap=plt.cm.colors.ListedColormap(colors))\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
7 changes: 7 additions & 0 deletions moderne_visualizations_misc/specs/maven_parent_poms.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
type: specs.moderne.io/v1beta/visualization
name: io.moderne.MavenParentPOMs
displayName: Maven parent POMs
description: This report shows the different Maven parent POMs that are used in the projects.
recipe: org.openrewrite.maven.search.ParentPomInsight
dataTable: org.openrewrite.maven.table.ParentPomsInUse
3 changes: 3 additions & 0 deletions samples/maven_parent_poms.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
repositoryOrigin,repositoryPath,repositoryBranch,projectName,groupId,artifactId,version,datedSnapshotVersion,relativePath
github.com,spring-projects/spring-petclinic,main,spring-petclinic,org.springframework.boot,"spring-boot-starter-parent",3.1.3,,
github.com,spring-cloud/spring-cloud-kubernetes,main,spring-cloud-kubernetes,org.springframework.cloud,"spring-cloud-build",4.0.5,,

0 comments on commit f223ef4

Please sign in to comment.