ResearchCodes is a personal research code vault. Everything lives under Projects/ as self contained project folders (example data, Python modules, notebooks, notes). The goal is to make it easy to clone anywhere, reproduce the environment, and reuse code later.
git clone git@github.com:Yong2Sheng/ResearchCodes.git
cd ResearchCodesCreate a fresh environment:
conda env create -f environment.yml
conda activate researchcodesNotes:
environment.ymlis the source of truth for dependencies.- If you add a new import in any project module, update
environment.ymlaccordingly. - Prefer keeping the environment reproducible on a clean machine, because CI will validate it.
During developing, you can update an existing environment to match environment.yml (and remove packages no longer listed):
conda env update -f environment.yml --prune
conda activate researchcodeThis repo is configured to run checks on git push (not on every commit).
pre-commit install -fManually run the same checks that would run on push:
pre-commit run --all-files --hook-stage pre-pushSmoke tests are intentionally lightweight. They mainly validate that key modules can be imported in the current environment.
pytest -q -m smoke -x -raTo see what smoke tests would be collected:
pytest -m smoke --collect-onlyProjects/- Each subfolder is an independent project workspace.
- Typical contents:
*.py, notebooks, configs, small example data.
tests/- Smoke tests (import checks and minimal sanity checks).
environment.yml- Conda environment specification (primary dependency source of truth).
pyproject.toml- Pytest configuration (markers, test discovery).
.pre-commit-config.yaml- Pre-push hooks (lint, hygiene checks, smoke test).
.github/workflows/ci.yml- CI runs pre-commit (full repo) and smoke tests on a clean environment.
GitHub Actions runs on push and pull requests:
- A
pre-commitjob that runs repository hooks against the full repository. - A
smokejob that builds the conda environment fromenvironment.ymland runspytest -m smoke.
CI is useful because it runs in a clean environment. If something imports locally only because your machine already had an extra dependency installed, CI will catch it.
Some hooks can automatically edit files (for example trimming trailing whitespace). This repo restricts auto-fix hooks to code and configuration file extensions to prevent accidental edits to scientific data files.
Avoid committing large raw datasets into git. Prefer small example inputs that are sufficient to reproduce a workflow, and store large data elsewhere.