Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visualize Maven parent POM artifactIds & versions in use #24

Merged
merged 3 commits into from
Sep 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,,
Loading