Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 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
12 changes: 0 additions & 12 deletions .bumpversion.cfg

This file was deleted.

122 changes: 122 additions & 0 deletions .changeset/CHANGESET_TESTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# Testing the Changeset System

This document explains how to test the changeset system implementation.

## Quick Test

Run the automated test suite:
```bash
./test_changesets.py
# or
python3 test_changesets.py
```

This will:
1. Backup your current files
2. Test all components of the changeset system
3. Restore your files to their original state
4. Show a summary of test results

## Manual Testing

### 1. Create a Changeset

```bash
# Interactive mode
./changeset

# Or with parameters
python3 .changeset/scripts/changeset.py --type patch --message "Fixed a bug"
```

### 2. Test Version Bumping

```bash
# Dry run to see what would happen
python3 .changeset/scripts/version.py --dry-run

# Actually bump the version
python3 .changeset/scripts/version.py
```

### 3. Test Changelog Generation

```bash
# Dry run to preview changelog
python3 .changeset/scripts/changelog.py --dry-run

# Generate changelog
python3 .changeset/scripts/changelog.py
```

### 4. Test Pre-commit Hooks

```bash
# Validate changeset files
python3 .changeset/scripts/validate-changesets.py .changeset/*.md

# Check if changeset exists (will fail on main branch)
python3 .changeset/scripts/check-changeset.py
```

## GitHub Actions Testing

The GitHub Actions will trigger when:
1. **Push to main**: Creates/updates a "Version Packages" PR
2. **Merge version PR**: Publishes to PyPI and creates GitHub release

To test locally:
1. Create a feature branch
2. Make some changes
3. Create a changeset: `./changeset`
4. Commit and push
5. Open PR to main
6. When merged, the actions will run

## Expected Behavior

### Changeset Creation
- Creates a markdown file in `.changeset/` with a random name
- File contains package name, change type, and description
- Shows changed files compared to main branch

### Version Bumping
- Reads all changesets
- Determines version bump (major > minor > patch)
- Updates version in `pyproject.toml` and `__init__.py`
- Archives processed changesets
- Creates data file for changelog generation

### Changelog Generation
- Reads changeset data from version script
- Generates formatted changelog entry
- Updates CHANGELOG.md with new version section
- Groups changes by type (major/minor/patch)

### GitHub Actions
- `changesets.yml`: Runs on push to main
- `changeset-publish.yml`: Runs when version PR is merged
- Creates PR with version bumps and changelog updates
- Publishes to PyPI when PR is merged

## Troubleshooting

### "No changeset found" error
- Make sure you're not on main/master branch
- Create a changeset with `./changeset`
- Check `.changeset/` directory for `.md` files

### Version not bumping correctly
- Check `.changeset/config.json` is valid JSON
- Ensure changesets have correct format
- Look for error messages in script output

### Changelog not generating
- Make sure version script ran first
- Check for `.changeset/.changeset-data.json`
- Verify CHANGELOG.md exists or will be created

### Pre-commit hooks not working
- Install pre-commit: `pip install pre-commit`
- Set up hooks: `pre-commit install`
- Run manually: `pre-commit run --all-files`
64 changes: 64 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Changesets

This directory contains changeset files that track changes to the codebase. The changeset system is inspired by the JavaScript changesets tool but adapted for Python projects.

## How it works

1. **Creating a changeset**: When you make changes that should be included in the changelog, run:
```bash
python .changeset/scripts/changeset.py
# or use the wrapper script:
./changeset
```

This will prompt you to:
- Select the type of change (major, minor, or patch)
- Provide a description of the change

A markdown file will be created in this directory with a random name like `warm-chefs-sell.md`.

2. **Version bumping**: The GitHub Action will automatically:
- Detect changesets in PRs to main
- Create or update a "Version Packages" PR
- Bump the version based on the changesets
- Update the CHANGELOG.md

3. **Publishing**: When the "Version Packages" PR is merged:
- The package is automatically published to PyPI
- A GitHub release is created
- The changesets are archived

## Changeset format

Each changeset file looks like:
```markdown
---
"stagehand": patch
---

Fixed a bug in the browser automation logic
```

## Configuration

The changeset behavior is configured in `.changeset/config.json`:
- `baseBranch`: The branch to compare against (usually "main")
- `changeTypes`: Definitions for major, minor, and patch changes
- `package`: Package-specific configuration

## Best practices

1. Create a changeset for every user-facing change
2. Use clear, concise descriptions
3. Choose the appropriate change type:
- `patch`: Bug fixes and small improvements
- `minor`: New features that are backwards compatible
- `major`: Breaking changes

## Workflow

1. Make your code changes
2. Run `./changeset` to create a changeset
3. Commit both your code changes and the changeset file
4. Open a PR
5. The changeset will be processed when the PR is merged to main
26 changes: 26 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"baseBranch": "main",
"changelogFormat": "markdown",
"access": "public",
"commit": false,
"changeTypes": {
"major": {
"description": "Breaking changes",
"emoji": "💥"
},
"minor": {
"description": "New features",
"emoji": "✨"
},
"patch": {
"description": "Bug fixes",
"emoji": "🐛"
}
},
"package": {
"name": "stagehand",
"versionPath": "stagehand/__init__.py",
"versionPattern": "__version__ = \"(.*)\"",
"pyprojectPath": "pyproject.toml"
}
}
5 changes: 5 additions & 0 deletions .changeset/hard-rivers-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"stagehand": patch
---

Test manual changeset creation
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

let's just start with an empty changelog

Loading