Lingbot-Map Class Naming Convention: From snake_case Files to PascalCase Classes
The Robbyant/lingbot-map repository adheres to a strict Python class naming convention where module filenames use snake_case and class definitions use PascalCase, following PEP 8 guidelines to create clear separation between file structure and object types.
The Robbyant/lingbot-map codebase implements a consistent class naming convention that maps snake_case module names to PascalCase class definitions. This pattern appears across all architectural layers—including models, heads, layers, and utilities—making the codebase immediately navigable for Python developers. Understanding this snake_case to PascalCase relationship is essential for correctly importing and extending the project's components.
The Snake_Case to PascalCase Pattern
The repository separates concerns at the file level by using distinct casing conventions for modules versus classes.
Module Names Use snake_case
All Python files in the repository use lowercase letters with underscores separating words. This convention applies uniformly across packages:
lingbot_map/models/gct_stream_window_v2.pylingbot_map/heads/camera_head.pylingbot_map/layers/vision_transformer.pylingbot_map/utils/rotation.py
Class Names Use PascalCase
Classes defined within these modules follow PascalCase (UpperCamelCase), where each word starts with a capital letter and no underscores separate words. The actual class names are semantic rather than mechanical transformations of the filenames:
class GCTStreamingct_stream_window_v2.pyclass CameraHeadincamera_head.pyclass DinoVisionTransformerinvision_transformer.py
Source Code Evidence
The pattern is consistent across the entire repository. In lingbot_map/models/gct_stream_window_v2.py, the module uses snake_case while the class definition follows PascalCase:
# In lingbot_map/models/gct_stream_window_v2.py
class GCTStream(GCTBase):
def forward(self, ...):
# Implementation details
pass
Similarly, lingbot_map/heads/camera_head.py defines:
# In lingbot_map/heads/camera_head.py
class CameraHead(nn.Module):
def __init__(self, ...):
super().__init__()
# Implementation details
And in lingbot_map/layers/vision_transformer.py:
# In lingbot_map/layers/vision_transformer.py
class DinoVisionTransformer(nn.Module):
def __init__(self, ...):
super().__init__()
# Implementation details
Why This Convention Matters
This class naming convention provides three critical benefits:
- Readability – Imports like
from lingbot_map.models.gct_stream_window_v2 import GCTStreaminstantly distinguish the module (file) from the class (object) - PEP 8 Compliance – The repository follows the official Python style guide recommendation that modules use short lowercase names and classes use CapWords
- IDE Navigation – Developers can search by snake_case filenames or PascalCase class names without ambiguity
Practical Implementation Guide
When importing components, the distinction between snake_case modules and PascalCase classes creates readable, self-documenting code:
from lingbot_map.models.gct_stream_window_v2 import GCTStream
from lingbot_map.heads.camera_head import CameraHead
model = GCTStream()
head = CameraHead()
Adding a New Component
To create a new component following this convention:
- Create the module file using snake_case:
touch lingbot_map/heads/my_new_head.py
- Define the class using PascalCase:
# lingbot_map/heads/my_new_head.py
import torch.nn as nn
class MyNewHead(nn.Module):
def __init__(self, ...):
super().__init__()
# Implementation details
- Import using the standard pattern:
from lingbot_map.heads.my_new_head import MyNewHead
Summary
- Module files in Robbyant/lingbot-map always use snake_case (e.g.,
gct_stream_window_v2.py,camera_head.py) - Class definitions always use PascalCase (e.g.,
GCTStream,CameraHead,DinoVisionTransformer) - This pattern appears consistently across
models/,heads/,layers/, andutils/directories - The convention aligns with PEP 8 and improves code readability by distinguishing file structure from instantiated objects
- Import statements follow the pattern:
from snake_case_module import PascalCaseClass
Frequently Asked Questions
Does Lingbot-Map use snake_case for all filenames?
Yes, every Python module in the repository follows snake_case naming, including lingbot_map/models/gct_stream_window_v2.py, lingbot_map/utils/rotation.py, and lingbot_map/layers/vision_transformer.py. This applies universally regardless of whether the file contains classes, functions, or only constants.
How do I convert a snake_case filename to its corresponding class name?
While filenames use snake_case and class names use PascalCase, they are not always direct mechanical conversions. For example, gct_stream_window_v2.py contains class GCTStream, not GctStreamWindowV2. The repository prefers semantic class names that describe the component's purpose rather than mirroring the exact filename structure.
Are there any exceptions to the PascalCase class naming rule?
No, the Robbyant/lingbot-map source code maintains strict consistency. All class definitions found in lingbot_map/models/, lingbot_map/heads/, and lingbot_map/layers/ follow PascalCase without exception, including GCTStream, CameraHead, and DinoVisionTransformer.
Does this convention apply to utility modules without classes?
Yes, even utility modules like lingbot_map/utils/rotation.py follow snake_case file naming, even when they only expose functions rather than classes. The file naming convention applies universally across all modules, while PascalCase is reserved specifically for class definitions.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →