From 6276cb1ab8f26d1d1007c380db53c3ba1000426d Mon Sep 17 00:00:00 2001 From: Mackenzie Mathis Date: Thu, 19 Jun 2025 15:46:43 +0200 Subject: [PATCH 1/5] Update .pre-commit-config.yaml - add google flag! Signed-off-by: Mackenzie Mathis --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a21cfee..4f24933 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,6 +11,7 @@ repos: rev: 5.12.0 hooks: - id: isort + args: ["--profile", "google"] - repo: https://github.com/psf/black rev: 22.3.0 hooks: From 7f1db78709930b8b0b294d6f930e27581ef605b4 Mon Sep 17 00:00:00 2001 From: Mackenzie Mathis Date: Thu, 19 Jun 2025 15:47:22 +0200 Subject: [PATCH 2/5] Update pyproject.toml - relax single line imports Signed-off-by: Mackenzie Mathis --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 3f0ebf9..d08bd32 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ based_on_style = "google" indent_width = 4 [tool.isort] -force_single_line = true +force_single_line = false force_sort_within_sections = false lexicographical = true single_line_exclusions = ['typing'] From 68c2a23836bcfac426100d24135f4722c5c6c7e0 Mon Sep 17 00:00:00 2001 From: Mackenzie Mathis Date: Thu, 19 Jun 2025 15:48:53 +0200 Subject: [PATCH 3/5] Create format.yml - this will check if you really ran your pre-commit ;) if it fails, locally run and `git add .` then git push! Signed-off-by: Mackenzie Mathis --- .github/workflows/format.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/format.yml diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 0000000..9b774a4 --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,24 @@ +name: pre-commit-format + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + pre_commit_checks: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: ${{ github.head_ref }} + + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - run: pip install -r requirements.txt + - run: pip install pre-commit + - run: pre-commit run --all-files From 864abd76bd5a0a47e75640897466010ef6ed3460 Mon Sep 17 00:00:00 2001 From: Mackenzie Mathis Date: Thu, 19 Jun 2025 16:20:32 +0200 Subject: [PATCH 4/5] Create requirements.txt - min. example requirements Signed-off-by: Mackenzie Mathis --- requirements.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..80a3df5 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,10 @@ +numpy +pandas +scipy +matplotlib +seaborn +cebra +pytest +pytest-cov +isort +yapf From f763c88b318b75738a41cf00fe6fde517a52e8b4 Mon Sep 17 00:00:00 2001 From: MMathisLab Date: Thu, 19 Jun 2025 16:25:59 +0200 Subject: [PATCH 5/5] formatting --- README.md | 6 +++--- _toc.yml | 1 - docs/DEV_GUIDE.md | 24 ++++++++++++------------ docs/HowTo_JupyterBook.md | 2 -- docs/StyleGuide.md | 16 ++++++++-------- 5 files changed, 23 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 81a1512..e34b7d0 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ project_name/ * Formatted code makes your life and those who use/review your code easier. Standardized formatting with tools like `black` and `isort` (see the provided `.pre-commit-config.yaml`). * [Pre-commit hooks](https://pre-commit.com/) to automate checks before pushing code! Follow their quick Guide to do this, but in short: - + (1) install it in your dev env ```python pip install pre-commit @@ -85,12 +85,12 @@ project_name/ * [DataJoint](https://www.datajoint.com/) examples for managing and querying scientific data pipelines - these are a must; use minimally for data + meta data storage, and use it to automate things you do daily (preprocessing, running DeepLabCut, etc!) * [Templates for common workflows and schema management are here!](https://docs.datajoint.com/elements/) - + 7. **Style Guide for overall code & project management** * Tips and practices for code, manuscripts, and figures. - + --- diff --git a/_toc.yml b/_toc.yml index 0205e0f..e89d4c2 100644 --- a/_toc.yml +++ b/_toc.yml @@ -7,4 +7,3 @@ parts: - file: docs/DEV_GUIDE - file: docs/Learning_resources - file: docs/HowTo_JupyterBook - diff --git a/docs/DEV_GUIDE.md b/docs/DEV_GUIDE.md index ea944f8..bb4604d 100644 --- a/docs/DEV_GUIDE.md +++ b/docs/DEV_GUIDE.md @@ -13,7 +13,7 @@ 1. **Be Constructive and Respectful** - Focus on the code, not the person 🔐 - Provide clear, actionable feedback 🚧 - - Explain the "why" behind your suggestions + - Explain the "why" behind your suggestions - Use a positive and encouraging tone 💜 2. **Review Checklist** @@ -96,7 +96,7 @@ ## Collaborative Coding Guidelines -Each project is different, so please check project-specific guidelines. +Each project is different, so please check project-specific guidelines. However, below is a guide for collaborative projects in general. I recommend the following system for within-lab projects that have different levels of maintainers & builders. @@ -108,7 +108,7 @@ I recommend the following system for within-lab projects that have different lev - No one person is the gate-keeper for the project: work together 2. **Get a review assignment system in place** - 🟥 Make a flag for **major dev/changes**: all users of the code should agree and sign off (git reviews), and this includes the PI. - - 🟧 Make a flag for **user-needs**: this is needed to stop a block -- it might not be perfect, so make an issue to revisit later. 1 sign off from another user, and go! 🚀 + - 🟧 Make a flag for **user-needs**: this is needed to stop a block -- it might not be perfect, so make an issue to revisit later. 1 sign off from another user, and go! 🚀 - 🟩 Make a flag for **minor change**: not breaking, can be changed later, 1 sign off okay ### Git Workflow @@ -137,7 +137,7 @@ I recommend the following system for within-lab projects that have different lev 1. **Team Communication** - Use appropriate channels for different purposes - use basecamp campfire and github issues/PRs - - Be clear and concise + - Be clear and concise - Document important decisions!! - Share knowledge and learnings @@ -200,13 +200,13 @@ We use the Google Style Guide: https://google.github.io/styleguide/ - Spaces after commas and semicolons 4. **Naming Conventions** - - Variables: `lower_snake_case` - - Functions: `lower_snake_case` - - Classes: `PascalCase` - - onstants: `UPPER_SNAKE_CASE` - - Files: `lower_snake_case.py` - - Private members: `_single_leading_underscore` - - Modules/Packages: `lower_snake_case` + - Variables: `lower_snake_case` + - Functions: `lower_snake_case` + - Classes: `PascalCase` + - onstants: `UPPER_SNAKE_CASE` + - Files: `lower_snake_case.py` + - Private members: `_single_leading_underscore` + - Modules/Packages: `lower_snake_case` - Interfaces: `PascalCase` (same as classes, no special prefix) 5. **Comments** @@ -270,4 +270,4 @@ We use the Google Style Guide: https://google.github.io/styleguide/ --- -Remember: These guidelines are living documents. Feel free to suggest improvements and updates as the team evolves and learns. +Remember: These guidelines are living documents. Feel free to suggest improvements and updates as the team evolves and learns. diff --git a/docs/HowTo_JupyterBook.md b/docs/HowTo_JupyterBook.md index 1404e82..5702260 100644 --- a/docs/HowTo_JupyterBook.md +++ b/docs/HowTo_JupyterBook.md @@ -40,5 +40,3 @@ To then deploy the book live, see: https://jupyterbook.org/en/stable/publish/gh- In short, Go to Settings > Pages and set up anaction to deploy to a new branch (that you never merge) called `gh-pages`: ![Screen Shot 2025-06-17 at 2 20 19 PM](https://github.com/user-attachments/assets/17d13802-6543-4859-ac09-7abbd491277d) - - diff --git a/docs/StyleGuide.md b/docs/StyleGuide.md index 68ccd7a..23bcb88 100644 --- a/docs/StyleGuide.md +++ b/docs/StyleGuide.md @@ -5,7 +5,7 @@ Please see our overall guide on code & project formatting [here](https://github.com/AdaptiveMotorControlLab/WorkspaceTemplate/blob/main/README.md). -### Main Principles 🔨 Organize your code & data: +### Main Principles 🔨 Organize your code & data: - For experimental and ML projects, please use [DataJoint/databases](https://www.datajoint.com/) - Be sure you work under a lab repo, typically called "https://github.com/AdaptiveMotorControlLab/YourName_workspace". - For larger projects (DLC, CEBRA, ExperimentalPipelines, you should be sure your "final" work gets into a pipeline; talk to Mackenzie about this) @@ -19,7 +19,7 @@ Please see our overall guide on code & project formatting [here](https://github. -## Ready to write up your work and share your hard work, data, & code? +## Ready to write up your work and share your hard work, data, & code? Here is how to do so most efficiently with me. - 🚨 First, I recommend having a one-on-one so we can lay out the paper sketch, authors, data and code sharing plan together if not already done. @@ -92,10 +92,10 @@ ax.xaxis.label.set_color("white") ``` -### Timeline Major Point: +### Timeline Major Point: -For conference submissions, all papers must be in final form 1 week prior to the deadline. -There will be no exceptions going forward. -This gives us needed time to reflect, refine writing, get some distance, and ask colleagues for feedback. -It also gives us time to prepare the code submission, and potentially arXiv the work -- which is always preferred. -We should not be submitting manuscripts to conferences we would not want publicly read! +For conference submissions, all papers must be in final form 1 week prior to the deadline. +There will be no exceptions going forward. +This gives us needed time to reflect, refine writing, get some distance, and ask colleagues for feedback. +It also gives us time to prepare the code submission, and potentially arXiv the work -- which is always preferred. +We should not be submitting manuscripts to conferences we would not want publicly read!