data-languages 1.0.2__tar.gz → 1.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {data_languages-1.0.2 → data_languages-1.0.4}/PKG-INFO +154 -136
- {data_languages-1.0.2 → data_languages-1.0.4}/docs/README.md +98 -79
- {data_languages-1.0.2 → data_languages-1.0.4}/pyproject.toml +6 -7
- {data_languages-1.0.2 → data_languages-1.0.4}/setup.cfg +7 -7
- {data_languages-1.0.2 → data_languages-1.0.4}/src/data_languages/data-languages.json +190 -190
- {data_languages-1.0.2 → data_languages-1.0.4}/src/data_languages.egg-info/PKG-INFO +154 -136
- data_languages-1.0.4/src/data_languages.egg-info/requires.txt +6 -0
- data_languages-1.0.2/src/data_languages.egg-info/requires.txt +0 -5
- {data_languages-1.0.2 → data_languages-1.0.4}/docs/LICENSE.md +0 -0
- {data_languages-1.0.2 → data_languages-1.0.4}/src/data_languages/__init__.py +0 -0
- {data_languages-1.0.2 → data_languages-1.0.4}/src/data_languages.egg-info/SOURCES.txt +0 -0
- {data_languages-1.0.2 → data_languages-1.0.4}/src/data_languages.egg-info/dependency_links.txt +0 -0
- {data_languages-1.0.2 → data_languages-1.0.4}/src/data_languages.egg-info/top_level.txt +0 -0
|
@@ -1,136 +1,154 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: data-languages
|
|
3
|
-
Version: 1.0.
|
|
4
|
-
Summary: File extensions for data languages.
|
|
5
|
-
Author-email: Adam Lui <adam@kudoai.com>
|
|
6
|
-
License-Expression: MIT
|
|
7
|
-
Project-URL: Changelog, https://github.com/adamlui/python-utils/releases/tag/data-languages-1.0.
|
|
8
|
-
Project-URL: Documentation, https://github.com/adamlui/python-utils/tree/main/data-languages/docs
|
|
9
|
-
Project-URL: Funding, https://github.com/sponsors/adamlui
|
|
10
|
-
Project-URL: Homepage, https://github.com/adamlui/python-utils/tree/main/data-languages/#readme
|
|
11
|
-
Project-URL: Issues, https://github.com/adamlui/python-utils/issues
|
|
12
|
-
Project-URL: PyPI Stats, https://pepy.tech/projects/data-languages
|
|
13
|
-
Project-URL: Releases, https://github.com/adamlui/python-utils/releases
|
|
14
|
-
Project-URL: Repository, https://github.com/adamlui/python-utils
|
|
15
|
-
Keywords: computer-languages,csv,data-languages,extensions,file-extensions,file‑type-detection,filenames,github,json,language-detection,languages,linguist,syntax-highlighting,toml,xml,yaml
|
|
16
|
-
Classifier: Development Status :: 5 - Production/Stable
|
|
17
|
-
Classifier: Intended Audience :: Developers
|
|
18
|
-
Classifier: Intended Audience :: Education
|
|
19
|
-
Classifier: Intended Audience :: Information Technology
|
|
20
|
-
Classifier: Intended Audience :: Science/Research
|
|
21
|
-
Classifier: Intended Audience :: System Administrators
|
|
22
|
-
Classifier: Natural Language :: English
|
|
23
|
-
Classifier: Operating System :: OS Independent
|
|
24
|
-
Classifier: Programming Language :: Python
|
|
25
|
-
Classifier: Programming Language :: Python :: 2
|
|
26
|
-
Classifier: Programming Language :: Python :: 2.6
|
|
27
|
-
Classifier: Programming Language :: Python :: 2.7
|
|
28
|
-
Classifier: Programming Language :: Python :: 3
|
|
29
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
30
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
31
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
32
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
33
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
34
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
35
|
-
Classifier: Programming Language :: Python :: 3.14
|
|
36
|
-
Classifier: Programming Language :: Python :: 3.15
|
|
37
|
-
Classifier: Topic :: Database
|
|
38
|
-
Classifier: Topic :: Education
|
|
39
|
-
Classifier: Topic ::
|
|
40
|
-
Classifier: Topic ::
|
|
41
|
-
Classifier: Topic ::
|
|
42
|
-
Classifier: Topic ::
|
|
43
|
-
Classifier: Topic :: Software Development
|
|
44
|
-
Classifier: Topic ::
|
|
45
|
-
Classifier: Topic ::
|
|
46
|
-
Classifier: Topic ::
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
Requires-Dist:
|
|
54
|
-
Requires-Dist: tomli<
|
|
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
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: data-languages
|
|
3
|
+
Version: 1.0.4
|
|
4
|
+
Summary: File extensions for data languages.
|
|
5
|
+
Author-email: Adam Lui <adam@kudoai.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Changelog, https://github.com/adamlui/python-utils/releases/tag/data-languages-1.0.4
|
|
8
|
+
Project-URL: Documentation, https://github.com/adamlui/python-utils/tree/main/data-languages/docs
|
|
9
|
+
Project-URL: Funding, https://github.com/sponsors/adamlui
|
|
10
|
+
Project-URL: Homepage, https://github.com/adamlui/python-utils/tree/main/data-languages/#readme
|
|
11
|
+
Project-URL: Issues, https://github.com/adamlui/python-utils/issues
|
|
12
|
+
Project-URL: PyPI Stats, https://pepy.tech/projects/data-languages
|
|
13
|
+
Project-URL: Releases, https://github.com/adamlui/python-utils/releases
|
|
14
|
+
Project-URL: Repository, https://github.com/adamlui/python-utils
|
|
15
|
+
Keywords: computer-languages,csv,data-languages,extensions,file-extensions,file‑type-detection,filenames,github,json,language-detection,languages,linguist,syntax-highlighting,toml,xml,yaml
|
|
16
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
17
|
+
Classifier: Intended Audience :: Developers
|
|
18
|
+
Classifier: Intended Audience :: Education
|
|
19
|
+
Classifier: Intended Audience :: Information Technology
|
|
20
|
+
Classifier: Intended Audience :: Science/Research
|
|
21
|
+
Classifier: Intended Audience :: System Administrators
|
|
22
|
+
Classifier: Natural Language :: English
|
|
23
|
+
Classifier: Operating System :: OS Independent
|
|
24
|
+
Classifier: Programming Language :: Python
|
|
25
|
+
Classifier: Programming Language :: Python :: 2
|
|
26
|
+
Classifier: Programming Language :: Python :: 2.6
|
|
27
|
+
Classifier: Programming Language :: Python :: 2.7
|
|
28
|
+
Classifier: Programming Language :: Python :: 3
|
|
29
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
30
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
31
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
32
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
33
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
34
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
35
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
37
|
+
Classifier: Topic :: Database
|
|
38
|
+
Classifier: Topic :: Education
|
|
39
|
+
Classifier: Topic :: Scientific/Engineering
|
|
40
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
41
|
+
Classifier: Topic :: Software Development
|
|
42
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
43
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
44
|
+
Classifier: Topic :: Text Processing
|
|
45
|
+
Classifier: Topic :: Text Processing :: General
|
|
46
|
+
Classifier: Topic :: Utilities
|
|
47
|
+
Requires-Python: <4,>=2.6
|
|
48
|
+
Description-Content-Type: text/markdown
|
|
49
|
+
License-File: docs/LICENSE.md
|
|
50
|
+
Provides-Extra: dev
|
|
51
|
+
Requires-Dist: nox>=2026.4.10; extra == "dev"
|
|
52
|
+
Requires-Dist: pre-commit<5,>=4.5.1; extra == "dev"
|
|
53
|
+
Requires-Dist: tomli<3,>=2.4.1; extra == "dev"
|
|
54
|
+
Requires-Dist: tomli-w<2,>=1.2.0; extra == "dev"
|
|
55
|
+
Dynamic: license-file
|
|
56
|
+
|
|
57
|
+
<a id="top"></a>
|
|
58
|
+
|
|
59
|
+
# > data-languages
|
|
60
|
+
|
|
61
|
+
<a href="https://pepy.tech/projects/data-languages?versions=*">
|
|
62
|
+
<img height=31 src="https://img.shields.io/pepy/dt/data-languages?logo=weightsandbiases&color=af68ff&logoColor=white&labelColor=464646&style=for-the-badge"></a>
|
|
63
|
+
<a href="https://github.com/adamlui/python-utils/releases/tag/data-languages-1.0.4">
|
|
64
|
+
<img height=31 src="https://img.shields.io/badge/Latest_Build-1.0.4-32fcee.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
|
|
65
|
+
<a href="https://github.com/adamlui/python-utils/blob/main/data-languages/docs/LICENSE.md">
|
|
66
|
+
<img height=31 src="https://img.shields.io/badge/License-MIT-f99b27.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
|
|
67
|
+
<a href="https://www.codefactor.io/repository/github/adamlui/python-utils">
|
|
68
|
+
<img height=31 src="https://img.shields.io/codefactor/grade/github/adamlui/python-utils?label=Code+Quality&logo=codefactor&logoColor=white&labelColor=464646&color=a0fc55&style=for-the-badge"></a>
|
|
69
|
+
<a href="https://sonarcloud.io/component_measures?metric=vulnerabilities&selected=adamlui_python-utils%3Adata-languages&id=adamlui_python-utils">
|
|
70
|
+
<img height=31 src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fsonarcloud.io%2Fapi%2Fmeasures%2Fcomponent%3Fcomponent%3Dadamlui_python-utils%3Adata-languages%26metricKeys%3Dvulnerabilities&query=%24.component.measures.0.value&style=for-the-badge&logo=sonar&logoColor=white&labelColor=464646&label=Vulnerabilities&color=fafc74"></a>
|
|
71
|
+
|
|
72
|
+
> ### _File extensions for data languages._
|
|
73
|
+
|
|
74
|
+
It's just a [JSON file](https://cdn.jsdelivr.net/gh/adamlui/python-utils@data-languages-1.0.4/data-languages/src/data_languages/data-languages.json), so you can use it in any environment. Sourced from GitHub's [Linguist](https://github.com/github-linguist/linguist) project (defines all 145 data languages known to GitHub). Data is updated via script and released via new package version.
|
|
75
|
+
|
|
76
|
+
<img height=175 width="auto" src="https://cdn.jsdelivr.net/gh/adamlui/python-utils@data-languages-1.0.4/data-languages/assets/images/dataset-preview.png">
|
|
77
|
+
|
|
78
|
+
<a href="#"><img style="height:10px ; width:100%" src="https://cdn.jsdelivr.net/gh/adamlui/js-utils@7da7074/assets/images/separators/aqua-gradient.png"></a>
|
|
79
|
+
|
|
80
|
+
## Installation
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
pip install data-languages
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
<hr>
|
|
87
|
+
|
|
88
|
+
## Usage
|
|
89
|
+
|
|
90
|
+
```py
|
|
91
|
+
import data_languages
|
|
92
|
+
|
|
93
|
+
json_lang_data = data_languages['JSON']
|
|
94
|
+
|
|
95
|
+
print(json_lang_data['extensions']) # => ['.4DForm', '.4DProject', '.avsc', ...]
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
_Note: Most type checkers will falsely warn_ `data_languages` _is not subscriptable because they are incapable of analyzing runtime behavior (where the module is replaced w/ a dictionary for cleaner, direct access). You can safely suppress such warnings using_ `# type: ignore`.
|
|
99
|
+
|
|
100
|
+
<hr>
|
|
101
|
+
|
|
102
|
+
## Examples
|
|
103
|
+
|
|
104
|
+
Get language(s) from an extension:
|
|
105
|
+
|
|
106
|
+
```py
|
|
107
|
+
def get_lang(file_ext):
|
|
108
|
+
lang_matches = [
|
|
109
|
+
lang for lang, data in data_languages.items()
|
|
110
|
+
if file_ext in data['extensions']
|
|
111
|
+
]
|
|
112
|
+
return lang_matches[0] if len(lang_matches) == 1 else lang_matches
|
|
113
|
+
|
|
114
|
+
print(get_lang('.ical')) # => iCalendar
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Get language(s) from a file path:
|
|
118
|
+
|
|
119
|
+
```py
|
|
120
|
+
def get_lang_from_path(filepath):
|
|
121
|
+
from pathlib import Path
|
|
122
|
+
file_ext = Path(filepath).suffix
|
|
123
|
+
lang_matches = [
|
|
124
|
+
lang for lang, data in data_languages.items()
|
|
125
|
+
if file_ext in data['extensions']
|
|
126
|
+
]
|
|
127
|
+
return lang_matches[0] if len(matches) == 1 else lang_matches
|
|
128
|
+
|
|
129
|
+
print(get_lang_from_path('steam.vdf')) # => Valve Data Format
|
|
130
|
+
print(get_lang_from_path('Sublime.sublime-snippet')) # => XML
|
|
131
|
+
print(get_lang_from_path('README.md')) # => [] (use prose-languages pkg)
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
<hr>
|
|
135
|
+
|
|
136
|
+
## MIT License
|
|
137
|
+
|
|
138
|
+
Copyright © 2026 [Adam Lui](https://github.com/adamlui)
|
|
139
|
+
|
|
140
|
+
<hr>
|
|
141
|
+
|
|
142
|
+
## Related
|
|
143
|
+
|
|
144
|
+
</> [markup-languages](https://github.com/adamlui/python-utils/tree/main/markup-languages/#readme) - File extensions for markup languages.
|
|
145
|
+
<br>🇨🇳 [non-latin-locales](https://github.com/adamlui/python-utils/tree/main/non-latin-locales/#readme) - ISO 639-1 (2-letter) codes for non-Latin locales.
|
|
146
|
+
<br>#! [programming-languages](https://github.com/adamlui/python-utils/tree/main/programming-languages/#readme) - File extensions for programming languages.
|
|
147
|
+
|
|
148
|
+
<a href="#"><img style="height:10px ; width:100%" src="https://cdn.jsdelivr.net/gh/adamlui/python-utils@b8b2932/assets/images/separators/aqua-gradient.png"></a>
|
|
149
|
+
|
|
150
|
+
<picture><source media="(prefers-color-scheme: dark)" srcset="https://cdn.jsdelivr.net/gh/adamlui/python-utils@760599e/assets/images/icons/home/white/icon32x27.png"><img height=13 src="https://cdn.jsdelivr.net/gh/adamlui/python-utils@760599e/assets/images/icons/home/dark-gray/icon32x27.png"></picture> <a href=https://github.com/adamlui/python-utils/#readme>**More Python utilities**</a> /
|
|
151
|
+
<a href="https://github.com/adamlui/python-utils/discussions">Discuss</a> /
|
|
152
|
+
<a href="https://github.com/adamlui/python-utils/issues">Report bug</a> /
|
|
153
|
+
<a href="mailto:security@tidelift.com">Report vulnerability</a> /
|
|
154
|
+
<a href="#top">Back to top ↑</a>
|
|
@@ -1,79 +1,98 @@
|
|
|
1
|
-
<a id="top"></a>
|
|
2
|
-
|
|
3
|
-
# > data-languages
|
|
4
|
-
|
|
5
|
-
<a href="https://pepy.tech/projects/data-languages?versions=*">
|
|
6
|
-
<img height=31 src="https://img.shields.io/pepy/dt/data-languages?logo=weightsandbiases&color=af68ff&logoColor=white&labelColor=464646&style=for-the-badge"></
|
|
7
|
-
<a href="https://github.com/adamlui/python-utils/releases/tag/data-languages-1.0.
|
|
8
|
-
<img height=31 src="https://img.shields.io/badge/Latest_Build-1.0.
|
|
9
|
-
<a href="https://github.com/adamlui/python-utils/blob/main/data-languages/docs/LICENSE.md">
|
|
10
|
-
<img height=31 src="https://img.shields.io/badge/License-MIT-f99b27.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
|
|
11
|
-
<a href="https://www.codefactor.io/repository/github/adamlui/python-utils">
|
|
12
|
-
<img height=31 src="https://img.shields.io/codefactor/grade/github/adamlui/python-utils?label=Code+Quality&logo=codefactor&logoColor=white&labelColor=464646&color=a0fc55&style=for-the-badge"></a>
|
|
13
|
-
<a href="https://sonarcloud.io/component_measures?metric=vulnerabilities&selected=adamlui_python-utils%3Adata-languages&id=adamlui_python-utils">
|
|
14
|
-
<img height=31 src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fsonarcloud.io%2Fapi%2Fmeasures%2Fcomponent%3Fcomponent%3Dadamlui_python-utils%26metricKeys%3Dvulnerabilities&query=%24.component.measures.0.value&style=for-the-badge&logo=sonar&logoColor=white&labelColor=464646&label=Vulnerabilities&color=fafc74"></a>
|
|
15
|
-
|
|
16
|
-
> ### _File extensions for data languages._
|
|
17
|
-
|
|
18
|
-
It's just a [JSON file](https://cdn.jsdelivr.net/gh/adamlui/python-utils@data-languages-1.0.
|
|
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
|
-
|
|
1
|
+
<a id="top"></a>
|
|
2
|
+
|
|
3
|
+
# > data-languages
|
|
4
|
+
|
|
5
|
+
<a href="https://pepy.tech/projects/data-languages?versions=*">
|
|
6
|
+
<img height=31 src="https://img.shields.io/pepy/dt/data-languages?logo=weightsandbiases&color=af68ff&logoColor=white&labelColor=464646&style=for-the-badge"></a>
|
|
7
|
+
<a href="https://github.com/adamlui/python-utils/releases/tag/data-languages-1.0.4">
|
|
8
|
+
<img height=31 src="https://img.shields.io/badge/Latest_Build-1.0.4-32fcee.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
|
|
9
|
+
<a href="https://github.com/adamlui/python-utils/blob/main/data-languages/docs/LICENSE.md">
|
|
10
|
+
<img height=31 src="https://img.shields.io/badge/License-MIT-f99b27.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
|
|
11
|
+
<a href="https://www.codefactor.io/repository/github/adamlui/python-utils">
|
|
12
|
+
<img height=31 src="https://img.shields.io/codefactor/grade/github/adamlui/python-utils?label=Code+Quality&logo=codefactor&logoColor=white&labelColor=464646&color=a0fc55&style=for-the-badge"></a>
|
|
13
|
+
<a href="https://sonarcloud.io/component_measures?metric=vulnerabilities&selected=adamlui_python-utils%3Adata-languages&id=adamlui_python-utils">
|
|
14
|
+
<img height=31 src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fsonarcloud.io%2Fapi%2Fmeasures%2Fcomponent%3Fcomponent%3Dadamlui_python-utils%3Adata-languages%26metricKeys%3Dvulnerabilities&query=%24.component.measures.0.value&style=for-the-badge&logo=sonar&logoColor=white&labelColor=464646&label=Vulnerabilities&color=fafc74"></a>
|
|
15
|
+
|
|
16
|
+
> ### _File extensions for data languages._
|
|
17
|
+
|
|
18
|
+
It's just a [JSON file](https://cdn.jsdelivr.net/gh/adamlui/python-utils@data-languages-1.0.4/data-languages/src/data_languages/data-languages.json), so you can use it in any environment. Sourced from GitHub's [Linguist](https://github.com/github-linguist/linguist) project (defines all 145 data languages known to GitHub). Data is updated via script and released via new package version.
|
|
19
|
+
|
|
20
|
+
<img height=175 width="auto" src="https://cdn.jsdelivr.net/gh/adamlui/python-utils@data-languages-1.0.4/data-languages/assets/images/dataset-preview.png">
|
|
21
|
+
|
|
22
|
+
<a href="#"><img style="height:10px ; width:100%" src="https://cdn.jsdelivr.net/gh/adamlui/js-utils@7da7074/assets/images/separators/aqua-gradient.png"></a>
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pip install data-languages
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
<hr>
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
```py
|
|
35
|
+
import data_languages
|
|
36
|
+
|
|
37
|
+
json_lang_data = data_languages['JSON']
|
|
38
|
+
|
|
39
|
+
print(json_lang_data['extensions']) # => ['.4DForm', '.4DProject', '.avsc', ...]
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
_Note: Most type checkers will falsely warn_ `data_languages` _is not subscriptable because they are incapable of analyzing runtime behavior (where the module is replaced w/ a dictionary for cleaner, direct access). You can safely suppress such warnings using_ `# type: ignore`.
|
|
43
|
+
|
|
44
|
+
<hr>
|
|
45
|
+
|
|
46
|
+
## Examples
|
|
47
|
+
|
|
48
|
+
Get language(s) from an extension:
|
|
49
|
+
|
|
50
|
+
```py
|
|
51
|
+
def get_lang(file_ext):
|
|
52
|
+
lang_matches = [
|
|
53
|
+
lang for lang, data in data_languages.items()
|
|
54
|
+
if file_ext in data['extensions']
|
|
55
|
+
]
|
|
56
|
+
return lang_matches[0] if len(lang_matches) == 1 else lang_matches
|
|
57
|
+
|
|
58
|
+
print(get_lang('.ical')) # => iCalendar
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Get language(s) from a file path:
|
|
62
|
+
|
|
63
|
+
```py
|
|
64
|
+
def get_lang_from_path(filepath):
|
|
65
|
+
from pathlib import Path
|
|
66
|
+
file_ext = Path(filepath).suffix
|
|
67
|
+
lang_matches = [
|
|
68
|
+
lang for lang, data in data_languages.items()
|
|
69
|
+
if file_ext in data['extensions']
|
|
70
|
+
]
|
|
71
|
+
return lang_matches[0] if len(matches) == 1 else lang_matches
|
|
72
|
+
|
|
73
|
+
print(get_lang_from_path('steam.vdf')) # => Valve Data Format
|
|
74
|
+
print(get_lang_from_path('Sublime.sublime-snippet')) # => XML
|
|
75
|
+
print(get_lang_from_path('README.md')) # => [] (use prose-languages pkg)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
<hr>
|
|
79
|
+
|
|
80
|
+
## MIT License
|
|
81
|
+
|
|
82
|
+
Copyright © 2026 [Adam Lui](https://github.com/adamlui)
|
|
83
|
+
|
|
84
|
+
<hr>
|
|
85
|
+
|
|
86
|
+
## Related
|
|
87
|
+
|
|
88
|
+
</> [markup-languages](https://github.com/adamlui/python-utils/tree/main/markup-languages/#readme) - File extensions for markup languages.
|
|
89
|
+
<br>🇨🇳 [non-latin-locales](https://github.com/adamlui/python-utils/tree/main/non-latin-locales/#readme) - ISO 639-1 (2-letter) codes for non-Latin locales.
|
|
90
|
+
<br>#! [programming-languages](https://github.com/adamlui/python-utils/tree/main/programming-languages/#readme) - File extensions for programming languages.
|
|
91
|
+
|
|
92
|
+
<a href="#"><img style="height:10px ; width:100%" src="https://cdn.jsdelivr.net/gh/adamlui/python-utils@b8b2932/assets/images/separators/aqua-gradient.png"></a>
|
|
93
|
+
|
|
94
|
+
<picture><source media="(prefers-color-scheme: dark)" srcset="https://cdn.jsdelivr.net/gh/adamlui/python-utils@760599e/assets/images/icons/home/white/icon32x27.png"><img height=13 src="https://cdn.jsdelivr.net/gh/adamlui/python-utils@760599e/assets/images/icons/home/dark-gray/icon32x27.png"></picture> <a href=https://github.com/adamlui/python-utils/#readme>**More Python utilities**</a> /
|
|
95
|
+
<a href="https://github.com/adamlui/python-utils/discussions">Discuss</a> /
|
|
96
|
+
<a href="https://github.com/adamlui/python-utils/issues">Report bug</a> /
|
|
97
|
+
<a href="mailto:security@tidelift.com">Report vulnerability</a> /
|
|
98
|
+
<a href="#top">Back to top ↑</a>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
[build-system]
|
|
2
2
|
requires = [
|
|
3
|
-
"setuptools>=82.0.
|
|
3
|
+
"setuptools>=82.0.1,<83",
|
|
4
4
|
"wheel",
|
|
5
5
|
]
|
|
6
6
|
build-backend = "setuptools.build_meta"
|
|
7
7
|
|
|
8
8
|
[project]
|
|
9
9
|
name = "data-languages"
|
|
10
|
-
version = "1.0.
|
|
10
|
+
version = "1.0.4"
|
|
11
11
|
description = "File extensions for data languages."
|
|
12
12
|
authors = [
|
|
13
13
|
{ name = "Adam Lui", email = "adam@kudoai.com" },
|
|
@@ -60,8 +60,6 @@ classifiers = [
|
|
|
60
60
|
"Programming Language :: Python :: 3.15",
|
|
61
61
|
"Topic :: Database",
|
|
62
62
|
"Topic :: Education",
|
|
63
|
-
"Topic :: Internet",
|
|
64
|
-
"Topic :: Internet :: WWW/HTTP",
|
|
65
63
|
"Topic :: Scientific/Engineering",
|
|
66
64
|
"Topic :: Scientific/Engineering :: Information Analysis",
|
|
67
65
|
"Topic :: Software Development",
|
|
@@ -73,7 +71,7 @@ classifiers = [
|
|
|
73
71
|
]
|
|
74
72
|
|
|
75
73
|
[project.urls]
|
|
76
|
-
Changelog = "https://github.com/adamlui/python-utils/releases/tag/data-languages-1.0.
|
|
74
|
+
Changelog = "https://github.com/adamlui/python-utils/releases/tag/data-languages-1.0.4"
|
|
77
75
|
Documentation = "https://github.com/adamlui/python-utils/tree/main/data-languages/docs"
|
|
78
76
|
Funding = "https://github.com/sponsors/adamlui"
|
|
79
77
|
Homepage = "https://github.com/adamlui/python-utils/tree/main/data-languages/#readme"
|
|
@@ -84,8 +82,9 @@ Repository = "https://github.com/adamlui/python-utils"
|
|
|
84
82
|
|
|
85
83
|
[project.optional-dependencies]
|
|
86
84
|
dev = [
|
|
87
|
-
"nox>=2026.
|
|
88
|
-
"
|
|
85
|
+
"nox>=2026.4.10",
|
|
86
|
+
"pre-commit>=4.5.1,<5",
|
|
87
|
+
"tomli>=2.4.1,<3",
|
|
89
88
|
"tomli-w>=1.2.0,<2",
|
|
90
89
|
]
|
|
91
90
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
[bdist_wheel]
|
|
2
|
-
universal = 1
|
|
3
|
-
|
|
4
|
-
[egg_info]
|
|
5
|
-
tag_build =
|
|
6
|
-
tag_date = 0
|
|
7
|
-
|
|
1
|
+
[bdist_wheel]
|
|
2
|
+
universal = 1
|
|
3
|
+
|
|
4
|
+
[egg_info]
|
|
5
|
+
tag_build =
|
|
6
|
+
tag_date = 0
|
|
7
|
+
|