Github¶
Github plugin provides Package and Resource models and converters between Github and Data Package notations
Installation¶
Extra dependency needs to be installed:
Usage¶
Converting a Github descriptor to the Data Package notation:
from dplib.plugins.github.models import GithubPackage
package = GithubPackage.from_path("data/plugins/github/package.json").to_dp()
print(package.to_text(format='json'))
{
"name": "octocat/Hello-World",
"title": "Hello-World",
"description": "This your first repo!",
"homepage": "https://github.com/octocat/Hello-World",
"licenses": [
{
"name": "MIT",
"title": "MIT License"
}
],
"keywords": ["octocat", "atom", "electron", "api"],
"created": "2011-01-26T19:01:12Z"
}
Converting a Data Package to Github notation:
from dplib.models import Package
from dplib.plugins.github.models import GithubPackage
package = GithubPackage.from_dp(Package.from_path("data/package.json"))
print(package.to_text(format="xml"))
Reference¶
dplib.plugins.github.models.GithubPackage
¶
Bases: Model
Github Package model
Source code in dplib/plugins/github/models/package.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
|
created_at: Optional[str] = None
class-attribute
instance-attribute
¶
description: Optional[str] = None
class-attribute
instance-attribute
¶
full_name: Optional[str] = None
class-attribute
instance-attribute
¶
html_url: Optional[str] = None
class-attribute
instance-attribute
¶
license: Optional[GithubLicense] = None
class-attribute
instance-attribute
¶
name: Optional[str] = None
class-attribute
instance-attribute
¶
owner: Optional[GithubOwner] = None
class-attribute
instance-attribute
¶
private: bool = False
class-attribute
instance-attribute
¶
pushed_at: Optional[str] = None
class-attribute
instance-attribute
¶
resources: List[GithubResource] = []
class-attribute
instance-attribute
¶
topics: List[str] = []
class-attribute
instance-attribute
¶
updated_at: Optional[str] = None
class-attribute
instance-attribute
¶
from_dp(package)
classmethod
¶
Create a Github Package from Data Package
Parameters:
Name | Type | Description | Default |
---|---|---|---|
package |
Package
|
Data Package |
required |
Returns:
Type | Description |
---|---|
GithubPackage
|
Github Package |
Source code in dplib/plugins/github/models/package.py
to_dp()
¶
Convert to Data Package
Returns:
Type | Description |
---|---|
Package
|
Data Package |
Source code in dplib/plugins/github/models/package.py
dplib.plugins.github.models.GithubResource
¶
Bases: Model
Github Resource model
Source code in dplib/plugins/github/models/resource.py
content: Optional[str] = None
class-attribute
instance-attribute
¶
download_url: Optional[str] = None
class-attribute
instance-attribute
¶
encoding: Optional[str] = None
class-attribute
instance-attribute
¶
html_url: Optional[str] = None
class-attribute
instance-attribute
¶
name: str
instance-attribute
¶
path: str
instance-attribute
¶
sha: Optional[str] = None
class-attribute
instance-attribute
¶
size: Optional[int] = None
class-attribute
instance-attribute
¶
type: Literal['file'] = 'file'
class-attribute
instance-attribute
¶
from_dp(resource)
classmethod
¶
Create Github Resource from Data Resource
Parameters:
Name | Type | Description | Default |
---|---|---|---|
resource |
Resource
|
Data Resource |
required |
Returns:
Type | Description |
---|---|
Optional[GithubResource]
|
Github Resource |