Skip to content

Commit

Permalink
feat: Add a mapper cookiecutter template (#1892)
Browse files Browse the repository at this point in the history
  • Loading branch information
pnadolny13 authored Aug 3, 2023
1 parent 6ce7eab commit 65d9dba
Show file tree
Hide file tree
Showing 20 changed files with 846 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/cookiecutter-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ jobs:
path: |
/tmp/tap-*
/tmp/target-*
/tmp/mapper-*
!/tmp/tap-*/.mypy_cache/
!/tmp/target-*/.mypy_cache/
!/tmp/mapper-*/.mypy_cache/
!/tmp/tap-*/.tox/
!/tmp/target-*/.tox/
!/tmp/mapper-*/.tox/
24 changes: 24 additions & 0 deletions cookiecutter/mapper-template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Singer Mapper Template

To use this cookie cutter template:

```bash
pip3 install pipx
pipx ensurepath
# You may need to reopen your shell at this point
pipx install cookiecutter
```

Initialize Cookiecutter template directly from Git:

```bash
cookiecutter https://github.com/meltano/sdk --directory="cookiecutter/mapper-template"
```

Or locally from an already-cloned `sdk` repo:

```bash
cookiecutter ./sdk/cookiecutter/mapper-template
```

See the [dev guide](https://sdk.meltano.com/en/latest/dev_guide.html).
9 changes: 9 additions & 0 deletions cookiecutter/mapper-template/cookiecutter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "MyMapperName",
"admin_name": "FirstName LastName",
"mapper_id": "mapper-{{ cookiecutter.name.lower() }}",
"library_name": "{{ cookiecutter.mapper_id.replace('-', '_') }}",
"variant": "None (Skip)",
"include_ci_files": ["GitHub", "None (Skip)"],
"license": ["Apache-2.0"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
### A CI workflow template that runs linting and python testing
### TODO: Modify as needed or as desired.

name: Test {{cookiecutter.mapper_id}}

on: [push]

jobs:
pytest:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: {{ '${{secrets.GITHUB_TOKEN}}' }}
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python {{ '${{ matrix.python-version }}' }}
uses: actions/setup-python@v4
with:
python-version: {{ '${{ matrix.python-version }}' }}
- name: Install Poetry
run: |
pip install poetry
- name: Install dependencies
run: |
poetry install
- name: Test with pytest
run: |
poetry run pytest
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: "chore(deps): "
prefix-development: "chore(deps-dev): "
- package-ecosystem: pip
directory: "/.github/workflows"
schedule:
interval: daily
commit-message:
prefix: "ci: "
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: "weekly"
commit-message:
prefix: "ci: "
136 changes: 136 additions & 0 deletions cookiecutter/mapper-template/{{cookiecutter.mapper_id}}/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# Secrets and internal config files
**/.secrets/*

# Ignore meltano internal cache and sqlite systemdb

.meltano/

# 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/

# 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
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.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/
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
ci:
autofix_prs: true
autoupdate_schedule: weekly
autoupdate_commit_msg: 'chore: pre-commit autoupdate'

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-json
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.23.3
hooks:
- id: check-dependabot
- id: check-github-workflows

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.282
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --show-fixes]

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

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.4.1
hooks:
- id: mypy
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# IMPORTANT! This folder is hidden from git - if you need to store config files or other secrets,
# make sure those are never staged for commit into your git repo. You can store them here or another
# secure location.
#
# Note: This may be redundant with the global .gitignore for, and is provided
# for redundancy. If the `.secrets` folder is not needed, you may delete it
# from the project.

*
!.gitignore
Loading

0 comments on commit 65d9dba

Please sign in to comment.