-
Notifications
You must be signed in to change notification settings - Fork 109
Add PyPI Package Manager Support #49
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
Open
stevenlei
wants to merge
16
commits into
teaxyz:main
Choose a base branch
from
stevenlei:impl-pypi
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 15 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
d8fd33d
add pypi support - wip
stevenlei 2d45981
process to database per batch (size: 10)
stevenlei be08d73
import to db - wip
stevenlei 58256f1
batch downloading package data and cache
stevenlei 6f0dba1
clean up
stevenlei 6d83407
do not do anything (yet) when finished download
stevenlei a18b4c8
transformer wip
stevenlei 7a16c94
temp fix: import_id for versions
stevenlei 61a7570
better handling for processing dependencies
stevenlei a7b1940
accept dependency_type_id as optional property
stevenlei 3499997
working code for the transformer and the full flow
stevenlei 7d28769
fix: rename crate_id to import_id as we have changed db.py
stevenlei ee01623
maintain the semver range for dependencies
stevenlei 2c625db
update the test case for the change of crate_id to import_id
stevenlei 63d8742
Merge branch 'main' into impl-pypi
stevenlei 0400725
refactor: improve PyPI data ingestion and database operations
stevenlei File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| FROM python:3.11-slim | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| COPY package_managers/pypi/requirements.txt . | ||
| RUN pip install -r requirements.txt | ||
|
|
||
| COPY . . | ||
|
|
||
| CMD ["python", "-m", "package_managers.pypi.main"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # PyPI | ||
|
|
||
| The PyPI service processes package data from the Python Package Index (PyPI) and transforms it into CHAI's normalized format. It uses PyPI's JSON data dumps for efficient bulk processing. | ||
|
|
||
| ## Getting Started | ||
|
|
||
| To run the PyPI service, use the following commands: | ||
|
|
||
| ```bash | ||
| docker compose build pypi | ||
| docker compose run pypi | ||
| ``` | ||
|
|
||
| ## Execution Steps | ||
|
|
||
| The PyPI loader follows these steps: | ||
|
|
||
| 1. Initialization: Sets up configuration and database connection | ||
| 2. Fetching: Downloads the latest PyPI JSON data dump if `FETCH` is true | ||
| 3. Transformation: Converts PyPI's JSON format into CHAI's schema | ||
| 4. Loading: Inserts transformed data into the database: | ||
| - Packages | ||
| - Users | ||
| - User Packages | ||
| - URLs | ||
| - Package URLs | ||
| - Versions | ||
| - Dependencies | ||
| 5. Cleanup: Removes temporary files if `NO_CACHE` is true | ||
|
|
||
| The main execution logic is in the `run_pipeline` function in `main.py`. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.