Skip to content

File Naming Conventions Guide

Overview

To maintain consistency and readability in our project, we use the "snake_case" naming convention for all file names. This guide provides a set of rules and examples to help you name files correctly.

What is Snake_Case?

Snake_case is a naming convention where each word in a file name is lowercase and separated by underscores (_). This format is easy to read and avoids issues with different operating systems handling file names differently.

Rules for Snake_Case File Naming

  1. Use Lowercase Letters: All letters should be in lowercase.
  2. Separate Words with Underscores: Use underscores (_) to separate words.
  3. Be Descriptive: File names should be descriptive enough to indicate their contents or purpose.
  4. Avoid Special Characters: Do not use spaces, hyphens, or any special characters other than underscores.
  5. Use Consistent Extensions: Ensure file extensions are consistent and appropriate for the file type (e.g., .py for Python files, .md for Markdown files).

Examples

Python Scripts

  • data_cleaning.py
  • config_settings.py
  • test_data_processing.py

Configuration Files

  • project_config.yaml
  • database_setup.json

Documentation Files

  • user_guide.md
  • api_reference.md

Jupyter Notebooks

  • data_analysis_notebook.ipynb
  • machine_learning_experiments.ipynb

Data Files

  • CSV files: sales_data_2023.csv
  • JSON files: user_profiles.json

Tips

  • Keep it Short and Simple: Aim for clarity but avoid overly long file names.
  • Versioning: If versioning is needed, append the version number at the end (e.g., data_cleaning_v2.py).
  • Avoid Redundancy: Avoid repeating the same word unnecessarily in file names.

Common Mistakes to Avoid

  • Uppercase Letters: Data_Cleaning.py (Incorrect)
  • Hyphens: data-cleaning.py (Incorrect)
  • Spaces: data cleaning.py (Incorrect)
  • Special Characters: data@cleaning!.py (Incorrect)

By following these guidelines, we ensure that our file names are consistent, readable, and easy to manage across different systems and environments.