Skip to content

Commit

Permalink
Add Support for Cookiecutter + Cruft Support for Multi-Repo Template …
Browse files Browse the repository at this point in the history
…Updates (#23)

* Change to pull from ECR public registry

* Make requested changes (Add repo link)

* Update Hermes Instrument repo to bring it up to speed with our other repos (using EEA as base)

* Implement cookiecutter

* Test update

* Change cookiecutter

* Add raw tags to workflows

* Tweak the cookiecutter template

* Fix yaml parsing of github actions

* Try cleaner method to be able to parse yaml files with cookiecutter

* Fix yaml parsing once more

* Really fix yaml parsing once more

* test new change template

* Change back template

* Remove .trunk files

* Remove trunk
  • Loading branch information
dbarrous committed Dec 22, 2022
1 parent c582a85 commit 2374d64
Show file tree
Hide file tree
Showing 67 changed files with 308 additions and 96 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ MANIFEST
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
.trunk/

# Installer logs
pip-log.txt
Expand Down Expand Up @@ -147,5 +148,5 @@ docs/_build
docs/generated
docs/api
docs/whatsnew/latest_changelog.txt
hermes_instrument/version.py
hermes_{{ cookiecutter.instr_name }}/version.py
htmlcov/
1 change: 0 additions & 1 deletion changelog/12.doc.1.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/13.doc.1.rst

This file was deleted.

3 changes: 3 additions & 0 deletions cookiecutter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"instr_name": "instrument"
}
9 changes: 0 additions & 9 deletions docs/api.rst

This file was deleted.

5 changes: 0 additions & 5 deletions hermes_instrument/tests/test_file_tools.py

This file was deleted.

Empty file removed hermes_instrument/util/__init__.py
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"python.languageServer": "Pylance",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.formatting.blackPath": "/home/vscode/.local/bin/black",
"python.formatting.blackPath": "/usr/local/bin/black",
"python.formatting.provider": "black",
"python.formatting.blackArgs": [
"--line-length",
Expand All @@ -22,11 +22,11 @@
"python.linting.lintOnSave": true,
"python.linting.flake8Enabled": true,
"editor.formatOnSave": true,
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
"python.linting.pycodestylePath": "/home/vscode/.local/bin/pycodestyle",
"python.linting.pydocstylePath": "/home/vscode/.local/bin/pydocstyle",
"python.linting.banditPath": "/usr/local/bin/bandit",
"python.linting.flake8Path": "/usr/local/bin/flake8",
"python.linting.mypyPath": "/usr/local/bin/mypy",
"python.linting.pycodestylePath": "/usr/local/bin/pycodestyle",
"python.linting.pydocstylePath": "/usr/local/bin/pydocstyle",
"python.linting.pylintPath": "/usr/bin/pylint",
"terminal.integrated.profiles.linux": {
"bash (login)": {
Expand All @@ -42,11 +42,11 @@
"ms-python.python",
"ms-python.vscode-pylance",
"marklarah.pre-commit-vscode"
]
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
//"postCreateCommand": "bash -i -c 'pip3 install --user .[all]'",
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
// "remoteUser": "vscode"
"remoteUser": "vscode"
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ on:
- main
jobs:
build:

#{% raw %}
runs-on: ${{ matrix.platform }}
#{% endraw %}
strategy:
fail-fast: false
matrix:
Expand All @@ -20,18 +21,23 @@ jobs:

steps:
- uses: actions/checkout@v2
#{% raw %}
- name: Set up Python ${{ matrix.python-version }}
#{% endraw %}
uses: actions/setup-python@v2
with:
#{% raw %}
python-version: ${{ matrix.python-version }}
#{% endraw %}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e .[dev]
- name: Lint with Black
run: |
black --check --diff hermes_instrument
black --check --diff hermes_{{ cookiecutter.instr_name }}
- name: flake8
run: |
flake8 --count hermes_instrument
flake8 --count hermes_{{ cookiecutter.instr_name }}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ on:
- main
jobs:
build:

#{% raw %}
runs-on: ${{ matrix.platform }}
#{% endraw %}
strategy:
fail-fast: false
matrix:
Expand All @@ -20,10 +21,15 @@ jobs:

steps:
- uses: actions/checkout@v2
#{% raw %}
- name: Set up Python ${{ matrix.python-version }}
#{% endraw %}

uses: actions/setup-python@v2
with:
#{% raw %}
python-version: ${{ matrix.python-version }}
#{% endraw %}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,34 @@ on:
- main
jobs:
build:

#{% raw %}
runs-on: ${{ matrix.platform }}
#{% endraw %}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.7, 3.8, 3.9]
python-version: [3.7, 3.8, 3.9, '3.10', '3.11']

steps:
- uses: actions/checkout@v2
#{% raw %}
- name: Set up Python ${{ matrix.python-version }}
#{% endraw %}
uses: actions/setup-python@v2
with:
#{% raw %}
python-version: ${{ matrix.python-version }}
#{% endraw %}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e .[test]
- name: Run tests
run: pytest --pyargs hermes_instrument --cov hermes_instrument
run: pytest --pyargs hermes_{{ cookiecutter.instr_name }} --cov hermes_{{ cookiecutter.instr_name }}
env:
#{% raw %}
PLATFORM: ${{ matrix.platform }}

#{% endraw %}
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v3
151 changes: 151 additions & 0 deletions hermes_{{ cookiecutter.instr_name }}/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# static files generated from Django application using `collectstatic`
media
static

# Specifc Template
docs/_build
docs/generated
docs/api
docs/whatsnew/latest_changelog.txt
hermes_{{ cookiecutter.instr_name }}/version.py
htmlcov/
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions hermes_{{ cookiecutter.instr_name }}/.trunk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*out
*logs
*actions
*notifications
plugins
user_trunk.yaml
user.yaml
2 changes: 2 additions & 0 deletions hermes_{{ cookiecutter.instr_name }}/.trunk/config/.isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[settings]
profile=black
26 changes: 26 additions & 0 deletions hermes_{{ cookiecutter.instr_name }}/.trunk/trunk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: 0.1
cli:
version: 1.1.0
plugins:
sources:
- id: trunk
ref: v0.0.6
uri: https://github.com/trunk-io/plugins
lint:
enabled:
- black@22.10.0
- gitleaks@8.15.1
- taplo@0.7.0
- prettier@2.7.1
- flake8@5.0.4
- git-diff-check
- isort@5.10.1
- actionlint@1.6.22
runtimes:
enabled:
- go@1.18.3
- node@16.14.2
- python@3.10.3
actions:
enabled:
- trunk-upgrade-available
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ include setup.cfg
include LICENSE.rst
include pyproject.toml

recursive-include hermes_instrument *.pyx *.c *.pxd
recursive-include hermes_{{ cookiecutter.instr_name }} *.pyx *.c *.pxd
recursive-include docs *
recursive-include licenses *
recursive-include cextern *
Expand Down

0 comments on commit 2374d64

Please sign in to comment.