py2ecma 0.0.2__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.
Files changed (169) hide show
  1. py2ecma-0.0.2/.coveragerc +4 -0
  2. py2ecma-0.0.2/.envrc +2 -0
  3. py2ecma-0.0.2/.gitignore +275 -0
  4. py2ecma-0.0.2/.gitlab-ci.yml +239 -0
  5. py2ecma-0.0.2/Dockerfile +49 -0
  6. py2ecma-0.0.2/LICENSE-2.0.txt +202 -0
  7. py2ecma-0.0.2/Makefile +176 -0
  8. py2ecma-0.0.2/PKG-INFO +26 -0
  9. py2ecma-0.0.2/README.md +11 -0
  10. py2ecma-0.0.2/conftest.py +5 -0
  11. py2ecma-0.0.2/docs/Makefile +20 -0
  12. py2ecma-0.0.2/docs/source/api/modules.rst +7 -0
  13. py2ecma-0.0.2/docs/source/api/py2ecma.codegenerator.rst +46 -0
  14. py2ecma-0.0.2/docs/source/api/py2ecma.dependency.rst +46 -0
  15. py2ecma-0.0.2/docs/source/api/py2ecma.lexer.rst +22 -0
  16. py2ecma-0.0.2/docs/source/api/py2ecma.linker.rst +30 -0
  17. py2ecma-0.0.2/docs/source/api/py2ecma.modules.rst +62 -0
  18. py2ecma-0.0.2/docs/source/api/py2ecma.rst +45 -0
  19. py2ecma-0.0.2/docs/source/api/py2ecma.watcher.rst +22 -0
  20. py2ecma-0.0.2/docs/source/conf.py +182 -0
  21. py2ecma-0.0.2/docs/source/index.rst +20 -0
  22. py2ecma-0.0.2/py.typed +0 -0
  23. py2ecma-0.0.2/pyproject.toml +85 -0
  24. py2ecma-0.0.2/run.sh +3 -0
  25. py2ecma-0.0.2/scripts/README.md +6 -0
  26. py2ecma-0.0.2/scripts/build.sh +5 -0
  27. py2ecma-0.0.2/scripts/check.sh +3 -0
  28. py2ecma-0.0.2/scripts/deploy.sh +1 -0
  29. py2ecma-0.0.2/scripts/format.sh +5 -0
  30. py2ecma-0.0.2/scripts/install.sh +10 -0
  31. py2ecma-0.0.2/scripts/install_ci.sh +10 -0
  32. py2ecma-0.0.2/scripts/install_from_requirements.sh +3 -0
  33. py2ecma-0.0.2/scripts/install_pkg.sh +12 -0
  34. py2ecma-0.0.2/scripts/install_runtime.sh +6 -0
  35. py2ecma-0.0.2/scripts/release.sh +3 -0
  36. py2ecma-0.0.2/scripts/tests-cov.sh +4 -0
  37. py2ecma-0.0.2/scripts/tests.sh +3 -0
  38. py2ecma-0.0.2/scripts/verify.sh +10 -0
  39. py2ecma-0.0.2/scripts/version.sh +19 -0
  40. py2ecma-0.0.2/scripts/version_patch.sh +10 -0
  41. py2ecma-0.0.2/scripts/version_sanitized.sh +11 -0
  42. py2ecma-0.0.2/src/py2ecma/__init__.py +10 -0
  43. py2ecma-0.0.2/src/py2ecma/__main__.py +146 -0
  44. py2ecma-0.0.2/src/py2ecma/arguments.py +152 -0
  45. py2ecma-0.0.2/src/py2ecma/codegenerator/__init__.py +0 -0
  46. py2ecma-0.0.2/src/py2ecma/codegenerator/enums.py +19 -0
  47. py2ecma-0.0.2/src/py2ecma/codegenerator/nameconverter.py +10 -0
  48. py2ecma-0.0.2/src/py2ecma/codegenerator/nintermediate/__init__.py +18 -0
  49. py2ecma-0.0.2/src/py2ecma/codegenerator/nintermediate/asyncs.py +32 -0
  50. py2ecma-0.0.2/src/py2ecma/codegenerator/nintermediate/classes.py +303 -0
  51. py2ecma-0.0.2/src/py2ecma/codegenerator/nintermediate/comprehensions.py +72 -0
  52. py2ecma-0.0.2/src/py2ecma/codegenerator/nintermediate/controlflow.py +135 -0
  53. py2ecma-0.0.2/src/py2ecma/codegenerator/nintermediate/expressions.py +320 -0
  54. py2ecma-0.0.2/src/py2ecma/codegenerator/nintermediate/functions.py +187 -0
  55. py2ecma-0.0.2/src/py2ecma/codegenerator/nintermediate/imports.py +51 -0
  56. py2ecma-0.0.2/src/py2ecma/codegenerator/nintermediate/literals.py +133 -0
  57. py2ecma-0.0.2/src/py2ecma/codegenerator/nintermediate/module.py +113 -0
  58. py2ecma-0.0.2/src/py2ecma/codegenerator/nintermediate/node.py +29 -0
  59. py2ecma-0.0.2/src/py2ecma/codegenerator/nintermediate/statements.py +104 -0
  60. py2ecma-0.0.2/src/py2ecma/codegenerator/nintermediate/subscripting.py +56 -0
  61. py2ecma-0.0.2/src/py2ecma/codegenerator/nintermediate/variables.py +24 -0
  62. py2ecma-0.0.2/src/py2ecma/codegenerator/optimizer.py +121 -0
  63. py2ecma-0.0.2/src/py2ecma/codegenerator/parser.py +642 -0
  64. py2ecma-0.0.2/src/py2ecma/codegenerator/specialcases.py +12 -0
  65. py2ecma-0.0.2/src/py2ecma/codegenerator/traversers.py +91 -0
  66. py2ecma-0.0.2/src/py2ecma/conf.py +48 -0
  67. py2ecma-0.0.2/src/py2ecma/dependency/__init__.py +0 -0
  68. py2ecma-0.0.2/src/py2ecma/dependency/excludes.py +6 -0
  69. py2ecma-0.0.2/src/py2ecma/dependency/getdeps.py +83 -0
  70. py2ecma-0.0.2/src/py2ecma/dependency/sortedset.py +60 -0
  71. py2ecma-0.0.2/src/py2ecma/dependency/spec.py +57 -0
  72. py2ecma-0.0.2/src/py2ecma/filesystem.py +121 -0
  73. py2ecma-0.0.2/src/py2ecma/get_logger.py +64 -0
  74. py2ecma-0.0.2/src/py2ecma/javascript/base.js +1 -0
  75. py2ecma-0.0.2/src/py2ecma/javascript/builtins.js +339 -0
  76. py2ecma-0.0.2/src/py2ecma/javascript/classes.js +162 -0
  77. py2ecma-0.0.2/src/py2ecma/javascript/comprehensions.js +53 -0
  78. py2ecma-0.0.2/src/py2ecma/javascript/dict.js +131 -0
  79. py2ecma-0.0.2/src/py2ecma/javascript/exceptions.js +58 -0
  80. py2ecma-0.0.2/src/py2ecma/javascript/list.js +199 -0
  81. py2ecma-0.0.2/src/py2ecma/javascript/set.js +214 -0
  82. py2ecma-0.0.2/src/py2ecma/javascript/strings.js +60 -0
  83. py2ecma-0.0.2/src/py2ecma/lexer/__init__.py +0 -0
  84. py2ecma-0.0.2/src/py2ecma/lexer/syntaxtree.py +6 -0
  85. py2ecma-0.0.2/src/py2ecma/linker/__init__.py +0 -0
  86. py2ecma-0.0.2/src/py2ecma/linker/jsloader.py +66 -0
  87. py2ecma-0.0.2/src/py2ecma/linker/packager.py +91 -0
  88. py2ecma-0.0.2/src/py2ecma/main.py +45 -0
  89. py2ecma-0.0.2/src/py2ecma/minimizer/__init__.py +3 -0
  90. py2ecma-0.0.2/src/py2ecma/minimizer/closure.py +51 -0
  91. py2ecma-0.0.2/src/py2ecma/modules/__init__.py +0 -0
  92. py2ecma-0.0.2/src/py2ecma/modules/codecs.py +965 -0
  93. py2ecma-0.0.2/src/py2ecma/modules/collections.py +1462 -0
  94. py2ecma-0.0.2/src/py2ecma/modules/copy.py +52 -0
  95. py2ecma-0.0.2/src/py2ecma/modules/dataclasses.py +1337 -0
  96. py2ecma-0.0.2/src/py2ecma/modules/datetime.py +1953 -0
  97. py2ecma-0.0.2/src/py2ecma/modules/enum.py +945 -0
  98. py2ecma-0.0.2/src/py2ecma/modules/functools.py +912 -0
  99. py2ecma-0.0.2/src/py2ecma/modules/json.py +94 -0
  100. py2ecma-0.0.2/src/py2ecma/modules/keyword.py +101 -0
  101. py2ecma-0.0.2/src/py2ecma/modules/math.py +170 -0
  102. py2ecma-0.0.2/src/py2ecma/modules/operator.py +575 -0
  103. py2ecma-0.0.2/src/py2ecma/modules/re.py +415 -0
  104. py2ecma-0.0.2/src/py2ecma/modules/re_/__init__.py +838 -0
  105. py2ecma-0.0.2/src/py2ecma/modules/re_/translate.py +348 -0
  106. py2ecma-0.0.2/src/py2ecma/modules/sre_compile.py +0 -0
  107. py2ecma-0.0.2/src/py2ecma/modules/sre_constants.py +259 -0
  108. py2ecma-0.0.2/src/py2ecma/modules/sre_parse.py +1073 -0
  109. py2ecma-0.0.2/src/py2ecma/modules/stubs.py +1 -0
  110. py2ecma-0.0.2/src/py2ecma/modules/sys.py +0 -0
  111. py2ecma-0.0.2/src/py2ecma/modules/time.py +539 -0
  112. py2ecma-0.0.2/src/py2ecma/modules/types.py +279 -0
  113. py2ecma-0.0.2/src/py2ecma/progress.py +103 -0
  114. py2ecma-0.0.2/src/py2ecma/py.typed +0 -0
  115. py2ecma-0.0.2/src/py2ecma/transpiler.py +184 -0
  116. py2ecma-0.0.2/src/py2ecma/watcher/__init__.py +0 -0
  117. py2ecma-0.0.2/src/py2ecma/watcher/autocompile.py +42 -0
  118. py2ecma-0.0.2/tests/__init__.py +0 -0
  119. py2ecma-0.0.2/tests/advanced/macros.py +9 -0
  120. py2ecma-0.0.2/tests/advanced/test_getters.py +54 -0
  121. py2ecma-0.0.2/tests/advanced/test_setters.py +52 -0
  122. py2ecma-0.0.2/tests/helpers.py +355 -0
  123. py2ecma-0.0.2/tests/imports/__init__.py +0 -0
  124. py2ecma-0.0.2/tests/imports/resources/module/__init__.py +11 -0
  125. py2ecma-0.0.2/tests/imports/resources/module/testthis.py +2 -0
  126. py2ecma-0.0.2/tests/imports/resources/relative/__init__.py +1 -0
  127. py2ecma-0.0.2/tests/imports/resources/relative/rel.py +5 -0
  128. py2ecma-0.0.2/tests/imports/resources/relative/sec.py +1 -0
  129. py2ecma-0.0.2/tests/imports/resources/shared/__init__.py +1 -0
  130. py2ecma-0.0.2/tests/imports/resources/shared/sharedlib.py +3 -0
  131. py2ecma-0.0.2/tests/imports/resources/src/sharedt.py +5 -0
  132. py2ecma-0.0.2/tests/imports/resources/src/simple.py +2 -0
  133. py2ecma-0.0.2/tests/imports/resources/src/test.py +12 -0
  134. py2ecma-0.0.2/tests/imports/resources/test.py +7 -0
  135. py2ecma-0.0.2/tests/imports/simple.py +2 -0
  136. py2ecma-0.0.2/tests/imports/test.py +12 -0
  137. py2ecma-0.0.2/tests/imports/test_imports.py +53 -0
  138. py2ecma-0.0.2/tests/regression/__init__.py +0 -0
  139. py2ecma-0.0.2/tests/regression/test_asserts.py +12 -0
  140. py2ecma-0.0.2/tests/regression/test_boolean.py +128 -0
  141. py2ecma-0.0.2/tests/regression/test_builtins.py +144 -0
  142. py2ecma-0.0.2/tests/regression/test_classes.py +610 -0
  143. py2ecma-0.0.2/tests/regression/test_decorators.py +62 -0
  144. py2ecma-0.0.2/tests/regression/test_dicts.py +143 -0
  145. py2ecma-0.0.2/tests/regression/test_exceptions.py +41 -0
  146. py2ecma-0.0.2/tests/regression/test_flow.py +25 -0
  147. py2ecma-0.0.2/tests/regression/test_for.py +110 -0
  148. py2ecma-0.0.2/tests/regression/test_functions.py +171 -0
  149. py2ecma-0.0.2/tests/regression/test_inheritance.py +64 -0
  150. py2ecma-0.0.2/tests/regression/test_lambda.py +49 -0
  151. py2ecma-0.0.2/tests/regression/test_lists.py +306 -0
  152. py2ecma-0.0.2/tests/regression/test_methods.py +33 -0
  153. py2ecma-0.0.2/tests/regression/test_nummerical.py +106 -0
  154. py2ecma-0.0.2/tests/regression/test_sets.py +294 -0
  155. py2ecma-0.0.2/tests/regression/test_strings.py +72 -0
  156. py2ecma-0.0.2/tests/regression/test_tuple.py +32 -0
  157. py2ecma-0.0.2/tests/regression/test_variables.py +41 -0
  158. py2ecma-0.0.2/tests/regression/test_while.py +9 -0
  159. py2ecma-0.0.2/tests/resources/jsload.js +1 -0
  160. py2ecma-0.0.2/tests/simple.html +6 -0
  161. py2ecma-0.0.2/tests/simple.py +0 -0
  162. py2ecma-0.0.2/tests/stdlib/test_copy.py +81 -0
  163. py2ecma-0.0.2/tests/stdlib/test_json.py +31 -0
  164. py2ecma-0.0.2/tests/stdlib/test_math.py +9 -0
  165. py2ecma-0.0.2/tests/stdlib/test_re.py +20 -0
  166. py2ecma-0.0.2/tests/stdlib/test_time.py +46 -0
  167. py2ecma-0.0.2/uv.lock +1709 -0
  168. py2ecma-0.0.2/variables.env +1 -0
  169. py2ecma-0.0.2/version.txt +1 -0
