Library for interacting with the REDCap API.
The core library is under common/src/python/redcap_api. Additional internal tools that utilize it are under tools.
This repository uses pants for developing and building the distributions.
Install pants with one of the following. See Installing Pants for more information.
For Linux:
bash get-pants.shFor macOS:
brew install pantsbuild/tap/pantsYou will need to make sure that you have a Python version compatible with the interpreter set in the pants.toml file.
This project includes a dev container configuration for consistent development environments. See the scripts in bin/ for container management:
./bin/start-devcontainer.sh # Start the container
./bin/terminal.sh # Open interactive shell
./bin/stop-devcontainer.sh # Stop the containerAll Pants commands should be run inside the dev container using ./bin/exec-in-devcontainer.sh.
To format and lint with pants, run:
pants fmt :: # fixes formatting
pants lint :: # run linter
pants check :: # type checkingTo test with pants, run:
pants test :: # run all tests
pants test :: --test-force # ignore cache and force all tests to runTo package the main redcap_api distribution with pants, run:
pants package common::To package one of the internal tool distributions, run:
pants package tools/<name-of-tool>::
# for example
# pants package tools/redcap_error_checks_import::The above will build sdist and wheel distributions in the dist directory. Note most of the tools rely on the common distribution which will need to be installed first.
The version number on the distribution files is set in the
BUILDfile(s).
Releases are automated via GitHub Actions. Here's the complete workflow:
-
Develop on a feature branch:
git checkout -b feature/my-feature # Make your changes git add . git commit -m "Add new feature" git push origin feature/my-feature
-
Create a Pull Request:
- Open a PR from your feature branch to
main - GitHub Actions will automatically run linting and tests
- Wait for review and approval
- Open a PR from your feature branch to
-
Merge to main:
-
Merge the PR (squash, merge commit, or rebase - follow your team's convention)
-
Pull the latest main branch locally:
git checkout main git pull origin main
-
-
Create and push a release tag:
# Create an annotated tag with a descriptive message git tag -a v0.1.3 -m "Release v0.1.3: Add export_report method" # Push the specific tag to trigger the release workflow git push origin tag v0.1.3
-
GitHub Actions will automatically:
- Update version numbers in BUILD files to match the tag
- Run linting and type checking
- Run all tests
- Build distribution packages (wheels and sdists)
- Create a GitHub release with auto-generated release notes
- Upload all distribution files to the release
-
Verify the release:
- Check the release at:
https://github.com/naccdata/redcap-api/releases - Download and test the distribution files if needed
- Check the release at:
Follow Semantic Versioning:
v1.0.0- Major version (breaking changes)v0.1.0- Minor version (new features, backwards compatible)v0.0.1- Patch version (bug fixes)
Note: The workflow automatically updates the version in BUILD files during the release process. You don't need to manually update them before tagging.