Skip to content

Commit

Permalink
feat(docs): include package usage example (#2767)
Browse files Browse the repository at this point in the history
  • Loading branch information
ccerv1 authored Jan 15, 2025
1 parent 32624a9 commit 503cc1e
Showing 1 changed file with 52 additions and 1 deletion.
53 changes: 52 additions & 1 deletion apps/docs/docs/tutorials/dependencies.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Map the Software Supply Chain
title: Map Dependencies
sidebar_position: 3
---

Expand Down Expand Up @@ -138,6 +138,57 @@ df = client.query(query).to_dataframe()
</TabItem>
</Tabs>

### Package Usage Metrics

The following query uses package ownership data to calculate the number of projects that depend on a given package maintainer:

<Tabs>
<TabItem value="sql" label="SQL">

```sql
select
package_owners.package_owner_artifact_namespace as maintainter,
sboms.to_package_artifact_source as package_source,
sboms.to_package_artifact_name as package_name,
count(distinct sboms.from_artifact_id) as count_dependent_repos,
count(distinct sboms.from_project_id) as count_dependent_projects
from `oso_production.sboms_v0` sboms
join `oso_production.package_owners_v0` package_owners
on
sboms.to_package_artifact_name = package_owners.package_artifact_name
and sboms.to_package_artifact_source = package_owners.package_artifact_source
where
package_owners.package_owner_artifact_namespace = 'wevm'
group by 1,2,3
```

</TabItem>
<TabItem value="python" label="Python">

```python
query = """
select
package_owners.package_owner_artifact_namespace as maintainter,
sboms.to_package_artifact_source as package_source,
sboms.to_package_artifact_name as package_name,
count(distinct sboms.from_artifact_id) as count_dependent_repos,
count(distinct sboms.from_project_id) as count_dependent_projects
from `oso_production.sboms_v0` sboms
join `oso_production.package_owners_v0` package_owners
on
sboms.to_package_artifact_name = package_owners.package_artifact_name
and sboms.to_package_artifact_source = package_owners.package_artifact_source
where
package_owners.package_owner_artifact_namespace = 'wevm'
group by 1,2,3
"""
df = client.query(query).to_dataframe()
```

</TabItem>
</Tabs>


### Build a Deep Funding Graph

This example demonstrates how to create a dependency graph for a group of related repositories, such as the one used by [Deep Funding](https://deepfunding.org). The analysis maps relationships between key Ethereum repositories and their package dependencies:
Expand Down

0 comments on commit 503cc1e

Please sign in to comment.