@@ -0,0 +1,4 @@
1
+ [run]
2
+ omit =
3
+ py2ecma/modules/
4
+ py2ecma/modules/*
py2ecma-0.0.2/.envrc ADDED
@@ -0,0 +1,2 @@
1
+ export UV_VENV_CLEAR=0
2
+ source .venv/bin/activate
@@ -0,0 +1,275 @@
1
+ scratch/
2
+ bundle.js
3
+ .build
4
+ .mypy_cache/
5
+ __javascript__/
6
+ node_modules/
7
+ # Created by https://www.gitignore.io/api/vim,emacs,python,pycharm,textmate,intellij
8
+
9
+ ### Emacs ###
10
+ # -*- mode: gitignore; -*-
11
+ *~
12
+ \#*\#
13
+ /.emacs.desktop
14
+ /.emacs.desktop.lock
15
+ *.elc
16
+ auto-save-list
17
+ tramp
18
+ .\#*
19
+
20
+ # Org-mode
21
+ .org-id-locations
22
+ *_archive
23
+
24
+ # flymake-mode
25
+ *_flymake.*
26
+
27
+ # eshell files
28
+ /eshell/history
29
+ /eshell/lastdir
30
+
31
+ # elpa packages
32
+ /elpa/
33
+
34
+ # reftex files
35
+ *.rel
36
+
37
+ # AUCTeX auto folder
38
+ /auto/
39
+
40
+ # cask packages
41
+ .cask/
42
+ dist/
43
+
44
+ # Flycheck
45
+ flycheck_*.el
46
+
47
+ # server auth directory
48
+ /server/
49
+
50
+ # projectiles files
51
+ .projectile
52
+
53
+ # directory configuration
54
+ .dir-locals.el
55
+
56
+ ### Intellij ###
57
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
58
+ # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
59
+
60
+ # User-specific stuff:
61
+ .idea/**/workspace.xml
62
+ .idea/**/tasks.xml
63
+ .idea/dictionaries
64
+
65
+ # Sensitive or high-churn files:
66
+ .idea/**/dataSources/
67
+ .idea/**/dataSources.ids
68
+ .idea/**/dataSources.xml
69
+ .idea/**/dataSources.local.xml
70
+ .idea/**/sqlDataSources.xml
71
+ .idea/**/dynamic.xml
72
+ .idea/**/uiDesigner.xml
73
+
74
+ # Gradle:
75
+ .idea/**/gradle.xml
76
+ .idea/**/libraries
77
+
78
+ # CMake
79
+ cmake-build-debug/
80
+
81
+ # Mongo Explorer plugin:
82
+ .idea/**/mongoSettings.xml
83
+
84
+ ## File-based project format:
85
+ *.iws
86
+
87
+ ## Plugin-specific files:
88
+
89
+ # IntelliJ
90
+ /out/
91
+
92
+ # mpeltonen/sbt-idea plugin
93
+ .idea_modules/
94
+
95
+ # JIRA plugin
96
+ atlassian-ide-plugin.xml
97
+
98
+ # Cursive Clojure plugin
99
+ .idea/replstate.xml
100
+
101
+ # Crashlytics plugin (for Android Studio and IntelliJ)
102
+ com_crashlytics_export_strings.xml
103
+ crashlytics.properties
104
+ crashlytics-build.properties
105
+ fabric.properties
106
+
107
+ ### Intellij Patch ###
108
+ # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
109
+
110
+ # *.iml
111
+ # modules.xml
112
+ # .idea/misc.xml
113
+ # *.ipr
114
+
115
+ # Sonarlint plugin
116
+ .idea/sonarlint
117
+
118
+ ### PyCharm ###
119
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
120
+ # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
121
+
122
+ # User-specific stuff:
123
+
124
+ # Sensitive or high-churn files:
125
+
126
+ # Gradle:
127
+
128
+ # CMake
129
+
130
+ # Mongo Explorer plugin:
131
+
132
+ ## File-based project format:
133
+
134
+ ## Plugin-specific files:
135
+
136
+ # IntelliJ
137
+
138
+ # mpeltonen/sbt-idea plugin
139
+
140
+ # JIRA plugin
141
+
142
+ # Cursive Clojure plugin
143
+
144
+ # Crashlytics plugin (for Android Studio and IntelliJ)
145
+
146
+ ### PyCharm Patch ###
147
+ # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
148
+
149
+ # *.iml
150
+ # modules.xml
151
+ # .idea/misc.xml
152
+ # *.ipr
153
+
154
+ # Sonarlint plugin
155
+
156
+ ### Python ###
157
+ # Byte-compiled / optimized / DLL files
158
+ __pycache__/
159
+ *.py[cod]
160
+ *$py.class
161
+ .pytest_cache
162
+
163
+ # C extensions
164
+ *.so
165
+
166
+ # Distribution / packaging
167
+ .Python
168
+ env/
169
+ build/
170
+ develop-eggs/
171
+ downloads/
172
+ eggs/
173
+ .eggs/
174
+ lib/
175
+ lib64/
176
+ parts/
177
+ sdist/
178
+ var/
179
+ wheels/
180
+ *.egg-info/
181
+ .installed.cfg
182
+ *.egg
183
+
184
+ # PyInstaller
185
+ # Usually these files are written by a python script from a template
186
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
187
+ *.manifest
188
+ *.spec
189
+
190
+ # Installer logs
191
+ pip-log.txt
192
+ pip-delete-this-directory.txt
193
+
194
+ # Unit test / coverage reports
195
+ htmlcov/
196
+ .tox/
197
+ .coverage
198
+ .coverage.*
199
+ .cache
200
+ .benchmarks
201
+ nosetests.xml
202
+ coverage.xml
203
+ *,cover
204
+ .hypothesis/
205
+
206
+ # Translations
207
+ *.mo
208
+ *.pot
209
+
210
+ # Django stuff:
211
+ *.log
212
+ local_settings.py
213
+
214
+ # Flask stuff:
215
+ instance/
216
+ .webassets-cache
217
+
218
+ # Scrapy stuff:
219
+ .scrapy
220
+
221
+ # Sphinx documentation
222
+ docs/_build/
223
+
224
+ # PyBuilder
225
+ target/
226
+
227
+ # Jupyter Notebook
228
+ .ipynb_checkpoints
229
+
230
+ # pyenv
231
+ .python-version
232
+
233
+ # celery beat schedule file
234
+ celerybeat-schedule
235
+
236
+ # SageMath parsed files
237
+ *.sage.py
238
+
239
+ # dotenv
240
+ .env
241
+
242
+ # virtualenv
243
+ .venv
244
+ venv/
245
+ ENV/
246
+
247
+ # Spyder project settings
248
+ .spyderproject
249
+ .spyproject
250
+
251
+ # Rope project settings
252
+ .ropeproject
253
+
254
+ # mkdocs documentation
255
+ /site
256
+
257
+ ### TextMate ###
258
+ *.tmproj
259
+ *.tmproject
260
+ tmtags
261
+
262
+ ### Vim ###
263
+ # swap
264
+ [._]*.s[a-v][a-z]
265
+ [._]*.sw[a-p]
266
+ [._]s[a-v][a-z]
267
+ [._]sw[a-p]
268
+ # session
269
+ Session.vim
270
+ # temporary
271
+ .netrwhist
272
+ # auto-generated tag files
273
+ tags
274
+ .vscode/
275
+ # End of https://www.gitignore.io/api/vim,emacs,python,pycharm,textmate,intellij
@@ -0,0 +1,239 @@
1
+ # Gitlab ci
2
+ variables:
3
+ APP_NAME: py2ecma
4
+ APP_NAME_SLUG: py2ecma
5
+ CI_DOCKER_TAG: ci
6
+ TAG: ${CI_DOCKER_TAG}
7
+ DOCKER_REGISTRY_CI_IMAGE: ${CI_REGISTRY_IMAGE}
8
+ DOCKER_REGISTRY: ${DOCKER_REGISTRY}
9
+ DOCKER_REGISTRY_USER: ${DOCKER_REGISTRY_USER}
10
+ DOCKER_REGISTRY_PASSWORD: ${DOCKER_REGISTRY_PASSWORD}
11
+ DOCKER_TARGET_CI: ${APP_NAME_SLUG}-dev
12
+ XDG_CACHE_HOME: ${CI_PROJECT_DIR}/.cache/
13
+ TZ: "UTC"
14
+ LC_ALL: "C.UTF-8"
15
+ LANG: "C.UTF-8"
16
+
17
+ cache:
18
+ policy: pull-push
19
+ untracked: false
20
+ when: on_success
21
+ paths:
22
+ - ".venv/"
23
+ - "${XDG_CACHE_HOME}"
24
+
25
+ ### Stages ###
26
+ stages:
27
+ - build
28
+ - test
29
+ - release
30
+ - pages
31
+
32
+ ### Job templates ###
33
+ .build_job: &build_job
34
+ image:
35
+ name: gcr.io/kaniko-project/executor:v1.21.0-debug
36
+ entrypoint: [ "" ]
37
+ script:
38
+ - echo "{\"auths\":{\"${DOCKER_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${DOCKER_REGISTRY_USER}" "${DOCKER_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"},\"$(echo -n $CI_DEPENDENCY_PROXY_SERVER | awk -F[:] '{print $1}')\":{\"auth\":\"$(printf "%s:%s" ${CI_DEPENDENCY_PROXY_USER} "${CI_DEPENDENCY_PROXY_PASSWORD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json
39
+ - /kaniko/executor --context "${CI_PROJECT_DIR}" --dockerfile "${CI_PROJECT_DIR}/Dockerfile" --destination "${DOCKER_REGISTRY_IMAGE}:${TAG}" --target ${TARGET} --reproducible --cache=true --cache-copy-layers
40
+
41
+ ### Templates for job rules ###
42
+ .all_rules:
43
+ rules:
44
+ - changes:
45
+ # Paths that will be observed for changes
46
+ paths: &changes_path
47
+ - Dockerfile
48
+
49
+ # Run on main branch
50
+ - &rule_default_branch
51
+ if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
52
+ when: always
53
+ # Run when merge request
54
+ - &rule_merge_request
55
+ if: $CI_MERGE_REQUEST_ID
56
+ variables:
57
+ TAG: ci
58
+ when: always
59
+ - &rule_default_manual
60
+ if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
61
+ when: manual
62
+
63
+ # Run on main branch when path changes
64
+ - &rule_default_changed
65
+ if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
66
+ changes: *changes_path
67
+
68
+ - &rule_default_changed_needs
69
+ if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
70
+ needs: [ "build-ci" ]
71
+ changes: *changes_path
72
+
73
+ # Run when merge request, paths changes and change image to use
74
+ - &rule_merge_request_changed
75
+ if: $CI_PIPELINE_SOURCE == "merge_request_event"
76
+ changes: *changes_path
77
+ variables:
78
+ TAG: ci-$CI_MERGE_REQUEST_IID
79
+ - &rule_merge_request_changed_needs
80
+ if: $CI_PIPELINE_SOURCE == "merge_request_event"
81
+ needs: [ "build-ci" ]
82
+ changes: *changes_path
83
+ variables:
84
+ TAG: ci-$CI_MERGE_REQUEST_IID
85
+ - &rule_merge_request_changed_needs_build
86
+ if: $CI_PIPELINE_SOURCE == "merge_request_event"
87
+ needs: [ "build" ]
88
+ changes: *changes_path
89
+ variables:
90
+ TAG: ci-$CI_MERGE_REQUEST_IID
91
+
92
+ # Only run on default/main branch
93
+ .default_branch: &default_branch
94
+ rules:
95
+ - *rule_default_branch
96
+ - when: never
97
+
98
+ # Merge request rule. Only run on merge request
99
+ # If `paths` has changed use special image
100
+ .merge_request: &merge_request
101
+ rules:
102
+ #- *rule_merge_request_changed_needs_build
103
+ - *rule_merge_request
104
+ - when: never
105
+
106
+ .ci_rules: &ci_rules
107
+ rules:
108
+ #- *rule_default_changed_needs
109
+ #- *rule_merge_request_changed_needs
110
+ - *rule_merge_request
111
+ - *rule_default_branch
112
+ - when: never
113
+
114
+ .default_manual: &default_manual
115
+ rules:
116
+ - *rule_default_manual
117
+ #- *rule_default_branch
118
+ - when: never
119
+
120
+ # Special rules for ci build job
121
+ # If there are changes to paths it will create a new ci image.
122
+ # This image will then be used through throughout the merge request.
123
+ .ci_build_rules: &ci_build_rules
124
+ rules:
125
+ - *rule_merge_request_changed
126
+ - *rule_default_changed
127
+ - when: never
128
+
129
+ build:
130
+ stage: build
131
+ image:
132
+ name: python:3.12-alpine
133
+ variables:
134
+ TAG: ${CI_DOCKER_TAG}
135
+ GIT_FETCH_EXTRA_FLAGS: --prune --quiet --tags
136
+ before_script:
137
+ - apk add git
138
+ - ./scripts/install_ci.sh
139
+ script:
140
+ - echo "VERSION=$(./scripts/version.sh)" >> variables.env
141
+ - ./scripts/build.sh
142
+
143
+ artifacts:
144
+ untracked: false
145
+ when: on_success
146
+ access: all
147
+ expire_in: "1 days"
148
+ paths:
149
+ - "dist/*"
150
+ reports:
151
+ dotenv: variables.env
152
+ <<: *ci_rules
153
+
154
+ tests:
155
+ image: ${IMAGE}
156
+ stage: test
157
+ before_script:
158
+ - apk add git nodejs
159
+ - ./scripts/install_ci.sh
160
+ script:
161
+ - ./scripts/tests.sh
162
+ coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
163
+ artifacts:
164
+ when: always
165
+ reports:
166
+ coverage_report:
167
+ coverage_format: cobertura
168
+ path: coverage.xml
169
+ junit: report.xml
170
+ parallel:
171
+ matrix:
172
+ - IMAGE: python:3.12-alpine
173
+ - IMAGE: python:3.14-alpine
174
+ needs:
175
+ - job: build
176
+ <<: *merge_request
177
+
178
+ coverage:
179
+ image: python:3.14-alpine
180
+ stage: test
181
+ before_script:
182
+ - apk add git nodejs
183
+ - ./scripts/install_ci.sh
184
+ script:
185
+ - ./scripts/tests-cov.sh
186
+ coverage: /(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/
187
+ artifacts:
188
+ when: always
189
+ reports:
190
+ coverage_report:
191
+ coverage_format: cobertura
192
+ path: ./coverage.xml
193
+ <<: *ci_rules
194
+
195
+ verify:
196
+ image: python:3.14-alpine
197
+ stage: test
198
+ variables:
199
+ TAG: ${CI_TAG}
200
+ #before_script:
201
+ #- apk add git
202
+ #- ./scripts/install_ci.sh
203
+ script:
204
+ - echo "Not Verified"
205
+ #- ./scripts/verify.sh
206
+ <<: *merge_request
207
+
208
+ publish:
209
+ image: python:3.14
210
+ stage: release
211
+ variables:
212
+ TAG: ${CI_DOCKER_TAG}
213
+ before_script:
214
+ - ./scripts/install_ci.sh
215
+ script:
216
+ - ./scripts/release.sh
217
+ needs:
218
+ - job: build
219
+ artifacts: true
220
+ <<: *default_manual
221
+
222
+ release:
223
+ image: registry.gitlab.com/gitlab-org/release-cli:latest
224
+ stage: release
225
+ variables:
226
+ TAG: ${CI_DOCKER_TAG}
227
+ script:
228
+ - echo 'Releasing $VERSION'
229
+ release:
230
+ # See https://docs.gitlab.com/ee/ci/yaml/#release for available properties
231
+ name: "Release $VERSION"
232
+ tag_name: '$VERSION'
233
+ description: '$VERSION'
234
+ needs:
235
+ - job: build
236
+ artifacts: true
237
+ - job: publish
238
+ artifacts: false
239
+ <<: *default_branch
@@ -0,0 +1,49 @@
1
+
2
+ ARG DOCKER_BUILDKIT=1
3
+
4
+ FROM python:3.14.2-slim as python-base
5
+ ENV VIRTUAL_ENV=.venv/
6
+ ENV POETRY_VIRTUALENVS_PATH=${VIRTUAL_ENV}
7
+ ENV WORK_DIR=/workspaces
8
+ WORKDIR ${WORK_DIR}
9
+ RUN apt-get update && \
10
+ apt-get install -y make git && \
11
+ apt-get clean autoclean && \
12
+ apt-get autoremove --yes
13
+
14
+
15
+ FROM python-base as py2ecma-base
16
+ # Install poetry but clear all .cache in the same layer.
17
+ # If this is not done in the same layer it will still persist.
18
+ RUN pip install --no-compile --no-cache-dir poetry &&\
19
+ rm -rf /root/.cache/ &&\
20
+ find /usr/local/lib -path '*/__pycache__*' -delete
21
+ COPY poetry.lock pyproject.toml Makefile README.md ${WORK_DIR}/
22
+ COPY scripts/ ${WORK_DIR}/scripts
23
+
24
+ FROM py2ecma-base as py2ecma-dev
25
+ ENV POETRY_VIRTUALENVS_IN_PROJECT=true
26
+ ENV VIRTUAL_ENV=.venv/
27
+ RUN make install-ci
28
+
29
+
30
+ # Create requirements.txt file from poetry, check that they are in sync
31
+ FROM py2ecma-base as py2ecma-requirements
32
+
33
+ RUN make freeze
34
+
35
+ FROM python-base as py2ecma-deploy
36
+ COPY --from=py2ecma-requirements ${WORK_DIR}/requirements.txt ${WORK_DIR}/requirements.txt
37
+ RUN pip install -r requirements.txt &&\
38
+ rm -rf /root/.cache/ &&\
39
+ find /usr/local/lib -path '*/__pycache__*' -delete
40
+ COPY . ${WORK_DIR}
41
+
42
+ FROM python-base as py2ecma-ci
43
+ COPY --from=py2ecma-requirements ${WORK_DIR}/requirements-dev.txt ${WORK_DIR}/requirements.txt
44
+ RUN pip install -r requirements.txt &&\
45
+ rm -rf /root/.cache/ &&\
46
+ find /usr/local/lib -path '*/__pycache__*' -delete
47
+ COPY . ${WORK_DIR}
48
+
49
+