-
Notifications
You must be signed in to change notification settings - Fork 155
Inclusion of Hugging face Package Manager #428
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
7a056d2
including hugging face repository type
nitinp19 4afddef
"upgrade to the non-vulnerable dependency"
nitinp19 d1c2955
Update artifactory.client.release.properties
nitinp19 88be15e
"test cases for the hugging face package manager"
nitinp19 d5f0d55
"updating test cases"
nitinp19 93c898a
"updating test cases for extra logging"
nitinp19 2d54a94
Fix HuggingFace package type tests with diagnostics and skip logic
nitinp19 8f1df6c
fixing hugging face test
nitinp19 78e9c0b
ci: point to latest Artifactory version
nitinp19 5ee5621
removing the logging
nitinp19 57ea5db
"updating test cases for hugging face"
nitinp19 d10deed
"incorporating pr comments"
nitinp19 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
7 changes: 7 additions & 0 deletions
7
...org/jfrog/artifactory/client/model/repository/settings/HuggingFaceRepositorySettings.java
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,7 @@ | ||
| package org.jfrog.artifactory.client.model.repository.settings; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
|
|
||
| @JsonIgnoreProperties(ignoreUnknown = true) | ||
| public interface HuggingFaceRepositorySettings extends RepositorySettings { | ||
| } |
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 |
|---|---|---|
|
|
@@ -42,4 +42,4 @@ artifacts { | |
| archives sourcesJar, | ||
| javadocJar, | ||
| jar | ||
| } | ||
| } | ||
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
30 changes: 30 additions & 0 deletions
30
.../artifactory/client/model/repository/settings/impl/HuggingFaceRepositorySettingsImpl.java
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,30 @@ | ||
| package org.jfrog.artifactory.client.model.repository.settings.impl; | ||
|
|
||
| import org.jfrog.artifactory.client.model.PackageType; | ||
| import org.jfrog.artifactory.client.model.impl.PackageTypeImpl; | ||
| import org.jfrog.artifactory.client.model.repository.settings.AbstractRepositorySettings; | ||
| import org.jfrog.artifactory.client.model.repository.settings.HuggingFaceRepositorySettings; | ||
|
|
||
| public class HuggingFaceRepositorySettingsImpl extends AbstractRepositorySettings implements HuggingFaceRepositorySettings { | ||
| public static String defaultLayout = "simple-default"; | ||
|
|
||
| public HuggingFaceRepositorySettingsImpl() { | ||
| super(defaultLayout); | ||
| } | ||
|
|
||
| @Override | ||
| public PackageType getPackageType() { | ||
| return PackageTypeImpl.huggingfaceml; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object o) { | ||
| if (this == o) return true; | ||
| return o instanceof HuggingFaceRepositorySettingsImpl; | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return super.hashCode(); | ||
| } | ||
| } | ||
78 changes: 78 additions & 0 deletions
78
...es/src/test/groovy/org/jfrog/artifactory/client/HuggingFacePackageTypeRepositoryTest.java
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,78 @@ | ||
| package org.jfrog.artifactory.client; | ||
|
|
||
| import org.jfrog.artifactory.client.model.Repository; | ||
| import org.jfrog.artifactory.client.model.RepositoryType; | ||
| import org.jfrog.artifactory.client.model.builder.RepositoryBuilders; | ||
| import org.jfrog.artifactory.client.model.impl.PackageTypeImpl; | ||
| import org.jfrog.artifactory.client.model.repository.settings.HuggingFaceRepositorySettings; | ||
| import org.jfrog.artifactory.client.model.repository.settings.RepositorySettings; | ||
| import org.jfrog.artifactory.client.model.repository.settings.impl.HuggingFaceRepositorySettingsImpl; | ||
| import org.testng.annotations.AfterMethod; | ||
| import org.testng.SkipException; | ||
| import org.testng.annotations.BeforeMethod; | ||
| import org.testng.annotations.Test; | ||
|
|
||
| import static org.testng.Assert.assertEquals; | ||
| import static org.testng.Assert.assertNotNull; | ||
|
|
||
| public class HuggingFacePackageTypeRepositoryTest extends BaseRepositoryTests { | ||
|
|
||
| private final String localRepo = "huggingface-local-1"; | ||
nitinp19 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| private final String federatedRepo = "huggingface-federated-1"; | ||
| private final String virtualRepo = "huggingface-virtual-1"; | ||
|
|
||
| @BeforeMethod | ||
| @AfterMethod | ||
| private void cleanup() { | ||
| deleteRepoIfExists(localRepo); | ||
| deleteRepoIfExists(federatedRepo); | ||
| deleteRepoIfExists(virtualRepo); | ||
| } | ||
|
|
||
| @Override | ||
| public RepositorySettings getRepositorySettings(RepositoryType repositoryType) { | ||
| return new HuggingFaceRepositorySettingsImpl(); | ||
| } | ||
|
|
||
| @Test | ||
| public void testHuggingFaceLocalRepo() { | ||
| HuggingFaceRepositorySettings settings = new HuggingFaceRepositorySettingsImpl(); | ||
| RepositoryBuilders repositoryBuilders = artifactory.repositories().builders(); | ||
| Repository localRepository = repositoryBuilders.localRepositoryBuilder() | ||
| .key(localRepo) | ||
| .description("new local huggingface repo") | ||
| .notes("some notes") | ||
| .repositorySettings(settings) | ||
| .build(); | ||
|
|
||
| // Use position 0 for create, as required by the interface | ||
| String localCreateResult = artifactory.repositories().create(0, localRepository); | ||
| Repository localRepoFromServer = artifactory.repository(localRepo).get(); | ||
|
|
||
| assertNotNull(localRepoFromServer); | ||
| assertEquals(localRepoFromServer.getKey(), localRepo); | ||
| assertEquals(localRepoFromServer.getDescription(), "new local huggingface repo"); | ||
| assertEquals(localRepoFromServer.getNotes(), "some notes"); | ||
| assertEquals(localRepoFromServer.getRepoLayoutRef(), "simple-default"); | ||
| assertEquals(localRepoFromServer.getRepositorySettings().getPackageType(), PackageTypeImpl.huggingfaceml); | ||
| } | ||
|
|
||
| @Test | ||
| public void testHuggingFaceFederatedRepo() { | ||
| HuggingFaceRepositorySettings settings = new HuggingFaceRepositorySettingsImpl(); | ||
| RepositoryBuilders repositoryBuilders = artifactory.repositories().builders(); | ||
| Repository federatedRepository = repositoryBuilders.federatedRepositoryBuilder() | ||
| .key(federatedRepo) | ||
| .description("new federated huggingface repo") | ||
| .notes("some notes") | ||
| .repositorySettings(settings) | ||
| .build(); | ||
|
|
||
| String federatedCreateResult = artifactory.repositories().create(0, federatedRepository); | ||
| Repository federatedRepoFromServer = artifactory.repository(federatedRepo).get(); | ||
| assertNotNull(federatedRepoFromServer); | ||
| assertEquals(federatedRepoFromServer.getKey(), federatedRepo); | ||
| assertEquals(federatedRepoFromServer.getDescription(), "new federated huggingface repo"); | ||
| assertEquals(federatedRepoFromServer.getNotes(), "some notes"); | ||
| } | ||
| } | ||
45 changes: 45 additions & 0 deletions
45
services/src/test/groovy/org/jfrog/artifactory/client/HuggingFaceRepositorySettingsTest.java
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,45 @@ | ||
| package org.jfrog.artifactory.client; | ||
|
|
||
| import org.jfrog.artifactory.client.model.PackageType; | ||
| import org.jfrog.artifactory.client.model.impl.PackageTypeImpl; | ||
| import org.jfrog.artifactory.client.model.repository.settings.impl.HuggingFaceRepositorySettingsImpl; | ||
| import org.testng.annotations.Test; | ||
|
|
||
| import static org.testng.Assert.*; | ||
|
|
||
| /** | ||
| * Test for HuggingFace repository settings implementation | ||
| */ | ||
| public class HuggingFaceRepositorySettingsTest { | ||
|
|
||
| @Test | ||
| public void testHuggingFaceRepositorySettings() { | ||
| HuggingFaceRepositorySettingsImpl settings = new HuggingFaceRepositorySettingsImpl(); | ||
|
|
||
| // Test package type | ||
| PackageType packageType = settings.getPackageType(); | ||
| assertEquals(packageType, PackageTypeImpl.huggingfaceml); | ||
|
|
||
| // Test default layout | ||
| assertEquals(settings.getRepoLayout(), "simple-default"); | ||
|
|
||
| // Test layout setting | ||
| settings.setRepoLayout("custom-layout"); | ||
| assertEquals(settings.getRepoLayout(), "custom-layout"); | ||
|
|
||
| // Test that it's not a custom package type | ||
| assertFalse(packageType.isCustom()); | ||
| } | ||
|
|
||
| @Test | ||
| public void testConsistencyWithOtherPackageManagers() { | ||
| HuggingFaceRepositorySettingsImpl huggingFaceSettings = new HuggingFaceRepositorySettingsImpl(); | ||
|
|
||
| // Verify it follows the same interface pattern as other package managers | ||
| assertNotNull(huggingFaceSettings.getPackageType()); | ||
| assertNotNull(huggingFaceSettings.getRepoLayout()); | ||
|
|
||
| // Test that the default layout is properly set | ||
| assertEquals(HuggingFaceRepositorySettingsImpl.defaultLayout, "simple-default"); | ||
| } | ||
| } |
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.