diff --git a/cookiecutter.json b/cookiecutter.json index 206ae3c..cdd7997 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -4,6 +4,7 @@ "author_name": "Your name (or your organization/company/team)", "description": "A short description of the project.", "open_source_license": ["MIT", "BSD-3-Clause", "No license file"], + "env_choice": ["poetry", "conda"], "s3_bucket": "[OPTIONAL] your-bucket-for-syncing-data (do not include 's3://')", "aws_profile": "default", "install_data_science_pkgs": ["yes", "no"] diff --git a/{{ cookiecutter.repo_name }}/.pre-commit-config.yaml b/{{ cookiecutter.repo_name }}/.pre-commit-config.yaml index d6e7711..4c11fd7 100644 --- a/{{ cookiecutter.repo_name }}/.pre-commit-config.yaml +++ b/{{ cookiecutter.repo_name }}/.pre-commit-config.yaml @@ -1,6 +1,50 @@ repos: - - repo: https://github.com/psf/black - rev: stable # Replace by any tag/version: https://github.com/psf/black/tags + - repo: local hooks: + - id: isort + name: isort (python) + entry: isort + language: system + types: [python] - id: black - language_version: python3 # Should be a command that runs python3.6+ + name: black + entry: black + language: system + types: [python] + require_serial: true + - id: check-added-large-files + name: Check for added large files + entry: check-added-large-files + language: system + - id: check-toml + name: Check Toml + entry: check-toml + language: system + types: [toml] + - id: check-yaml + name: Check Yaml + entry: check-yaml + language: system + types: [yaml] + - id: end-of-file-fixer + name: Fix End of Files + entry: end-of-file-fixer + language: system + types: [text] + stages: [commit, push, manual] + - id: flake8 + name: flake8 + entry: flake8 + language: system + types: [python] + require_serial: true + - id: trailing-whitespace + name: Trim Trailing Whitespace + entry: trailing-whitespace-fixer + language: system + types: [text] + stages: [commit, push, manual] + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v2.3.0 + hooks: + - id: prettier diff --git a/{{ cookiecutter.repo_name }}/environment.yml b/{{ cookiecutter.repo_name }}/{% if cookiecutter.env_choice == 'conda' -%} environment.yml {%- endif %} similarity index 100% rename from {{ cookiecutter.repo_name }}/environment.yml rename to {{ cookiecutter.repo_name }}/{% if cookiecutter.env_choice == 'conda' -%} environment.yml {%- endif %} diff --git a/{{ cookiecutter.repo_name }}/pyproject.toml b/{{ cookiecutter.repo_name }}/{% if cookiecutter.env_choice == 'conda' -%} pyproject.toml {%- endif %} similarity index 100% rename from {{ cookiecutter.repo_name }}/pyproject.toml rename to {{ cookiecutter.repo_name }}/{% if cookiecutter.env_choice == 'conda' -%} pyproject.toml {%- endif %} diff --git a/{{ cookiecutter.repo_name }}/setup.cfg b/{{ cookiecutter.repo_name }}/{% if cookiecutter.env_choice == 'conda' -%} setup.cfg {%- endif %} similarity index 100% rename from {{ cookiecutter.repo_name }}/setup.cfg rename to {{ cookiecutter.repo_name }}/{% if cookiecutter.env_choice == 'conda' -%} setup.cfg {%- endif %} diff --git a/{{ cookiecutter.repo_name }}/setup.py b/{{ cookiecutter.repo_name }}/{% if cookiecutter.env_choice == 'conda' -%} setup.py {%- endif %} similarity index 100% rename from {{ cookiecutter.repo_name }}/setup.py rename to {{ cookiecutter.repo_name }}/{% if cookiecutter.env_choice == 'conda' -%} setup.py {%- endif %} diff --git a/{{ cookiecutter.repo_name }}/{% if cookiecutter.env_choice == 'poetry' -%} pyproject.toml {%- endif %} b/{{ cookiecutter.repo_name }}/{% if cookiecutter.env_choice == 'poetry' -%} pyproject.toml {%- endif %} new file mode 100644 index 0000000..2a0fc0d --- /dev/null +++ b/{{ cookiecutter.repo_name }}/{% if cookiecutter.env_choice == 'poetry' -%} pyproject.toml {%- endif %} @@ -0,0 +1,53 @@ +[tool.poetry] +name = "{{cookiecutter.project_name}}" +version = "0.0.1" +description = "{{cookiecutter.description}}" +authors = ["{{cookiecutter.author_name}}"] +license = "{{cookiecutter.open_source_license}}" +readme = "README.md" + +[tool.poetry.dependencies] +python = ">=3.7.1,<4.0.0" +click = "^8.0.1" + +[tool.poetry.dev-dependencies] +pytest = "^6.2.4" +pre-commit = "^2.13.0" +flake8 = "^3.9.2" +black = "^20.8b1" +reorder-python-imports = "^2.5.0" +pre-commit-hooks = "^4.0.1" +data-science-types = "^0.2.23" + +[tool.isort] +profile = "black" +include_trailing_comma = true +lines_after_imports = 2 +lines_between_types = 1 +use_parentheses = true +src_paths = ["src", "tests"] + +[tool.black] +line-length = 88 +include = '\.pyi?$' +exclude = ''' +/( + \.eggs + | \.git + | \.hg + | \.mypy_cache + | \.tox + | \.nox + | \.venv + | _build + | buck-out + | build + | dist + | tests/.*/setup.py + | \.ipynb_checkpoints +)/ +''' + +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api"