Skip to content
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

Declare nmdc-schema as a Python dependency #297

Merged
merged 5 commits into from
Jan 31, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/test_pages_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
poetry run mkdocs build -d dist

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v3
with:
path: dist

Expand Down
30 changes: 8 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,14 @@ Note that the while this repo is named `submission-schema`, the generated artifa

### Updating the submission schema

Here's how you can update the submission schema to use a new version of `nmdc-schema`:

1. Update the one occurrence of the `nmdc-schema` version number in `project.Makefile`:

```diff
local/nmdc.yaml:
- wget -O $@ https://raw.githubusercontent.com/microbiomedata/nmdc-schema/v11.0.1/nmdc_schema/nmdc_materialized_patterns.yaml
+ wget -O $@ https://raw.githubusercontent.com/microbiomedata/nmdc-schema/v11.1.0/nmdc_schema/nmdc_materialized_patterns.yaml
```

2. Update all the `nmdc-schema` version numbers in `sheets_and_friends/tsv_in/import_slots_regardless.tsv`

```diff
- Biosample https://raw.githubusercontent.com/microbiomedata/nmdc-schema/v11.0.1/nmdc_schema/nmdc_materialized_patterns.yaml abs_air_humidity ...
+ Biosample https://raw.githubusercontent.com/microbiomedata/nmdc-schema/v11.1.0/nmdc_schema/nmdc_materialized_patterns.yaml abs_air_humidity ...
```
> That is one of the _many_ occurrences in that file.
>
> **Note:** The above search-and-replacement (of all occurrences in that file) can be done inside Vim via:
> ```vim
> :%s/nmdc-schema\/v11.0.1/nmdc-schema\/v11.1.0/g
> ```
The version of `nmdc-schema` used as a basis when building the submission schema is controlled by a dependency in the `dev` group, specified in `pyproject.toml`. You can update the version used by running:

```shell
poetry add nmdc-schema==X.Y.Z --group dev # replace X.Y.Z with the desired version
```

> [!NOTE]
> It is important to use the `==` version constraint to ensure the exact version is installed.

### Building the submission schema

Expand Down
622 changes: 51 additions & 571 deletions poetry.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions project.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ sheets_and_friends-clean:
rm -rf sheets_and_friends/yaml_out/with_shuttles.yaml

local/with_shuttles.yaml: src/nmdc_submission_schema/schema/nmdc_submission_schema_base.yaml \
sheets_and_friends/tsv_in/import_slots_regardless.tsv
sheets_and_friends/tsv_in/import_slots_regardless.tsv local/nmdc.yaml
$(RUN) do_shuttle \
--config_tsv $(word 2,$^) \
--recipient_model $(word 1,$^) \
Expand Down Expand Up @@ -148,8 +148,8 @@ local/with_shuttles_yq.yaml: local/with_shuttles.yaml
modifications-clean:
rm -rf sheets_and_friends/yaml_out/with_modifications.yaml

local/nmdc.yaml:
wget -O $@ https://raw.githubusercontent.com/microbiomedata/nmdc-schema/v11.3.0/nmdc_schema/nmdc_materialized_patterns.yaml
local/nmdc.yaml: poetry.lock
$(RUN) python src/nmdc_submission_schema/scripts/export_nmdc_schema.py -o $@

# sheets-for-nmdc-submission-schema_validation_converter_empty.tsv
local/with_modifications.yaml: local/with_shuttles_yq.yaml \
Expand Down
8 changes: 2 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,25 @@ include = [
{ path = "src/nmdc_submission_schema/project/**/*", format = ["sdist", "wheel"] }
]

# note that the nmdc-schema is not imported as a module,
# but one file from the nmdc-schema is accessed via sheets_and_friends/tsv_in/import_slots_regardless.tsv
# and project.Makefile
# look for strings like
# https://raw.githubusercontent.com/microbiomedata/nmdc-schema/v7.7.2/nmdc_schema/nmdc_materialized_patterns.yaml
[tool.poetry.dependencies]
python = "^3.9"
linkml-runtime = "^1.6.2"

[tool.poetry.group.dev.dependencies]
gsheets = "^0.6.1"
db-dtypes = "^1.3.1"
duckdb = "^1.1.3"
duckdb-engine = "^0.13.6"
exhaustion-check = "^0.1.3"
google-cloud-bigquery = "^3.27.0"
gsheets = "^0.6.1"
inflection = "^0.5.1"
jupyter = "^1.1.1"
jupyter-datatables = "^0.3.9"
linkml = "^1.7.10"
matplotlib = "^3.9.2"
mkdocs-material = "^9.1.2"
mkdocs-mermaid2-plugin = "^1.1.0"
nmdc-schema = "11.4.0rc1"
oaklib = "^0.6.1" # was using 0.5.6 up to 2024-12-10
pymongo = "^4.10.1"
pytest = "^8.3.4"
Expand Down
Loading