Whatβs in This Template Project?ο
π This project is designed for a Python-based code repository. It includes features to help you manage, test, document, and share your code.
Below is an overview of the files and folders youβll find in the template-project, along with what they do and why theyβre useful. If youβre new to GitHub or Python packaging, this is your orientation.
π Project Structure Overviewο
π· This is what the template looks like when you clone or fork it:
π template-project File Structureο
A minimal, modular Python project structure for collaborative research and reproducible workflows.
template-project/
βββ src/ # [core] "src layout" β package lives here, not the repo root
β βββ template_project/ # [core] Main Python package with scientific code
β βββ __init__.py # [core] Makes this a Python package; exposes read/write/plot/process verbs
β βββ plotters/ # [core] Functions to plot data (transport.py, tables.py)
β βββ readers/ # [core] Functions to read raw data into xarray datasets
β β βββ rapid.py # [core] Example reader for a specific dataset (RAPID)
β βββ writers/ # [core] Functions to write data, e.g. to NetCDF (netcdf.py)
β βββ processors/ # [core] Unit conversion, calculations, etc. (units.py)
β βββ logger.py # [core] Structured logging configuration for reproducible runs
β βββ template_project.mplstyle # [core] Default plotting parameters
β βββ utilities.py # [core] Helper functions (e.g., file download or parsing)
β
βββ tests/ # [test] Unit tests using pytest
β βββ test_readers.py # [test] Test functions in readers/
β βββ test_processors.py # [test] Test functions in processors/
β βββ test_utilities.py # [test] Test functions in utilities.py
β βββ ...
β
βββ docs/ # [docs]
β βββ source/ # [docs] Sphinx documentation source files
β β βββ conf.py # [docs] Setup for documentation
β β βββ index.rst # [docs] Main page with menus in *.rst
β β βββ setup.md # [docs] One of the documentation pages in *.md
β β βββ template_project.rst # [docs] The file to create the API based on docstrings
β β βββ ... # [docs] More *.md or *.rst linked in index.rst
β β βββ _static # [docs] Figures
β β βββ css/custom.css # [docs, style] Custom style sheet for docs
β β βββ logo.png # [docs] logo for top left of docs/
β βββ environment.yml # [docs, meta] Conda env (python 3.11 + pandoc + pip install -e .[dev])
β βββ Makefile # [docs] Build the docs
β
βββ notebooks/ # [demo] Example notebooks
β βββ demo.ipynb # [demo] Also run in docs.yml to appear in docs
β βββ ...
β
βββ data/ # [data]
β βββ moc_transports.nc # [data] Example data file used for the template.
β
βββ logs/ # [core] Log output from structured logging
β βββ <ARRAY>_<timestamp>_read.log # [core] e.g. MOVE_20260707T10_read.log
β
βββ .github/ # [ci] GitHub-specific workflows (e.g., Actions)
β βββ workflows/
β β βββ docs.yml # [ci] Test build documents on *pull-request*
β β βββ docs_deploy.yml # [ci] Build and deploy documents on "merge"
β β βββ pypi.yml # [ci] Package and release on GitHub.com "release"
β β βββ test.yml # [ci] Run pytest on tests/test_<name>.py on *pull-request*
β βββ ISSUE_TEMPLATE.md # [ci, meta] Template for issues on Github
β βββ PULL_REQUEST_TEMPLATE.md # [ci, meta] Template for pull requests on Github
β
βββ .gitignore # [meta] Exclude build files, logs, data, etc.
βββ pyproject.toml # [ci, meta, style] Build system, dependencies (test/docs/dev extras), ruff config
βββ CITATION.cff # [meta] So Github can populate the "cite" button
βββ README.md # [meta] Project overview and getting started
βββ LICENSE # [meta] Open source license (e.g., MIT as default)
The tags above give an indication of what parts of this template project are used for what purposes, where:
# [core]β Scientific core logic or core functions used across the project.
# [docs]β Documentation sources, configs, and assets for building project docs.# [test]β Automated tests for validating functionality.# [demo]β Notebooks and minimal working examples for demos or tutorials.# [data]β Sample or test data files.# [ci]β Continuous integration setup (GitHub Actions).# [style]β Configuration for code style, linting, and formatting.# [meta]β Project metadata (e.g., citation info, license, README).
Note: There are also files that you may end up generating but which donβt necessarily appear in the project on GitHub.com (due to being ignored by your .gitignore). These may include your environment (venv/, if you use pip and virtual environments), distribution files dist/ for building packages to deploy on http://pypi.org, htmlcov/ for coverage reports for tests, template_project_efw.egg-info for editable installs (e.g., pip install -e .).
π Notesο
Modularity: Code is split by function (reading, writing, tools).
Logging: All major functions support structured logging to
logs/.Tests: Pytest-compatible tests are in
tests/, with one file per module.Docs: Sphinx documentation is in
docs/.
π° The Basics (Always Included)ο
README.mdβ The first thing people see when they visit your GitHub repo. Use this to explain what your project is, how to install it, and how to get started.LICENSEβ Explains what others are allowed to do with your code. This template uses the MIT License:β Very permissive β allows commercial and private use, modification, and distribution.
π More license info: choosealicense.com
.gitignoreβ Tells Git which files/folders to ignore (e.g., system files, data outputs).pyproject.tomlβ Declares the Python packages your project needs to run, plus optionaltest,docs, anddevextras.
π§° Python Packaging and Developmentο
pyproject.tomlβ A modern configuration file for building, installing, and describing your package (e.g. name, author, dependencies). Runtime dependencies plus thetest,docs, anddevextras (testing, linting, formatting, docs tools) are all declared here.src/template_project/β Your main code lives here, under a top-levelsrc/directory (the βsrc layoutβ). Keeping the package out of the repo root means tests import the installed package rather than the working copy. Python treats this as an importable module (the import name is stilltemplate_project).pip install -e ".[dev]"β Installs your project locally (editable) together with the full development toolchain, updating as you edit files.
π§ͺ Testing and Continuous Integrationο
tests/β Folder for test files. Use these to make sure your code works as expected..github/workflows/β GitHub Actions automation:tests.ymlβ Runs your tests automatically when you push changes.docs.ymlβ Builds your documentation to check for errors.docs_deploy.ymlβ Publishes documentation to GitHub Pages.pypi.ymlβ Builds and uploads a release to PyPI when you tag a new version.
π Documentationο
docs/β Contains Sphinx and Markdown files to build your documentation site.Run
make htmlor use GitHub Actions to generate a website.
.vscode/β Optional settings for Visual Studio Code (e.g., interpreter paths).notebooks/β A place to keep example Jupyter notebooks.
π§Ύ Metadata and Communityο
CITATION.cffβ Machine-readable citation info. Lets GitHub generate a βCite this repositoryβ button.CONTRIBUTING.mdβ Guidelines for contributing to the project. Useful if you welcome outside help.docs/environment.ymlβ Conda/mamba environment for building the docs (python 3.11 + pandoc, thenpip install -e .[dev]).
π€ Automation Featuresο
This template includes several automation features to streamline development:
Dependabot (Dependency Updates)ο
File:
.github/dependabot.ymlPurpose: Automatically creates PRs to update Python dependencies and GitHub Actions
Schedule: Weekly on Mondays
To disable: Delete
.github/dependabot.ymlor comment out the package ecosystems you donβt want
Towncrier (Automated Changelog)ο
Files:
pyproject.toml([tool.towncrier] section),changelog.d/Purpose: Generates changelogs from fragment files
Usage: Create
.mdfiles inchangelog.d/describing changes, then runtowncrier buildTo disable:
Remove
towncrierfrom thedevextra inpyproject.tomlRemove
[tool.towncrier]section frompyproject.tomlDelete
changelog.d/directory
Linting & Formatting (Ruff)ο
Config:
[tool.ruff]section ofpyproject.tomlPurpose:
ruffhandles both linting and formatting; the CIlintjob runsruff check .andruff format --check .on every pull requestNote: This project does not use
pre-commit; linting is enforced CI-side. See the linting & formatting guide.
Note: These automation features are optional but recommended for maintaining code quality and staying up-to-date with dependencies.
β Summaryο
This template is a starting point for research or open-source Python projects. It supports:
Clean project structure
Reproducible environments
Easy testing
Auto-publishing documentation
Optional packaging for PyPI
π‘ Use what you need. Delete what you donβt. This is your scaffold for doing good, shareable science/code.