Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: blurstudio/hab
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.6.0
Choose a base ref
...
head repository: blurstudio/hab
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Loading
Showing with 19,639 additions and 1,679 deletions.
  1. +12 −1 .coveragerc
  2. +14 −4 .github/workflows/python-release.yml
  3. +113 −20 .github/workflows/python-static-analysis-and-test.yml
  4. +6 −0 .gitignore
  5. +11 −6 .pre-commit-config.yaml
  6. +1 −1 CONTRIBUTING.md
  7. +1,108 −70 README.md
  8. +37 −0 bin/.hab-complete.bash
  9. +7 −9 bin/hab
  10. +48 −21 bin/hab.bat
  11. +19 −20 bin/hab.ps1
  12. +5 −221 hab/__init__.py
  13. +1 −2 hab/__main__.py
  14. +248 −0 hab/cache.py
  15. +727 −73 hab/cli.py
  16. 0 hab/distro_finders/__init__.py
  17. +132 −0 hab/distro_finders/cloud_zip.py
  18. +165 −0 hab/distro_finders/df_zip.py
  19. +160 −0 hab/distro_finders/distro_finder.py
  20. +92 −0 hab/distro_finders/s3_zip.py
  21. +154 −0 hab/distro_finders/zip_sidecar.py
  22. +50 −1 hab/errors.py
  23. +75 −50 hab/formatter.py
  24. +40 −0 hab/launcher.py
  25. +97 −19 hab/merge_dict.py
  26. +11 −12 hab/parsers/__init__.py
  27. +126 −8 hab/parsers/config.py
  28. +14 −4 hab/parsers/distro.py
  29. +137 −49 hab/parsers/distro_version.py
  30. +203 −64 hab/parsers/flat_config.py
  31. +44 −0 hab/parsers/format_parser.py
  32. +607 −219 hab/parsers/hab_base.py
  33. +127 −0 hab/parsers/lazy_distro_version.py
  34. +3 −16 hab/parsers/meta.py
  35. +62 −0 hab/parsers/unfrozen_config.py
  36. +592 −0 hab/resolver.py
  37. +367 −16 hab/site.py
  38. +49 −20 hab/solvers.py
  39. +28 −0 hab/templates/alias.bat
  40. +34 −0 hab/templates/config.bat
  41. +60 −0 hab/templates/config.ps1
  42. +70 −0 hab/templates/config.sh
  43. +198 −0 hab/user_prefs.py
  44. +586 −42 hab/utils.py
  45. +1 −3 pyproject.toml
  46. +5 −4 requirements-dev.txt
  47. +4 −0 requirements.txt
  48. +21 −12 setup.cfg
  49. +0 −23 test.py
  50. +8 −0 tests/configs/app/app_aliased.json
  51. +24 −0 tests/configs/app/app_aliased_config.json
  52. +14 −0 tests/configs/app/app_aliased_mod.json
  53. +24 −0 tests/configs/app/app_aliased_mod_config.json
  54. +10 −0 tests/configs/app/app_houdini_a.json
  55. +10 −0 tests/configs/app/app_houdini_b.json
  56. +10 −0 tests/configs/app/app_maya.json
  57. +8 −0 tests/configs/app/app_maya_2020.json
  58. +8 −0 tests/configs/app/app_maya_2024.json
  59. +10 −0 tests/configs/not_set/env_path_hab_uri.json
  60. +4 −3 tests/configs/not_set/not_set.json
  61. +7 −0 tests/configs/not_set/not_set_empty_lists.json
  62. +10 −0 tests/configs/not_set/not_set_no_distros.json
  63. +16 −0 tests/configs/optional/optional.json
  64. +11 −0 tests/configs/optional/optional_child.json
  65. +28 −1 tests/configs/project_a/project_a.json
  66. +15 −0 tests/configs/verbosity/verbosity.json
  67. +15 −0 tests/configs/verbosity/verbosity_hidden.json
  68. +11 −0 tests/configs/verbosity/verbosity_inherit-no.json
  69. +14 −0 tests/configs/verbosity/verbosity_inherit-override.json
  70. +14 −0 tests/configs/verbosity/verbosity_inherit.json
  71. +304 −6 tests/conftest.py
  72. +113 −0 tests/distros/aliased/2.0/.hab.json
  73. +29 −0 tests/distros/aliased/2.0/README.md
  74. +32 −0 tests/distros/aliased/2.0/list_vars.py
  75. +62 −0 tests/distros/aliased_mod/1.0/.hab.json
  76. +83 −0 tests/distros/aliased_verbosity/1.0/.hab.json
  77. +22 −0 tests/distros/all_settings/0.1.0.dev1/invalid.hab.json
  78. +0 −11 tests/distros/houdini/18.5/.hab.json
  79. +69 −0 tests/distros/houdini18.5/18.5.351/.hab.json
  80. +74 −0 tests/distros/houdini19.5/19.5.493/.hab.json
  81. +0 −30 tests/distros/maya/2020.1/.hab.json
  82. 0 tests/distros/{maya → maya2020}/2020.0/.hab.json
  83. +79 −0 tests/distros/maya2020/2020.1/.hab.json
  84. +79 −0 tests/distros/maya2024/2024.0/.hab.json
  85. +19 −0 tests/distros/pre-release/1.0.dev1/.hab.json
  86. +19 −0 tests/distros/pre-release/1.0/.hab.json
  87. +19 −0 tests/distros/pre-release/1.1.dev2/.hab.json
  88. +19 −0 tests/distros/pre-release2/1.0/.hab.json
  89. +19 −0 tests/distros/pre-release2/1.1.dev2/.hab.json
  90. +2 −1 tests/distros/the_dcc/1.0/.hab.json
  91. +2 −1 tests/distros/the_dcc/1.1/.hab.json
  92. +6 −1 tests/distros/the_dcc/1.2/.hab.json
  93. +14 −0 tests/distros/the_dcc/pre/.hab.json
  94. +3 −0 tests/distros/the_dcc/pre/README.md
  95. +4 −3 tests/distros/the_dcc_plugin_a/1.1/.hab.json
  96. +3 −0 tests/distros/the_dcc_plugin_b/1.1/.hab.json
  97. +3 −0 tests/distros/the_dcc_plugin_d/1.1/.hab.json
  98. +2 −1 tests/distros/the_dcc_plugin_e/1.1/.hab.json
  99. +72 −0 tests/frozen.json
  100. +23 −0 tests/frozen_no_distros.json
  101. +99 −0 tests/hab_test_entry_points.py
  102. +45 −0 tests/merge_dict/merge_agnostic.json
  103. +131 −0 tests/merge_dict/merge_specific.json
  104. +25 −0 tests/merge_dict/os_agnostic.json
  105. +19 −0 tests/merge_dict/os_agnostic_platforms.json
  106. +79 −0 tests/merge_dict/os_specific.json
  107. +26 −0 tests/merge_dict/os_specific_false.json
  108. +76 −0 tests/merge_dict/os_specific_platforms.json
  109. +94 −0 tests/merge_dict/test_merge_dict.py
  110. +15 −0 tests/reference_scripts/bat_activate/aliases/as_dict.bat
  111. +7 −0 tests/reference_scripts/bat_activate/aliases/as_list.bat
  112. +7 −0 tests/reference_scripts/bat_activate/aliases/as_str.bat
  113. +17 −0 tests/reference_scripts/bat_activate/aliases/global.bat
  114. +15 −0 tests/reference_scripts/bat_activate/aliases/inherited.bat
  115. +7 −0 tests/reference_scripts/bat_activate/aliases/maya.bat
  116. +7 −0 tests/reference_scripts/bat_activate/aliases/maya20.bat
  117. +7 −0 tests/reference_scripts/bat_activate/aliases/mayapy.bat
  118. +7 −0 tests/reference_scripts/bat_activate/aliases/mayapy20.bat
  119. +7 −0 tests/reference_scripts/bat_activate/aliases/pip.bat
  120. +22 −0 tests/reference_scripts/bat_activate/hab_config.bat
  121. +10 −0 tests/reference_scripts/bat_activate/spec.json
  122. +15 −0 tests/reference_scripts/bat_activate_launch/aliases/as_dict.bat
  123. +7 −0 tests/reference_scripts/bat_activate_launch/aliases/as_list.bat
  124. +7 −0 tests/reference_scripts/bat_activate_launch/aliases/as_str.bat
  125. +17 −0 tests/reference_scripts/bat_activate_launch/aliases/global.bat
  126. +15 −0 tests/reference_scripts/bat_activate_launch/aliases/inherited.bat
  127. +7 −0 tests/reference_scripts/bat_activate_launch/aliases/maya.bat
  128. +7 −0 tests/reference_scripts/bat_activate_launch/aliases/maya20.bat
  129. +7 −0 tests/reference_scripts/bat_activate_launch/aliases/mayapy.bat
  130. +7 −0 tests/reference_scripts/bat_activate_launch/aliases/mayapy20.bat
  131. +7 −0 tests/reference_scripts/bat_activate_launch/aliases/pip.bat
  132. +26 −0 tests/reference_scripts/bat_activate_launch/hab_config.bat
  133. +10 −0 tests/reference_scripts/bat_activate_launch/spec.json
  134. +15 −0 tests/reference_scripts/bat_env/aliases/as_dict.bat
  135. +7 −0 tests/reference_scripts/bat_env/aliases/as_list.bat
  136. +7 −0 tests/reference_scripts/bat_env/aliases/as_str.bat
  137. +17 −0 tests/reference_scripts/bat_env/aliases/global.bat
  138. +15 −0 tests/reference_scripts/bat_env/aliases/inherited.bat
  139. +7 −0 tests/reference_scripts/bat_env/aliases/maya.bat
  140. +7 −0 tests/reference_scripts/bat_env/aliases/maya20.bat
  141. +7 −0 tests/reference_scripts/bat_env/aliases/mayapy.bat
  142. +7 −0 tests/reference_scripts/bat_env/aliases/mayapy20.bat
  143. +7 −0 tests/reference_scripts/bat_env/aliases/pip.bat
  144. +22 −0 tests/reference_scripts/bat_env/hab_config.bat
  145. +1 −0 tests/reference_scripts/bat_env/hab_launch.bat
  146. +10 −0 tests/reference_scripts/bat_env/spec.json
  147. +15 −0 tests/reference_scripts/bat_env_launch/aliases/as_dict.bat
  148. +7 −0 tests/reference_scripts/bat_env_launch/aliases/as_list.bat
  149. +7 −0 tests/reference_scripts/bat_env_launch/aliases/as_str.bat
  150. +17 −0 tests/reference_scripts/bat_env_launch/aliases/global.bat
  151. +15 −0 tests/reference_scripts/bat_env_launch/aliases/inherited.bat
  152. +7 −0 tests/reference_scripts/bat_env_launch/aliases/maya.bat
  153. +7 −0 tests/reference_scripts/bat_env_launch/aliases/maya20.bat
  154. +7 −0 tests/reference_scripts/bat_env_launch/aliases/mayapy.bat
  155. +7 −0 tests/reference_scripts/bat_env_launch/aliases/mayapy20.bat
  156. +7 −0 tests/reference_scripts/bat_env_launch/aliases/pip.bat
  157. +26 −0 tests/reference_scripts/bat_env_launch/hab_config.bat
  158. +1 −0 tests/reference_scripts/bat_env_launch/hab_launch.bat
  159. +10 −0 tests/reference_scripts/bat_env_launch/spec.json
  160. +15 −0 tests/reference_scripts/bat_launch/aliases/as_dict.bat
  161. +7 −0 tests/reference_scripts/bat_launch/aliases/as_list.bat
  162. +7 −0 tests/reference_scripts/bat_launch/aliases/as_str.bat
  163. +17 −0 tests/reference_scripts/bat_launch/aliases/global.bat
  164. +15 −0 tests/reference_scripts/bat_launch/aliases/inherited.bat
  165. +7 −0 tests/reference_scripts/bat_launch/aliases/maya.bat
  166. +7 −0 tests/reference_scripts/bat_launch/aliases/maya20.bat
  167. +7 −0 tests/reference_scripts/bat_launch/aliases/mayapy.bat
  168. +7 −0 tests/reference_scripts/bat_launch/aliases/mayapy20.bat
  169. +7 −0 tests/reference_scripts/bat_launch/aliases/pip.bat
  170. +27 −0 tests/reference_scripts/bat_launch/hab_config.bat
  171. +1 −0 tests/reference_scripts/bat_launch/hab_launch.bat
  172. +10 −0 tests/reference_scripts/bat_launch/spec.json
  173. +15 −0 tests/reference_scripts/bat_launch_args/aliases/as_dict.bat
  174. +7 −0 tests/reference_scripts/bat_launch_args/aliases/as_list.bat
  175. +7 −0 tests/reference_scripts/bat_launch_args/aliases/as_str.bat
  176. +17 −0 tests/reference_scripts/bat_launch_args/aliases/global.bat
  177. +15 −0 tests/reference_scripts/bat_launch_args/aliases/inherited.bat
  178. +7 −0 tests/reference_scripts/bat_launch_args/aliases/maya.bat
  179. +7 −0 tests/reference_scripts/bat_launch_args/aliases/maya20.bat
  180. +7 −0 tests/reference_scripts/bat_launch_args/aliases/mayapy.bat
  181. +7 −0 tests/reference_scripts/bat_launch_args/aliases/mayapy20.bat
  182. +7 −0 tests/reference_scripts/bat_launch_args/aliases/pip.bat
  183. +27 −0 tests/reference_scripts/bat_launch_args/hab_config.bat
  184. +1 −0 tests/reference_scripts/bat_launch_args/hab_launch.bat
  185. +10 −0 tests/reference_scripts/bat_launch_args/spec.json
  186. +93 −0 tests/reference_scripts/ps1_activate/hab_config.ps1
  187. +10 −0 tests/reference_scripts/ps1_activate/spec.json
  188. +99 −0 tests/reference_scripts/ps1_activate_launch/hab_config.ps1
  189. +10 −0 tests/reference_scripts/ps1_activate_launch/spec.json
  190. +93 −0 tests/reference_scripts/ps1_env/hab_config.ps1
  191. +2 −0 tests/reference_scripts/ps1_env/hab_launch.ps1
  192. +10 −0 tests/reference_scripts/ps1_env/spec.json
  193. +99 −0 tests/reference_scripts/ps1_env_launch/hab_config.ps1
  194. +2 −0 tests/reference_scripts/ps1_env_launch/hab_launch.ps1
  195. +10 −0 tests/reference_scripts/ps1_env_launch/spec.json
  196. +99 −0 tests/reference_scripts/ps1_launch/hab_config.ps1
  197. +2 −0 tests/reference_scripts/ps1_launch/hab_launch.ps1
  198. +10 −0 tests/reference_scripts/ps1_launch/spec.json
  199. +99 −0 tests/reference_scripts/ps1_launch_args/hab_config.ps1
  200. +2 −0 tests/reference_scripts/ps1_launch_args/hab_launch.ps1
  201. +10 −0 tests/reference_scripts/ps1_launch_args/spec.json
  202. +114 −0 tests/reference_scripts/sh_linux_activate/hab_config.sh
  203. +10 −0 tests/reference_scripts/sh_linux_activate/spec.json
  204. +118 −0 tests/reference_scripts/sh_linux_activate_launch/hab_config.sh
  205. +10 −0 tests/reference_scripts/sh_linux_activate_launch/spec.json
  206. +114 −0 tests/reference_scripts/sh_linux_env/hab_config.sh
  207. +2 −0 tests/reference_scripts/sh_linux_env/hab_launch.sh
  208. +10 −0 tests/reference_scripts/sh_linux_env/spec.json
  209. +118 −0 tests/reference_scripts/sh_linux_env_launch/hab_config.sh
  210. +2 −0 tests/reference_scripts/sh_linux_env_launch/hab_launch.sh
  211. +10 −0 tests/reference_scripts/sh_linux_env_launch/spec.json
  212. +120 −0 tests/reference_scripts/sh_linux_launch/hab_config.sh
  213. +2 −0 tests/reference_scripts/sh_linux_launch/hab_launch.sh
  214. +10 −0 tests/reference_scripts/sh_linux_launch/spec.json
  215. +120 −0 tests/reference_scripts/sh_linux_launch_args/hab_config.sh
  216. +2 −0 tests/reference_scripts/sh_linux_launch_args/hab_launch.sh
  217. +10 −0 tests/reference_scripts/sh_linux_launch_args/spec.json
  218. +114 −0 tests/reference_scripts/sh_win_activate/hab_config.sh
  219. +10 −0 tests/reference_scripts/sh_win_activate/spec.json
  220. +118 −0 tests/reference_scripts/sh_win_activate_launch/hab_config.sh
  221. +10 −0 tests/reference_scripts/sh_win_activate_launch/spec.json
  222. +114 −0 tests/reference_scripts/sh_win_env/hab_config.sh
  223. +2 −0 tests/reference_scripts/sh_win_env/hab_launch.sh
  224. +10 −0 tests/reference_scripts/sh_win_env/spec.json
  225. +118 −0 tests/reference_scripts/sh_win_env_launch/hab_config.sh
  226. +2 −0 tests/reference_scripts/sh_win_env_launch/hab_launch.sh
  227. +10 −0 tests/reference_scripts/sh_win_env_launch/spec.json
  228. +120 −0 tests/reference_scripts/sh_win_launch/hab_config.sh
  229. +2 −0 tests/reference_scripts/sh_win_launch/hab_launch.sh
  230. +10 −0 tests/reference_scripts/sh_win_launch/spec.json
  231. +120 −0 tests/reference_scripts/sh_win_launch_args/hab_config.sh
  232. +2 −0 tests/reference_scripts/sh_win_launch_args/hab_launch.sh
  233. +10 −0 tests/reference_scripts/sh_win_launch_args/spec.json
  234. +420 −0 tests/resolver_freeze_configs.json
  235. +3 −0 tests/site/eps/README.md
  236. +9 −0 tests/site/eps/cfg_reduce_env.json
  237. +9 −0 tests/site/eps/cfg_reduce_finalize.json
  238. +9 −0 tests/site/eps/cfg_uri_validate.json
  239. +12 −0 tests/site/eps/site_add_paths.json
  240. +13 −0 tests/site/eps/site_add_paths_a.json
  241. +5 −0 tests/site/eps/site_add_paths_b.json
  242. +5 −0 tests/site/eps/site_add_paths_c.json
  243. +9 −0 tests/site/eps/site_finalize.json
  244. +9 −0 tests/site/eps/site_habcache_cls.json
  245. +5 −0 tests/site/site_cache_file.json
  246. +32 −0 tests/site/site_distro_finder.json
  247. +7 −0 tests/site/site_distro_finder_empty.json
  248. +15 −0 tests/site/site_entry_point_a.json
  249. +9 −0 tests/site/site_entry_point_b.json
  250. +9 −0 tests/site/site_entry_point_c.json
  251. +10 −0 tests/site/site_ep_uri_validate.json
  252. +25 −0 tests/site/site_left.json
  253. +25 −0 tests/site/site_middle.json
  254. +25 −0 tests/site/site_right.json
  255. +18 −2 tests/site_main.json
  256. +1,748 −0 tests/site_main_check.habcache
  257. +10 −0 tests/site_omit/README.md
  258. +20 −0 tests/site_omit/configs/default.json
  259. +25 −0 tests/site_omit/configs/omittable_defined.json
  260. +16 −0 tests/site_omit/configs/omittable_inherited.json
  261. +24 −0 tests/site_omit/configs/omittable_invalid.json
  262. +16 −0 tests/site_omit/site_omit.json
  263. +169 −0 tests/site_omit/test_omittable.py
  264. +23 −4 tests/site_os_specific.json
  265. +8 −1 tests/site_override.json
  266. +20 −0 tests/templates/site_distro_finder.json
  267. +24 −0 tests/templates/site_distro_s3.json
  268. +20 −0 tests/templates/site_distro_zip.json
  269. +20 −0 tests/templates/site_distro_zip_sidecar.json
  270. +20 −0 tests/templates/site_download.json
  271. +162 −0 tests/test_cache.py
  272. +830 −0 tests/test_distro_finder.py
  273. +98 −0 tests/test_format_parser.py
  274. +47 −27 tests/test_formatter.py
  275. +261 −0 tests/test_freeze.py
  276. +288 −0 tests/test_launch.py
  277. +151 −0 tests/test_lazy_distro_version.py
  278. +819 −321 tests/test_parsing.py
  279. +926 −183 tests/test_resolver.py
  280. +307 −0 tests/test_scripts.py
  281. +807 −49 tests/test_site.py
  282. +110 −13 tests/test_solver.py
  283. +265 −0 tests/test_user_prefs.py
  284. +27 −11 tox.ini
13 changes: 12 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
[report]
show_missing = true
skip_covered = true
skip_empty = true

[run]
# Ensure all python modules in hab have their coverage reported,
# not just files that pytest touches.
source = hab
omit =
*/site-packages/*
*/.tox/*
tests/*
show_missing = true
# This file is automatically generated by setuptools_scm
hab/version.py
parallel=True
relative_files=True
18 changes: 14 additions & 4 deletions .github/workflows/python-release.yml
Original file line number Diff line number Diff line change
@@ -11,23 +11,33 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools wheel twine
python -m pip install --upgrade build setuptools wheel twine
- name: Build wheel
run: |
python setup.py build bdist_wheel
python -m build --wheel --sdist
# Upload the built pip packages so we can inspect them
- name: Upload packages.
uses: actions/upload-artifact@v3
with:
name: pip-packages
path: |
dist/hab-*.whl
dist/hab-*.tar.gz
retention-days: 1

- name: Publish to PyPI
env:
133 changes: 113 additions & 20 deletions .github/workflows/python-static-analysis-and-test.yml
Original file line number Diff line number Diff line change
@@ -17,17 +17,19 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: "3.x"
# NOTE: Currently running this with python 3.12 causes
# flake8 false-positives on lines with f-strings E226,E231,E241,E702
python-version: "3.11"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
python -m pip install tox coverage[toml]
- name: Lint with flake8
run: tox -e flake8
@@ -44,18 +46,33 @@ jobs:
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name != github.repository

runs-on: ubuntu-latest

strategy:
matrix:
python: ['3.6', '3.7', '3.8', '3.9', '3.10']
# Test if using native json or pyjson5 for json parsing
pkg_mods: ['json', 'json5', 's3']
os: ['ubuntu-latest', 'windows-latest']
python: ['3.8', '3.9', '3.10', '3.11']
# Works around the depreciation of python 3.6 for ubuntu
# https://github.com/actions/setup-python/issues/544
include:
- pkg_mods: 'json'
os: 'ubuntu-22.04'
python: '3.7'
- pkg_mods: 'json5'
os: 'ubuntu-22.04'
python: '3.7'
- pkg_mods: 's3'
os: 'ubuntu-22.04'
python: '3.7'

runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

@@ -66,37 +83,113 @@ jobs:
- name: Run Tox
run: |
tox -e py
tox -e begin,py-${{ matrix.pkg_mods }}
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.os }}-${{ matrix.python }}-${{ matrix.pkg_mods }}
path: .coverage.*
include-hidden-files: true
retention-days: 1

test-json5:
coverage:
# We want to run on external PRs, but not on our own internal PRs as they'll
# be run by the push to the branch. Without this if check, checks are
# duplicated since internal PRs match both the push and pull_request events.
if:
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name != github.repository

needs: test

runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

strategy:
matrix:
python: ['3.7', '3.8', '3.9', '3.10']
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox coverage[toml]
# Ensure version.py is created so coverage can read it's source
- name: Run begin
run: |
tox -e begin
- name: Download coverage artifacts
uses: actions/download-artifact@v4
with:
pattern: coverage-*
merge-multiple: true

# Tox runs `coverage combine` and `coverage xml`
- name: Combine coverage and report
run: |
tox -e end
# Report and write to summary.
python -m coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
# Write html coverage report to upload as an artifact
python -m coverage html
# # Report again and fail if under 100%.
# python -m coverage report --fail-under=100
- name: Upload HTML report if check failed.
uses: actions/upload-artifact@v4
with:
name: html-report
path: htmlcov
# # TODO: If we get 100% coverage we can re-enable this and the
# # `--fail-under` check so pull requests fail if the dev doesn't
# # add tests for new code.
# if: ${{ failure() }}


pip-package:
# We want to run on external PRs, but not on our own internal PRs as they'll
# be run by the push to the branch. Without this if check, checks are
# duplicated since internal PRs match both the push and pull_request events.
if:
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name != github.repository

# Build and upload pip packages as artifacts so we can inspect them and
# ensure they are correct for actual release
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
python-version: "3.x"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
python -m pip install --upgrade build setuptools wheel twine
- name: Run Tox
- name: Build wheel
run: |
tox -e py-json5
python -m build --wheel --sdist
- name: Upload packages.
uses: actions/upload-artifact@v4
with:
name: pip-packages
path: |
dist/hab-*.whl
dist/hab-*.tar.gz
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -2,15 +2,21 @@
*.pyc
*.swp
.coverage
.coverage.*
.DS_Store
.eggs
.pytest_cache
.tox/
__pycache__/
build/
coverage.xml
dist/
docs/
htmlcov/
venv/
.venv/
version.py
*.sublime-project
*.sublime-workspace
*.code-workspace
.vscode/
17 changes: 11 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
---
ci:
autoupdate_schedule: quarterly
skip: [black, flake8, setup-cfg-fmt]

repos:

- repo: https://github.com/psf/black
rev: 22.6.0
rev: 22.12.0
hooks:
- id: black

@@ -11,16 +15,17 @@ repos:
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear==22.4.25
- pep8-naming==0.13.0
- flake8-bugbear==22.12.6
- pep8-naming==0.13.3

- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.0.0
rev: v2.5.0
hooks:
- id: setup-cfg-fmt
args: [--min-py3-version=3.7]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.6.0
hooks:
- id: check-json
exclude: '^tests/invalid.json'
@@ -33,7 +38,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/pycqa/isort
rev: 5.10.1
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -67,7 +67,7 @@ Code formatting is completed by [black]. By relinquishing code appearance standa

Releases are made manually by project managers and will automatically be uploaded to PyPI (via GitHib Action workflow) once completed.

[flake8]: https://gitlab.com/pycqa/flake8
[flake8]: https://github.com/PyCQA/flake8
[flake8-bugbear]: https://github.com/PyCQA/flake8-bugbear
[pep8-naming]: https://github.com/PyCQA/pep8-naming
[setup.cfg]: https://github.com/blurstudio/python-example/blob/master/setup.cfg
Loading