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

Add Taskfile to build package; Refactor docs tasks. #46

Merged
merged 6 commits into from
Mar 15, 2024

Conversation

kirkrodrigues
Copy link
Member

Description

This PR:

  • Adds a Taskfile to make it easier to build clp_ffi_py
  • Refactors the docs Taskfile so that it can be called from the main Taskfile.
  • Applies our latest guidelines for Taskfiles to the docs tasks.

NOTE: This PR requires task v3.35.1 for the latest bug fixes.

Validation performed

  • Validated building each artifact from a clean state:

    task clean && task
    task clean && task wheel
    task clean && task docs:site
  • Validated repeated builds of each artifact-generating task did not result in the artifact being regenerated:

    task clean && task wheel && task wheel
    task clean && task docs:site && task docs:site
  • Validated that after running task docs:site, changing any of the following files triggered a rebuild of just the docs:

    • docs/conf/conf.py
    • docs/src/index.md
    • docs/tasks.yml
  • Validated that after running task wheel, changing any of the following triggered a rebuild of the wheel:

    • clp_ffi_py/__init__.py
    • src/clp (the version of the clp submodule)
    • src/clp_ffi_py/error_messages.hpp
    • Taskfile.yml
  • Validated that after running task docs:site, changing any of the following files from the previous step triggered a rebuild of the wheel and the docs.

  • Validated task clean && task docs:serve built and served the site.

@kirkrodrigues
Copy link
Member Author

Workflow failures unrelated to the present PR. They'll be addressed in another PR.

Copy link
Member

@junhaoliao junhaoliao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems we do not checksum all build/dist artifacts. e.g.,

rm -f build/dist/*.tar.gz
task # does not trigger `wheel` rebuild

Just want to make sure whether that is intended as I understand the build/dist/*.whl file is the final packaged file. Approved assuming that is intended.

@junhaoliao
Copy link
Member

Title: ?

Add a main `Taskfile` to make it easier to build clp_ffi_py; Refactor the docs `Taskfile` to make it callable by the main Taskfile. (#46)

Copy link
Member

@junhaoliao junhaoliao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, hashing of the *.whl file does not seem correctly handled. I modified the magic number PK of build/dist/clp_ffi_py-0.0.10-cp310-cp310-linux_x86_64.whl and running the task command did not rebuild the task.

- "rm -rf '{{.OUTPUT_DIR}}'"
- |-
. "{{.WHEEL_VENV_DIR}}/bin/activate"
python3 -m build --outdir "{{.OUTPUT_DIR}}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
python3 -m build --outdir "{{.OUTPUT_DIR}}"
python3 -m build --outdir "{{.OUTPUT_DIR}}"
# Checksum the generated files (this command must be last)
- |-
cd "{{.OUTPUT_DIR}}"
tar cf - {{.CHECKSUM_TAR_BASE_ARGS}} . | md5sum > "{{.CHECKSUM_FILE}}"

Taskfile.yml Outdated
Comment on lines 39 to 40
generates:
- "{{.OUTPUT_DIR}}/*.whl"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
generates:
- "{{.OUTPUT_DIR}}/*.whl"
status:
- "test -f '{{.CHECKSUM_FILE}}'"
- >-
diff
<(cd '{{.OUTPUT_DIR}}' && tar cf - {{.CHECKSUM_TAR_BASE_ARGS}} . | md5sum)
"{{.CHECKSUM_FILE}}"

@kirkrodrigues
Copy link
Member Author

It seems we do not checksum all build/dist artifacts. e.g.,

I did intentionally leave out the .tar.gz, but that is probably not a good idea since the .tar.gz can be used to build the package from source. Added the .tar.gz.

In fact, hashing of the *.whl file does not seem correctly handled.

Huh, strange. I would've expected task to checksum the file properly by itself. Anyway, switched to the explicit md5 checksum.

@kirkrodrigues kirkrodrigues changed the title Taskfile Add Taskfile to build package; Refactor docs tasks. Mar 15, 2024
Copy link
Member

@junhaoliao junhaoliao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@junhaoliao junhaoliao merged commit 7019e7f into y-scope:main Mar 15, 2024
1 of 3 checks passed
@kirkrodrigues kirkrodrigues deleted the taskfile branch May 31, 2024 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants