From 7177302743e1672239a81cf5fbcf0d013868f2bc Mon Sep 17 00:00:00 2001 From: Patrick Kalita Date: Tue, 5 Mar 2024 09:16:07 -0800 Subject: [PATCH] Ensure that project artifacts are included in wheel distribution --- .github/workflows/pypi-publish.yaml | 1 + .gitignore | 5 +++++ pyproject.toml | 7 ++++++- src/nmdc_submission_schema/__init__.py | 0 4 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 src/nmdc_submission_schema/__init__.py diff --git a/.github/workflows/pypi-publish.yaml b/.github/workflows/pypi-publish.yaml index ba3904fc..0d4c1905 100644 --- a/.github/workflows/pypi-publish.yaml +++ b/.github/workflows/pypi-publish.yaml @@ -40,6 +40,7 @@ jobs: poetry dynamic-versioning make gen-project make project/json/nmdc_submission_schema.json + cp -r project src/nmdc_submission_schema - name: Build source and wheel archives run: poetry build diff --git a/.gitignore b/.gitignore index 7441594d..67b97c07 100644 --- a/.gitignore +++ b/.gitignore @@ -139,3 +139,8 @@ dmypy.json .pyre/ /examples/output + +# A copy of the project directory is moved here +# temporarily before `poetry build`. This is to +# make sure we don't commit the copy. +src/nmdc_submission_schema/project diff --git a/pyproject.toml b/pyproject.toml index 90342d52..1184201b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,12 @@ description = "The home of the NMDC submission schema. *Not* the home of sheets_ authors = ["Mark Andrew Miller "] license = "MIT" readme = "README.md" -include = ["README.md", "src/nmdc_submission_schema/schema", "project"] +include = [ + # These files are copied from the top-level project folder at build time. Without + # the copy step they end up in a weird location when installed via wheel. + # See: https://github.com/python-poetry/poetry/issues/7153 + { 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 diff --git a/src/nmdc_submission_schema/__init__.py b/src/nmdc_submission_schema/__init__.py new file mode 100644 index 00000000..e69de29b