Skip to content

Commit

Permalink
Merge pull request #2328 from microbiomedata/fix-project-dependencies
Browse files Browse the repository at this point in the history
Ensure dependencies are correctly classified
  • Loading branch information
pkalita-lbl authored Jan 28, 2025
2 parents c7f3e32 + 84a595e commit 9c66367
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
uses: snok/[email protected]

- name: Install dependencies.
run: poetry install -E docs
run: poetry install

# Replace the `0.0.0` placeholder `version` number in various files (per the config in `pyproject.toml`).
# Reference: https://github.com/mtkennerly/poetry-dynamic-versioning/blob/master/README.md#command-line-mode
Expand Down
25 changes: 9 additions & 16 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Built from:
# https://docs.github.com/en/actions/guides/building-and-testing-python
# https://github.com/snok/install-poetry#workflows-and-tips

name: Build and test nmdc-schema

Expand All @@ -20,34 +19,28 @@ jobs:
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install Poetry
run: pipx install poetry

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

#----------------------------------------------
# install & configure poetry
#----------------------------------------------
- name: Install Poetry
uses: snok/[email protected]
cache: 'poetry'

#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
run: poetry install --no-interaction --no-root
run: poetry install

#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install library
run: poetry install --no-interaction
- name: Check project dependencies
run: make check-dependencies

#----------------------------------------------
# run test suite
#----------------------------------------------
- name: Run tests
run: make squeaky-clean all test

2 changes: 1 addition & 1 deletion .github/workflows/test_pages_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
version: 1.3.2

- name: Install dependencies
run: poetry install -E docs
run: poetry install

# Replace the `0.0.0` placeholder `version` number in various files (per the config in `pyproject.toml`).
# Reference: https://github.com/mtkennerly/poetry-dynamic-versioning/blob/master/README.md#command-line-mode
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ test-python:
lint:
$(RUN) linkml-lint $(SOURCE_SCHEMA_PATH) > local/lint.log

.PHONY: check-dependencies
check-dependencies:
$(RUN) deptry nmdc_schema --known-first-party nmdc_schema

check-config:
@(grep my-datamodel about.yaml > /dev/null && printf "\n**Project not configured**:\n\n - Remember to edit 'about.yaml'\n\n" || exit 0)

Expand Down
6 changes: 4 additions & 2 deletions nmdc_schema/nmdc_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
# -*- coding: utf-8 -*-
"""Provides CLI to return versions of the NMDC Schema, meta model and pypi package."""

import pkg_resources, click
from importlib import metadata

import click
from .nmdc_data import get_nmdc_schema_definition


Expand All @@ -15,7 +17,7 @@ def get_nmdc_schema_package_version() -> str:
str
The version of the nmdc_schema package.
"""
return pkg_resources.get_distribution("nmdc_schema").version
return metadata.version("nmdc_schema")


def get_nmdc_schema_version() -> str:
Expand Down
67 changes: 60 additions & 7 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 17 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,35 +32,42 @@ packages = [

[tool.poetry.dependencies] # having trouble with mkdocs in docker esp on linux. addits its ecosystem here may be unnecessary
python = "^3.9"
click = "^8"
click-log = "^0.4.0"
curies = "^0.9.0"
deprecated = "^1"
jsonasobj2 = "^1"
jsonschema = "^4"
linkml = "^1.7.10"
linkml-runtime = "^1.7.7"
mkdocs = "^1.4.2"
mkdocs-material = "^9.0.12"
mkdocs-mermaid2-plugin = "^0.6.0"
mkdocs-redirects = "^1.2.1"
pymongo = "^4.7.2"
ruamel-yaml = "^0.18.6"
python-dotenv = "*"
pyyaml = "^6"
rdflib = "^6.2.0" # some LinkML components are not compatible with rdflib 7+ yet
requests = "^2"

[tool.poetry.group.dev.dependencies] # are some of these actually required as non-dev dependencies? # cruft for cookiecutter update could be installed with pipx?
autopep8 = "^2.2.0"
bandit = "^1.7.8"
black = ">=23.1,<25.0"
click = "^8.1.3"
click-log = "^0.4.0"
exhaustion-check = "^0.1.1" # for exhaustion-check, pretty-sort-yaml (also get-first-of-first)
fastjsonschema = "^2.20.0"
flake8 = "^7.0.0"
isort = "^5.13.2"
mkdocs = "^1.4.2"
mkdocs-material = "^9.0.12"
mkdocs-mermaid2-plugin = "^0.6.0"
mkdocs-redirects = "^1.2.1"
mypy = "^1.10.0"
pydocstyle = "^6.3.0"
pylint = "^3.2.2"
pyroma = "^4.2"
python-dotenv = "^0.21.0"
rdflib = "^6.2.0" # some LinkML components are not compatible with rdflib 7+ yet
# We use `refscan` to generate diagrams of inter-collection relationships.
# Reference: https://github.com/microbiomedata/refscan
refscan = "^0.2.0"
ruff = "^0.4.7"
ruamel-yaml = "^0.18.6"
schemasheets = "^0.1.24" # was in main dependencies but brings in so much like pandas
sheets_and_friends = "^0.5.0" # for do_shuttle (and possibly more)
sparql-burger = "^1.0.2"
Expand All @@ -71,6 +78,8 @@ vulture = "^2.11"
#oaklib = "^0.5.24"
#pydantic = "^1.10.13"

[tool.poetry.group.deps.dependencies]
deptry = "^0.23.0"

[tool.poetry-dynamic-versioning]
# We need poetry-dynamic-versioning to update the version in the src schema file,
Expand All @@ -94,9 +103,6 @@ patterns = [
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning"]
build-backend = "poetry_dynamic_versioning.backend"

[tool.poetry.extras]
docs = ["mkdocs-material"]


# scripts should have click clis
# click parameters/options should be written out with hyphens
Expand Down

0 comments on commit 9c66367

Please sign in to comment.