-
Notifications
You must be signed in to change notification settings - Fork 0
docs: update software style based on WG agreement #90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
338255a
f42026b
0939e9d
cb7e6d3
9d13d56
5a12d3d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,23 +2,54 @@ | |
|
|
||
| ## Core principles | ||
|
|
||
| All of the teams in Scientific Computing adhere to a set of core principles about our software. | ||
| Scientists and engineers are expected to adhere to a set of core principles about our software. | ||
|
|
||
| ### Code Review | ||
| ### Style | ||
|
|
||
| At least one other software developer needs to approve a pull request in order for it to be merged. Please be courteous when providing feedback. The team lead can resolve any conflicts. | ||
| These standards are maintained by the [aind-library-template](https://github.com/AllenNeuralDynamics/aind-library-template). Use the template when creating new packages. Our maintained templates are: | ||
|
|
||
| ### Style | ||
| | Template | URL | | ||
| | --- | --- | | ||
| | Python package | https://github.com/AllenNeuralDynamics/aind-library-template | | ||
| | Code Ocean capsule | ... | | ||
| | Code Ocean pipeline | ... | | ||
| | Analysis capsule | ... | | ||
|
|
||
| The decision to deviate from these style standards must be made in consultation with an entire team and be manager-approved. Deviations must be implemented by modifying the `pyproject.toml`. | ||
|
|
||
| #### Standard | ||
|
|
||
| Package management should be handled by [uv](https://docs.astral.sh/uv/). | ||
|
|
||
| We use `black`, `flake8`, and `interrogate` to enforce [PEP 8](https://peps.python.org/pep-0008/) standards with [docstrings](https://peps.python.org/pep-0257/) in [NUMPY](https://numpydoc.readthedocs.io/en/latest/format.html) format. | ||
| We use [ruff](https://docs.astral.sh/ruff/) to enforce [PEP 8](https://peps.python.org/pep-0008/) standards with [docstrings](https://peps.python.org/pep-0257/) in [NUMPY](https://numpydoc.readthedocs.io/en/latest/format.html) format. Use `ruff check` and `ruff check --fix`. Line lengths should have a maximum of **100** characters. | ||
|
dbirman marked this conversation as resolved.
Outdated
|
||
|
|
||
| ### Versioning | ||
| Releases should follow [semantic versioning](https://semver.org/) with `major.minor.patch` versions. Only external-facing packages should be published to [pypi](https://pypi.org/), internal packages should be installed from github releases. Use the following prefixes to trigger version updates automatically after merges to main: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ... via automated github action <link to .github workflow for semantic version bump>
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like we don't have a standardized bump template yet https://github.com/AllenNeuralDynamics/.github/tree/main/workflow-templates, maybe that's something we can add to the action items coming out of this group?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's here: https://github.com/AllenNeuralDynamics/.github/tree/main/.github/workflows I think the other folder is legacy?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Double-checking that this is now outdated?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added the correct link, should be visible in the PR now |
||
|
|
||
| We use [semver](https://semver.org/) major.minor.patch versions, these are automatically incremented when you use the `aind-library-template`. Note that for major versions you need to put the exact string "BREAKING CHANGE" in the commit *comment* (not the title). | ||
| | Prefix | Commit message | Update | | ||
| | `<any>:` | | patch | | ||
| | `feat:` | | minor | | ||
| | `feat!:` or `fix!:` | Include `BREAKING CHANGE` and details | major | | ||
|
|
||
| You should set patch version floor `>=1.0.0` and major version ceiling `<2` for each internal dependency that you use. This is good practice for all dependencies. | ||
| Unit tests should use [pytest](https://docs.pytest.org/en/stable/). Coverage should be at 100%. Tests should be run before merging pull requests into `main` and `dev`. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where will we leave the comment of "teams can decide a specific percentage?". In one of the doc files or will this be informal? I prefer this to be written somwhere
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Handled by Dans addition of: The decision to deviate from these style standards must be made in consultation with an entire team and be manager-approved. Deviations must be implemented by modifying the pyproject.toml. on line 18 |
||
|
|
||
| Team descriptions live in [AIND scientific computing teams](../aind/teams.md). | ||
| GitHub automation should use the AIND [reusable workflows](https://github.com/AllenNeuralDynamics/.github/tree/main/.github/workflows). | ||
|
|
||
| #### Recommended | ||
|
|
||
| - Functions to be annotated with [type hints](https://peps.python.org/pep-0484/). | ||
| - Functions should not exceed a complexity of 10 paths (ruff default). | ||
| - Functions should [return early](https://medium.com/swlh/return-early-pattern-3d18a41bba8) / [fail fast](https://en.wikipedia.org/wiki/Fail-fast_system). | ||
| - Code should be capable of being analyzed by static analysis tools. | ||
| - Modules (<1000 lines), classes, and functions (<100 lines) should be manageable size. | ||
| - Internal packages should use the naming pattern `<modality>-<process>` wherever possible. | ||
| - Packages should not be prefixed with our namespace (i.e. do not put `aind-` as a prefix). | ||
| - Internal dependencies should be pinned `==1.0.0` or use *both* a version floor and ceiling `>=1.0.0,<2`. | ||
| - Unit tests should cleanup test files or write to temporary folders. Do not version auto-generated code or data in repositories. | ||
|
|
||
| ### Code Review | ||
|
|
||
| [TODO UPDATE] | ||
| At least one other software developer needs to approve a pull request in order for it to be merged. Please be courteous when providing feedback. The team lead can resolve any conflicts. | ||
|
|
||
| ## Resources for SWEs | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.