Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/sf_cli_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: SF CLI Integration Test

on:
pull_request:
workflow_dispatch:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This allows us to run this github action on main, manually in the github UI.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"Us" being any user with write access to the repo.


jobs:
sf-cli-integration:
Expand All @@ -21,11 +22,16 @@ jobs:
with:
python-version: '3.11'

- name: Install Poetry and Python SDK
- name: Install Poetry and build SDK wheel
run: |
python -m pip install --upgrade pip
pip install poetry
make develop
poetry build

- name: Install SDK wheel into Poetry venv
run: |
"$(poetry env info --path)/bin/pip" install dist/*.whl --force-reinstall --no-deps

- name: Add Poetry venv to PATH
run: echo "$(poetry env info --path)/bin" >> $GITHUB_PATH
Expand Down
37 changes: 28 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,43 @@ See the [Prerequisites section in README.md](./README.md#prerequisites) for comp
datacustomcode version
```

4. **Initialize a project for development work verification**
4. **Install the SF CLI and plugin**
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I realize this is getting ahead of the README itself, but I started adding the poetry build instructions (below) as a side effect and realized this really needs to be our main development path- not a side note.


**Note**: To test your changes and develop new features, initialize a sample project:
The SF CLI is how you test your SDK changes end-to-end (`init`, `scan`, `zip`, `run`, `deploy`).

```bash
# Install the Salesforce CLI (requires Node.js)
npm install -g @salesforce/cli

# Install the Data Cloud Code Extension plugin
sf plugins install @salesforce/plugin-data-code-extension
```

5. **Build and install your local SDK changes**

The SF CLI plugin resolves templates from the installed package path. After making changes, build a wheel and install it:

```bash
poetry build
$(poetry env info --path)/bin/pip install dist/*.whl --force-reinstall --no-deps
```

Re-run these two commands each time you make SDK changes you want to test via the SF CLI.

6. **Test your changes**

```bash
# Create a new directory for your test project
mkdir my-test-project
cd my-test-project

# Initialize a new Data Cloud custom code project
datacustomcode init .

# Test your SDK modifications against the sample project with:
datacustomcode run ./payload/entrypoint.py
# Initialize, scan, zip, run
sf data-code-extension script init --package-dir .
sf data-code-extension script scan --entrypoint payload/entrypoint.py
sf data-code-extension script zip --package-dir .
sf data-code-extension script run --entrypoint payload/entrypoint.py -o <your-org-alias>
```

**Tip**: See the [README.md](./README.md) for additional `datacustomcode` commands (`scan`, `deploy`, `zip`) to test specific code paths and validate your SDK changes thoroughly.

## Versioning and Pre-Releases

This project uses [PEP 440](https://peps.python.org/pep-0440/) version syntax. Versions are derived automatically from git tags via `poetry-dynamic-versioning`.
Expand Down
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ warn_unused_configs = true

[tool.poetry]
include = [
{path = "src/datacustomcode/templates/**/*", format = "sdist"},
{path = "src/datacustomcode/config.yaml", format = "sdist"}
{path = "src/datacustomcode/templates/**/*"},
{path = "src/datacustomcode/config.yaml"}
]
packages = [{include = "datacustomcode", from = "src"}]
version = "0.0.0"
Expand Down Expand Up @@ -133,7 +133,8 @@ datacustomcode = "datacustomcode.cli:cli"

[tool.poetry-dynamic-versioning]
enable = true
pattern = "^v(?P<base>.+)$"
format-jinja = "{% if distance == 0 %}{{ base }}{{ stage or '' }}{% else %}{{ bump_version(base) }}.dev{{ distance }}+{{ commit }}{% endif %}"
pattern = "^v(?P<base>\\d+\\.\\d+\\.\\d+)(?P<stage>\\.dev\\d+|a\\d+|b\\d+|rc\\d+)?$"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The problem we're solving here is when installing/running locally, if the base branch was .dev1, then .post... would be appended to it and that wouldn't match pep440. This makes it so, if you're already working on a tag (like locally), it just uses that instead of trying to add anything.

style = "pep440"
vcs = "git"

Expand Down
Loading