Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gitignore Basic Setup #128

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion robotpy_installer/cli_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def run(self, main_file: pathlib.Path, project_path: pathlib.Path):

logger.info("Created empty %s", main_file)

# Create pyproject.toml if it doesn't already exist
# Create pyproject.toml and .gitignore if it doesn't already exist
Suave101 marked this conversation as resolved.
Show resolved Hide resolved
pyproject_path = pyproject.toml_path(project_path)
if not pyproject_path.exists():
pyproject.write_default_pyproject(project_path)
Expand Down
306 changes: 306 additions & 0 deletions robotpy_installer/pyproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ def toml_path(project_path: pathlib.Path):
return project_path / "pyproject.toml"


def gitignore_path(project_path: pathlib.Path):
return project_path / ".gitignore"


@dataclasses.dataclass
class RobotPyProjectToml:
"""
Expand Down Expand Up @@ -171,6 +175,308 @@ def write_default_pyproject(
with open(toml_path(project_path), "w") as fp:
fp.write(content)

ignore_content = inspect.cleandoc(
"""
# Executables
*.exe
*.out
*.app

# Log file
*.log

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

### Windows ###
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

### Gradle ###
Suave101 marked this conversation as resolved.
Show resolved Hide resolved
.gradle
/build/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Cache of project
.gradletasknamecache

# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties

# # VS Code Specific Java Settings
# DO NOT REMOVE .classpath and .project
.classpath
.project
.settings/
bin/

# IntelliJ
*.iml
*.ipr
*.iws
.idea/
out/

# Fleet
.fleet

# Simulation GUI and other tools window save file
networktables.json
simgui.json
*-window.json

# Simulation data log directory
logs/

# Folder that has CTRE Phoenix Sim device config storage
ctre_sim/

# clangd
/.cache
compile_commands.json

# Eclipse generated file for annotation processors
.factorypath

# 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/
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:
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
.python-version
Suave101 marked this conversation as resolved.
Show resolved Hide resolved

# pipenv
Pipfile.lock

# UV
uv.lock

# poetry
poetry.lock
Suave101 marked this conversation as resolved.
Show resolved Hide resolved

# pdm
pdm.lock
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__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/

# PyPI configuration file
.pypirc
"""
)

ignore_content += "\n"

with open(gitignore_path(project_path), "w") as fp:
fp.write(ignore_content)


def load(
project_path: pathlib.Path,
Expand Down