Skip to content

Commit

Permalink
fix: include docs and examples in the sdist tarball
Browse files Browse the repository at this point in the history
The sdists generated by setuptools included the `docs` and `examples`
directories, and they are needed for building docs and running tests using the
sdist.

This change includes these directories in the sdist tarball.

A `test:sdist` task is also added to `Taskfile.yml` which uses the sdists to run
pytest and build docs.
  • Loading branch information
aucampia committed Mar 19, 2023
1 parent f3d31b0 commit 359c5d0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ tasks:
- task: venv:clean
- task: _rimraf
vars: { RIMRAF_TARGET: ".var/devcontainer" }
- task: _rimraf
vars: { RIMRAF_TARGET: "var/test-sdist" }

test:data:fetch:
desc: Fetch test data.
Expand Down Expand Up @@ -342,6 +344,21 @@ tasks:
> "${plantuml_file%.*}.svg"
done
test:sdist:
desc: Run tests on the sdist artifact
cmds:
- task: _rimraf
vars: { RIMRAF_TARGET: "dist" }
- task: _rimraf
vars: { RIMRAF_TARGET: "var/test-sdist" }
- poetry build
- python -c 'import tarfile, glob; tarfile.open(glob.glob("dist/*.tar.gz")[0]).extractall("var/test-sdist")'
- |
cd var/test-sdist/rdflib-*
poetry install
poetry run mypy --show-error-context --show-error-codes -p rdflib
poetry run sphinx-build -T -W -b html -d docs/_build/doctree docs docs/_build/html
poetry run pytest
_rimraf:
# This task is a utility task for recursively removing directories, it is
# similar to rm -rf but not identical and it should work wherever there is
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ packages = [
]
include = [
{ path = "test", format = "sdist" },
{ path = "docs", format = "sdist" },
{ path = "examples", format = "sdist" },
]

[tool.poetry.scripts]
Expand Down

0 comments on commit 359c5d0

Please sign in to comment.