Coding tips and tricks
rlaplaza
July 30, 2025
Coding Practices Guidelines
Foundation & Learning Resources
- Software Carpentry Fundamentals: Master basic coding practices through Software Carpentry and Coderefinery workshops, covering Unix shell commands, Git version control, and essential Python programming skills. Any time spent learning is well spent!
- Scientific Computing Scripting: Develop proficiency in scripting for scientific computing using resources from the NSF MolSSI group’s comprehensive Python tutorials
- Deep Learning Education: Utilize d2l.ai resources for comprehensive deep learning fundamentals, including their preliminaries section and appendix of essential tools
- Command Line Editors: Gain familiarity with standard editors like Vim, Emacs, or Nano to facilitate efficient editing and remote cluster work; MIT’s IAP “Missing Semester” class provides excellent guidance on these tools and other essential development utilities
- Every Day Life: I recommend using a good IDE, such as VSCode, which also has python tutorials and integration with LLMs. Whatever tools you choose to use every day, you should get to know in depth!
Python Development Standards
- Code Style & Quality: We do most of our coding in python. Adhere to PEP 8 guidelines for Python code formatting and use automated tools like Pylint, Google’s yapf, black, or Sublime Text’s AutoPEP8 to maintain consistent style standards
- Type Safety: Ideally, implement optional type hints to improve code readability and help others understand function signatures and variable types more easily
- Style Guide Compliance: Follow Google’s comprehensive Python style guide for professional-quality code structure and documentation practices
Project Structure & Organization
- Beyond Notebooks: While Jupyter notebooks are excellent for experimental analysis and tutorials, prioritize well-organized, documented codebases for rigorous testing and reproducible research using frameworks like cookiecutter-data-science templates or dl-chem-101
- Repository Management: Utilize private repositories for continuous work backup
- Code Publication: Before open-sourcing code, thoroughly audit repositories to remove proprietary information, passwords, or private data; consider creating clean repositories for finalized code publication in the group’s GitHub organization
Reproducibility & Environment Management
- Why?: See reasons to use conda
- Dependency Management: Always use dependency managers like Conda or uv for Python package management, or Docker containers for complex multi-language dependencies to ensure reproducible environments
- Environment Documentation: Maintain clear documentation of all software dependencies, versions, and system requirements necessary to reproduce your computational environment, at least once the project is done and other people are supposed to use it (including me!)
Collaboration & Continuous Learning
- Knowledge Sharing: Actively contribute to and consult the group’s code-tips repository, which serves as a living collection of useful resources, helpful packages, and development tools
- Ask for Help: Don’t hesitate to seek guidance from group members on development workflows, GitHub usage, or any coding challenges—everyone learns these skills over time
- Workflow Optimization: Trust your instincts when thinking “there must be a better way to do this” — there usually is, and the group can help you find it
Modern Development Tools
- AI-Assisted Coding: Embrace large language model assistants like GitHub Copilot for code generation, while maintaining responsibility for understanding, testing, and validating all generated code
- Code Accountability: Ensure you can explain and verify any AI-generated code through appropriate testing and remain fully accountable for the final software product
Resources
- Advanced bash course by the fantastic Michael Herbst