Skip to content

Commit

Permalink
Refactoring some modules into the "files" package.
Browse files Browse the repository at this point in the history
  • Loading branch information
domdfcoding committed Jul 25, 2020
1 parent 49254ed commit 6780a7d
Show file tree
Hide file tree
Showing 36 changed files with 180 additions and 122 deletions.
2 changes: 1 addition & 1 deletion repo_helper/__init__.py
@@ -1,4 +1,4 @@
# !/usr/bin/env python
#!/usr/bin/env python
#
# __init__.py
"""
Expand Down
2 changes: 1 addition & 1 deletion repo_helper/__main__.py
@@ -1,4 +1,4 @@
# !/usr/bin/env python
#!/usr/bin/env python
#
# __main__.py
"""
Expand Down
2 changes: 1 addition & 1 deletion repo_helper/blocks.py
@@ -1,4 +1,4 @@
# !/usr/bin/env python
#!/usr/bin/env python
#
# blocks.py
"""
Expand Down
2 changes: 1 addition & 1 deletion repo_helper/config_vars.py
@@ -1,4 +1,4 @@
# !/usr/bin/env python
#!/usr/bin/env python
#
# config_vars.py
#
Expand Down
2 changes: 1 addition & 1 deletion repo_helper/configeditor.py
@@ -1,4 +1,4 @@
# !/usr/bin/env python
#!/usr/bin/env python
#
# configeditor.py
"""
Expand Down
2 changes: 1 addition & 1 deletion repo_helper/configuration.py
@@ -1,4 +1,4 @@
# !/usr/bin/env python
#!/usr/bin/env python
#
# configuration.py
#
Expand Down
22 changes: 12 additions & 10 deletions repo_helper/core.py
@@ -1,4 +1,4 @@
# !/usr/bin/env python
#!/usr/bin/env python
#
# core.py
"""
Expand Down Expand Up @@ -30,13 +30,13 @@

# 3rd party
import jinja2
from domdf_python_tools.paths import clean_writer, PathPlus
from domdf_python_tools.paths import PathPlus
from domdf_python_tools.utils import enquote_value
from configupdater import ConfigUpdater # type: ignore

# this package
from .bots import make_auto_assign_action, make_dependabot, make_imgbot, make_stale_bot
from .ci_cd import (
from repo_helper.files.bots import make_auto_assign_action, make_dependabot, make_imgbot, make_stale_bot
from repo_helper.files.ci_cd import (
make_github_manylinux,
remove_copy_pypi_2_github,
make_github_ci,
Expand All @@ -46,7 +46,7 @@
make_travis,
make_travis_deploy_conda,
)
from .docs import (
from repo_helper.files.docs import (
copy_docs_styling,
ensure_doc_requirements,
make_404_page,
Expand All @@ -56,12 +56,14 @@
make_rtfd,
rewrite_docs_index,
)
from .gitignore import make_gitignore
from .linting import (code_only_warning, lint_fix_list, lint_warn_list, make_lint_roller, make_pylintrc)
from .packaging import make_manifest, make_pkginfo, make_pyproject, make_setup, make_setup_cfg
from .readme import rewrite_readme
from repo_helper.files.gitignore import make_gitignore
from repo_helper.files.linting import (
code_only_warning, lint_fix_list, lint_warn_list, make_lint_roller, make_pylintrc
)
from repo_helper.files.packaging import make_manifest, make_pkginfo, make_pyproject, make_setup, make_setup_cfg
from repo_helper.files.readme import rewrite_readme
from .templates import template_dir
from .testing import ensure_tests_requirements, make_isort, make_pre_commit, make_tox, make_yapf
from repo_helper.files.testing import ensure_tests_requirements, make_isort, make_pre_commit, make_tox, make_yapf
from .yaml_parser import parse_yaml

__all__ = [
Expand Down
24 changes: 24 additions & 0 deletions repo_helper/files/__init__.py
@@ -0,0 +1,24 @@
#!/usr/bin/env python
#
# __init__.py
"""
Functions to create files
"""
#
# Copyright © 2020 Dominic Davis-Foster <dominic@davis-foster.co.uk>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
2 changes: 1 addition & 1 deletion repo_helper/bots.py → repo_helper/files/bots.py
@@ -1,4 +1,4 @@
# !/usr/bin/env python
#!/usr/bin/env python
#
# bots.py
"""
Expand Down
4 changes: 2 additions & 2 deletions repo_helper/ci_cd.py → repo_helper/files/ci_cd.py
@@ -1,4 +1,4 @@
# !/usr/bin/env python
#!/usr/bin/env python
#
# ci_cd.py
"""
Expand Down Expand Up @@ -32,7 +32,7 @@
from domdf_python_tools.paths import PathPlus

# this package
from .templates import template_dir
from repo_helper.templates import template_dir

__all__ = [
"make_travis",
Expand Down
4 changes: 2 additions & 2 deletions repo_helper/docs.py → repo_helper/files/docs.py
@@ -1,4 +1,4 @@
# !/usr/bin/env python
#!/usr/bin/env python
#
# docs.py
"""
Expand Down Expand Up @@ -54,7 +54,7 @@
)

# this package
from .templates import init_repo_template_dir, template_dir
from repo_helper.templates import init_repo_template_dir, template_dir

__all__ = [
"ensure_doc_requirements",
Expand Down
129 changes: 80 additions & 49 deletions repo_helper/gitignore.py → repo_helper/files/gitignore.py
@@ -1,4 +1,4 @@
# !/usr/bin/env python
#!/usr/bin/env python
#
# gitignore.py
"""
Expand Down Expand Up @@ -36,16 +36,20 @@
"make_gitignore",
]

ignores = [
# Byte-compiled / optimized / DLL files
ignores: List[str] = []

# Byte-compiled / optimized / DLL files
ignores.extend((
"__pycache__/",
"*.py[cod]",
"*$py.class",
))

# C extensions
"*.so"
# C extensions
ignores.extend(("*.so", ))

# Distribution / packaging
# Distribution / packaging
ignores.extend((
".Python",
"build/",
"develop-eggs/",
Expand All @@ -63,18 +67,24 @@
".installed.cfg",
"*.egg",
"*.egg*",
))

# 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.
# 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.
ignores.extend((
"*.manifest",
"*.spec",
))

# Installer logs
# Installer logs
ignores.extend((
"pip-log.txt",
"pip-delete-this-directory.txt",
))

# Unit test / coverage reports
# Unit test / coverage reports
ignores.extend((
"htmlcov/",
".tox/",
".coverage",
Expand All @@ -86,97 +96,118 @@
".hypothesis/",
".pytest_cache/",
"cover/",
))

# Translations
# Translations
ignores.extend((
"*.mo",
"*.pot",
))

# Django stuff:
# Django stuff:
ignores.extend((
"*.log",
"local_settings.py",
"db.sqlite3",
))

# Flask stuff:
# Flask stuff:
ignores.extend((
"instance/",
".webassets-cache",
))

# Scrapy stuff:
".scrapy",
# Scrapy stuff:
ignores.extend((".scrapy", ))

# Sphinx documentation
# Sphinx documentation
ignores.extend((
"docs/_build/",
"doc/build",
))

# PyBuilder
# PyBuilder
ignores.extend([
"target/",
])

# Jupyter Notebook
".ipynb_checkpoints",
# Jupyter Notebook
ignores.extend((".ipynb_checkpoints", ))

# pyenv
".python-version",
# pyenv
ignores.extend((".python-version", ))

# celery beat schedule file
"celerybeat-schedule",
# celery beat schedule file
ignores.extend(("celerybeat-schedule", ))

# SageMath parsed files
"*.sage.py",
# SageMath parsed files
ignores.extend(("*.sage.py", ))

# Environments
# Environments
ignores.extend((
".env",
".venv",
"env/",
"venv/",
"ENV/",
"env.bak/",
"venv.bak/",
))

# Spyder project settings
# Spyder project settings
ignores.extend((
".spyderproject",
".spyproject",
))

# Rope project settings
".ropeproject",
# Rope project settings
ignores.extend((".ropeproject", ))

# mkdocs documentation
"/site",
# mkdocs documentation
ignores.extend(("/site", ))

# mypy
".mypy_cache/",
# mypy
ignores.extend((".mypy_cache/", ))

# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# Gradle
# Gradle
ignores.extend((
"*.iml",
"*.ipr",
))

# CMake
"cmake-build-*/",
# CMake
ignores.extend(("cmake-build-*/", ))

# Mongo Explorer plugin
".idea/**/mongoSettings.xml",
# Mongo Explorer plugin
ignores.extend((".idea/**/mongoSettings.xml", ))

# File-based project format
"*.iws",
# File-based project format
ignores.extend(("*.iws", ))

# IntelliJ
"out/",
# IntelliJ
ignores.extend(("out/", ))

# JIRA plugin
"atlassian-ide-plugin.xml",
# JIRA plugin
ignores.extend(("atlassian-ide-plugin.xml", ))

# Crashlytics plugin (for Android Studio and IntelliJ)
# Crashlytics plugin (for Android Studio and IntelliJ)
ignores.extend((
"com_crashlytics_export_strings.xml",
"crashlytics.properties",
"crashlytics-build.properties",
"fabric.properties",
))

ignores.extend((
".idea",
"build",
"*.egg-info",
"**/__pycache__",
"**/conda",
]
))


def make_gitignore(repo_path: pathlib.Path, templates: jinja2.Environment) -> List[str]:
Expand Down

0 comments on commit 6780a7d

Please sign in to comment.