Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .codespell-ignore.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
requestor
NAMD
preformed
identifying
intrisic
specificy
transferrin
trough
Rouge
identifiying
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ repos:
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]

- repo: https://github.com/codespell-project/codespell
rev: v2.4.2
hooks:
- id: codespell
additional_dependencies:
- tomli
exclude: ^src/kf_access_model/schema/upstream-models/.*\.yaml$

- repo: https://github.com/crate-ci/typos
rev: v1.31.1
hooks:
Expand Down
107 changes: 41 additions & 66 deletions COLLABORATORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,16 @@ properties, those models should adhere to use this model as a Git submodule.

## Key Integration Guidelines

All changes to this model should be made with the understanding that those
changes are completely valid for all or many of the downstream models. Those
changes should be made directly within this repository and not as changes to the
versions from the submodules themselves.

Please see the following notes when integrating this model as a submodule within
one of the downtream modules:

- Do Not Modify the Submodule from within this repository: All foundational
classes, slots, and enums live in the core submodule. Any program-specific
customizations must happen strictly in your downstream files.
- Leverage Imports: At this time, the current model imports the
common_access_model.yaml directly within the main model definition.
The classes and slots defined herein are shared across all downstream models. As
such, changes required to satisfy a downstream model's requirements should be
contained solely within the downstream model itself, or updated here with the
understanding that those changes will make their way to all of the other
downstream models in time.

Downstream model development guidance:

- Leverage Imports: At this time, the downstream model imports the
common_access_model-{version}.yaml directly within the main model definition.
- Extend via Inheritance: Use the is_a or mixins keys to create program-specific
subclasses that inherit core slots while allowing you to add local attributes.
- Refine via Slot Usage: If you need to restrict or change the behavior of an
Expand All @@ -27,64 +24,37 @@ one of the downtream modules:

## Getting Started

If you aren't already familiar with working with submodules, there are just a
couple of key takeaways to keep in mind:

- The submodule has been pinned to a specific git commit hash to avoid
unexpected changes the CAM creeping into downstream model interfering with
local builds, CI/CD scripts, etc.
- The submodule itself should only be updated by deliberate action with the
expectation that downstream model changes may be required to reflect incoming
updates.
When you initialized your working environment using 'just install', a pre-commit
hook should have been installed for you that will apply various style fixes
before each commit. In general, only the files being committed are tested.

### Initializing the submodule

Before you can actually compile the model on a new machine, you'll need to pull
the submodule's content down. A convenient just recipe has been created for
exactly that:
For those whose local copies of the model predate this change, you may simply
run the following just recipe to hook the pre-commit runs into your local clone.
Please note that this must be run again if you ever pull the code down into a
new directory.

```bash
just init-submodule
just precommit
```

or, if you prefer to do it directly yourself:

```bash
git submodule update --init --recursive
# make sure nothing is broken
just lint && just test
```

Subsequent calls can drop the init if you know for a fact that no other
submodules have been added. The just recipe does call the linter and runs the
linkml test as a subsequent dependency, in case there are upstream changes that
invalidate the downstream model.

### Updating the pinned hash
### Updating (and initializing) the Common Access Model

Once it has been decided that it is time to update the CAM to use the latest
version, the maintainer should run the following commands to fetch, test and
lock the new version into the downstream model's main.
To incorporate the Common Access Model into a downstream model, either for the
first time or to update to a newer version, a just recipe has been provided:

```bash
# Navigate into the submodule directory
cd src/kf_access_model/schema/common_access_model

# Fetch and check out the desired remote target (e.g., main branch)
git fetch origin
git checkout origin/main

# Move back to the repository root
cd -

# Run linter and tests
just lint && just test
just update-cam
```

This will download the latest version of the common access model to
src/{model_name}/upstream-models/. The resulting file will be a complete
monolithic copy of the common access model with the version as part of the name.
It is up to the user to update the downstream model to include the updated CAM
model file.

# Commit the new submodule hash pointer to this repository
git add src/kf_access_model/schema/common_access_model
git commit -m "chore: update common_access_model submodule to latest hash"
```
This file is tracked in github, so once the newest version is correctly checked
in, other contributors will pick up the correct version directly from their git
pulls.

## Release Artifacts

Expand Down Expand Up @@ -154,18 +124,23 @@ any manual intervention:
uv run pre-commit run --all-files
```


## Commands to Expand Enum Files

### To write the expanded output:

`just expand`

This has also been added as a dependency to the recipes _test-schema and lint, and will automatically be run with `just test` and `just lint`.
This has also been added as a dependency to the recipes _test-schema and lint,
and will automatically be run with `just test` and `just lint`.

#### Regenerate expanded output
Enums that already have a `permissible_values` will not be expanded.
To rerun the expansion script on a file, delete the current `permissible_values` from the YAML file, then run `just expand`, `just _test`, or `just lint`.

The `permissible_values` for any given enum can be deleted manually or by running the following command for each file:
Enums that already have a `permissible_values` will not be expanded. To rerun
the expansion script on a file, delete the current `permissible_values` from the
YAML file, then run `just expand`, `just _test`, or `just lint`.

The `permissible_values` for any given enum can be deleted manually or by
running the following command for each file:

`just clear {file_name}`

Expand Down
9 changes: 9 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# These were caught as typos
[default.extend-words]
NAMD = "NAMD"
BA = "BA"

# Real typos that are encountered from other sources
# (currently one from OBI, specify) and an unrecognized acronym, NAMD
[default.extend-identifiers]
specificy = "specificy"
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ _setup_part2: gen-project gen-doc

# Install project dependencies
[group('project management')]
install:
install: precommit
uv sync --group dev

# Updates project template and LinkML package
Expand Down
4 changes: 4 additions & 0 deletions project.justfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@ gen-dbtmodel:
[group('model development')]
gen-monolith:
uv run gen-monolith

[group('project management')]
precommit:
pre-commit install
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ skip = [
"src/common_access_model/datamodel/common_access_model_pydantic.py",
"src/common_access_model/datamodel/common_access_model.py",
]
ignore-words = ".codespell-ignore.txt"

# Reminder: words have to be lowercased for the ignore-words-list
ignore-words-list = "linke"
Expand Down
Loading
Loading