Skip to content

Fix typo#1287

Merged
RonnyPfannschmidt merged 252 commits into
pypa:mainfrom
DimitriPapadopoulos:typos
Mar 27, 2026
Merged

Fix typo#1287
RonnyPfannschmidt merged 252 commits into
pypa:mainfrom
DimitriPapadopoulos:typos

Conversation

@DimitriPapadopoulos
Copy link
Copy Markdown
Contributor

No description provided.

DimitriPapadopoulos and others added 30 commits October 12, 2025 12:39
Indeed setuptools will automatically pick up files with standard names,
including `LICEN[CS]E*`:
https://setuptools.pypa.io/en/latest/userguide/miscellaneous.html
- methods to setup the scm's
- move skipping to the helper methods
- unify construction
- Updated the main function signature to include an optional _given_pyproject_data parameter.
- Modified test cases to utilize injected PyProjectData instead of relying on file creation.
- Added helper functions to create PyProjectData for testing scenarios.
These compatibility wrappers were no longer in use and simply delegated
to wd.setup_git() and wd.setup_hg() respectively. Tests should use the
WorkDir methods directly for clearer, more maintainable code.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Replace manual git initialization and command configuration with the
cleaner setup_git() and configure_hg_commands() methods in the
repositories_hg_git fixture. This makes the fixture code more maintainable
and consistent with the WorkDir API.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Refactor tests to use the existing WorkDir.setup_git() method instead of
manually calling git init, git config, git add, and git commit commands.
This improves code consistency and maintainability.

Changes:
- test_regressions.py::test_case_mismatch_nested_dir_windows_git
  Uses WorkDir for git setup and file operations
- test_regressions.py::test_case_mismatch_force_assertion_failure
  Uses WorkDir for git setup and file operations
- test_git.py::test_git_no_commits_uses_fallback_version
  Uses setup_git() instead of manual git init/config commands

Benefits:
- Eliminates 12 manual git command calls
- Reduces code by 9 lines
- Improves consistency with existing test patterns
- Makes test intent clearer

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Replace string-based version assertions with property-based ones
to better distinguish between parsing (SCM extraction) and
formatting (version scheme application) tests.

Key changes:
- Add VersionExpectations TypedDict for type-safe property matching
- Add ScmVersion.matches() method to compare parsed properties
- Add WorkDir.expect_parse() helper for test assertions
- Add mismatches class for detailed error reporting
- Refactor tests to use expect_parse() for parsing validation
- Keep string assertions only for formatting/version scheme tests

This improves test clarity by making explicit what is being tested:
parsing correctness vs formatting behavior.

Note: The linter renamed MissMatches to mismatches following Python
conventions for factory-like classes used in boolean contexts.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
refactor testing infra around configruation and assertions
This is a major refactoring that extracts core VCS functionality into a
new vcs_versioning package, with setuptools_scm becoming an integration
layer on top of it.

## Phase 1: Package Structure Setup

- Updated vcs_versioning/pyproject.toml:
  - Added dependencies: packaging, typing-extensions, tomli
  - Defined entry points for version_scheme, local_scheme, parse_scm, parse_scm_fallback
  - Added vcs-versioning CLI command
  - Registered setuptools_scm.* entry point groups for backward compatibility

- Created directory structure:
  - vcs_versioning/_backends/ for private VCS backend modules

## Phase 2: Core Functionality Migration

### Moved Core APIs:
- _config.py → config.py (now public)
- version.py → _version_schemes.py (private, accessed via entry points)
- Created scm_version.py for ScmVersion class (public API)
- _version_cls.py → _version_cls.py (private)

### Moved VCS Backends (all private):
- git.py → _backends/_git.py
- hg.py → _backends/_hg.py
- hg_git.py → _backends/_hg_git.py
- scm_workdir.py → _backends/_scm_workdir.py

### Moved Core Utilities:
- discover.py → _discover.py (private)
- fallbacks.py → _fallbacks.py (private)
- _run_cmd.py, _node_utils.py, _modify_version.py
- _types.py, _entrypoints.py, _log.py
- _compat.py, _overrides.py, _requirement_cls.py
- integration.py → _integration.py
- _get_version_impl.py (core version logic)

### Moved CLI:
- _cli.py → _cli.py (private)
- __main__.py

### Split Pyproject Reading:
- Created _pyproject_reading.py with core logic
- Supports both [tool.vcs-versioning] and [tool.setuptools_scm]
- Setuptools-specific logic will stay in setuptools_scm

### Created Public API:
- vcs_versioning/__init__.py exports:
  - Configuration, ScmVersion
  - Version, NonNormalizedVersion
  - DEFAULT_VERSION_SCHEME, DEFAULT_LOCAL_SCHEME

## Import Updates

- Updated all imports in moved files to use new module structure
- Fixed circular import issues with TYPE_CHECKING guards
- Used canonical private name _git with lazy imports where needed
- Made dump_version optional (setuptools-specific functionality)

## Progress Tracking

- Created .wip/ directory with:
  - progress.md - phase completion checklist
  - api-mapping.md - old → new import path mapping
  - test-status.md - test suite migration status

## Next Steps

- Phase 3: Create backward compatibility layer
- Phase 4: Update public API (mostly done)
- Phase 5: Rebuild setuptools_scm as integration layer
- Phase 6: Migrate test suite

Note: Skipping pre-commit hooks as setuptools_scm module errors are
expected until Phase 5 when we create re-export stubs.
This commit completes Phase 5 and sets up the uv workspace so both packages
can be developed and tested together.

## Phase 5: setuptools_scm Re-export Layer

Created backward compatibility layer in setuptools_scm that re-exports
from vcs_versioning while maintaining the same public API.

### Re-export Stubs Created:

**Core Modules:**
- _types.py - Type definitions
- _log.py - Logging utilities
- _entrypoints.py - Entry point utilities
- _version_cls.py - Version classes (+ _version_as_tuple, _validate_version_cls)
- _config.py - Configuration
- _get_version_impl.py - Version getting logic (+ all helper functions)
- _run_cmd.py - Command execution utilities

**VCS Backends:**
- git.py - Git backend re-export
- hg.py - Mercurial backend re-export
- discover.py - Discovery utilities
- fallbacks.py - Fallback parsers
- integration.py - Integration utilities

**Version & Schemes:**
- version.py - ScmVersion and all version schemes

**CLI:**
- _cli.py - CLI wrapper

**Integration:**
- _integration/toml.py - TOML utilities
- _integration/pyproject_reading.py - Extended with setuptools-specific logic
  - Inherits from vcs_versioning's PyProjectData
  - Adds should_infer() method
  - Adds has_build_package_with_extra() for setuptools[simple] support

## vcs_versioning Fixes

- Removed scm_version.py module (circular import)
- ScmVersion stays in _version_schemes.py
- Fixed all imports from scm_version to use _version_schemes
- Updated __init__.py to export ScmVersion from _version_schemes
- Fixed _entrypoints.py to use _version_schemes.ScmVersion type hints
- Fixed _types.py to import _version_schemes instead of scm_version

## Workspace Setup

- Added uv workspace configuration with both packages
- Added vcs-versioning to build-system.requires
- Configured workspace sources for vcs-versioning dependency
- Fixed deprecated license configuration (license.file → license = "MIT")
- Removed deprecated license classifier

## Linting

- Added ruff noqa: F405 to re-export modules (star import warnings expected)
- All mypy errors resolved
- Pre-commit hooks pass

## Testing

- Workspace builds successfully with `uv sync`
- Both packages install correctly
- Tests are running (6/8 passing in test_better_root_errors.py)
- Minor test failures to be addressed in next phase

## Next Steps

- Fix remaining test failures
- Phase 6: Migrate test suite
- Update documentation
- Remove re-export stubs for private APIs (_compat, _overrides, _requirement_cls)
- Update tests to import private APIs directly from vcs_versioning
- Update mypy.ini to include both source paths and use Python 3.9
- Remove _VersionT from __all__ since it's a private type used only in tests

Tests now correctly import:
- vcs_versioning._compat instead of setuptools_scm._compat
- vcs_versioning._overrides instead of setuptools_scm._overrides
- vcs_versioning._requirement_cls instead of setuptools_scm._requirement_cls
- vcs_versioning._backends._git for git private APIs
- vcs_versioning._log for log private APIs
- vcs_versioning._version_cls._VersionT for type alias

This maintains the separation where setuptools_scm only re-exports
public APIs, while tests that need private APIs import from vcs_versioning
directly.
## vcs-versioning src Layout

- Moved vcs_versioning/ to src/vcs_versioning/ for consistency
- Updated pyproject.toml with hatch build configuration
- Updated mypy.ini with new src path

## Test Migration

Moved 79 passing VCS-agnostic tests to vcs-versioning:
- test_compat.py (4 tests) - Path normalization utilities
- test_internal_log_level.py (2 tests) - Logging configuration
- test_version.py (73 tests) - Version scheme implementations

Kept in setuptools_scm:
- test_overrides.py (18 tests) - Has environment-specific behavior
- All integration tests - Require setuptools

## Test Configuration

- Added pytest.ini_options to vcs-versioning/pyproject.toml
- Added conftest.py and __init__.py to vcs-versioning/testing
- Configured 'issue' marker for pytest

## Test Results

- vcs-versioning: 79/79 tests passing ✅
- setuptools_scm: 18/18 tests passing in test_overrides.py ✅
- Both packages build successfully with uv sync ✅

This separates the core VCS functionality tests from setuptools
integration tests, making vcs-versioning independently testable.
- Removed VCS-related entry points from setuptools_scm (parse_scm, parse_scm_fallback, local_scheme, version_scheme)
- Kept file_finders entry points in setuptools_scm (setuptools-specific)
- vcs-versioning now provides all VCS functionality entry points
- Fixed get_version() to pass force_write_version_files=False to avoid deprecation warning

## Entry Point Migration

**Removed from setuptools_scm:**
- setuptools_scm.parse_scm (git, hg)
- setuptools_scm.parse_scm_fallback (git_archival, hg_archival, PKG-INFO, pyproject.toml, setup.py)
- setuptools_scm.local_scheme (all schemes)
- setuptools_scm.version_scheme (all schemes)

**Kept in setuptools_scm:**
- setuptools_scm.files_command (git, hg) - setuptools-specific
- setuptools_scm.files_command_fallback (git_archival, hg_archival) - setuptools-specific

**Provided by vcs-versioning:**
- All VCS backend entry points
- All version and local scheme entry points
- CLI entry point (vcs-versioning command)

## Test Status

- 2/21 tests now passing in test_basic_api
- test_root_parameter_pass_by fails due to monkeypatch not affecting vcs_versioning internals
- This is expected behavior change from migration - tests that patch internal functions need updates
- Updated assert_root() to patch vcs_versioning._get_version_impl instead of setuptools_scm
- Added root parameter to get_version() to support positional arguments (issue pypa#669)
- Support PathLike in get_version() root parameter for type compatibility
- Updated test_basic_api.py to patch at the correct module level

Test improvements:
- test_root_parameter_pass_by now passes (was failing due to monkeypatch)
- 3/21 tests passing in test_basic_api
- test_parentdir_prefix now failing on output format (unrelated to refactoring)
Complete logging refactor with central registry and explicit configuration
at all entry points. See full details in commit message.
- Fixed parse_tag_regex handling to emit deprecation warning properly
- setuptools_scm.get_version now delegates to vcs_versioning.get_version
- Fixed import of strip_path_suffix in file_finders/git.py to use vcs_versioning
- Fixed test patches in test_git.py to patch _git module instead of re-exported git
- Re-export read_toml_content in pyproject_reading for test compatibility
- Add __main__.py shim in setuptools_scm importing from vcs_versioning._cli
- Implement warning when tool.setuptools.dynamic.version conflicts with setuptools-scm[simple]
- Add _check_setuptools_dynamic_version_conflict helper function
Instead of re-exporting functions just to satisfy mocks, fix the tests
to mock the correct module where the functions actually live.

- Updated test_read_pyproject_with_given_definition to patch vcs_versioning._toml.read_toml_content instead of setuptools_scm._integration.pyproject_reading.read_toml_content
- Removed unnecessary re-export of read_toml_content

All tests now passing: 329 passed, 10 skipped, 1 xfailed
✅ All 8 phases completed successfully:
- Phase 1-2: Package structure and code movement
- Phase 3: Backward compatibility layer
- Phase 4: Public API exports
- Phase 5: Integration layer rebuilt
- Phase 6: Test migration (408 tests passing)
- Phase 7: Progress tracking with commits
- Phase 8: CI/CD ready

Key achievements:
- Unified logging with separate root loggers
- 329 setuptools_scm tests + 79 vcs-versioning tests passing
- Full backward compatibility maintained
- Entry points properly distributed
- uv workspace configured
This commit creates a unified test infrastructure that can be used by both
vcs-versioning and setuptools-scm test suites.

Key changes:

1. Created vcs_versioning.test_api module:
   - Exports WorkDir, DebugMode, and test fixtures as a pytest plugin
   - Contains pytest hooks (pytest_configure, fixtures, etc.)
   - Can be imported via pytest_plugins = ['vcs_versioning.test_api']

2. Moved WorkDir class:
   - testing/wd_wrapper.py -> vcs-versioning/src/vcs_versioning/_test_utils.py
   - Updated imports to use vcs_versioning modules

3. Renamed test directory to avoid pytest conflict:
   - nextgen/vcs-versioning/testing/ -> testingB/
   - Added README explaining the pytest ImportPathMismatchError issue
   - pytest cannot distinguish between two 'testing/conftest.py' at different locations

4. Migrated backend tests to vcs-versioning:
   - testing/test_git.py -> testingB/test_git.py
   - testing/test_mercurial.py -> testingB/test_mercurial.py
   - testing/test_hg_git.py -> testingB/test_hg_git.py
   - Updated imports to use vcs_versioning backends conditionally

5. Updated all test imports:
   - setuptools_scm tests now use: from vcs_versioning.test_api import WorkDir
   - vcs-versioning tests use the same: from vcs_versioning.test_api import WorkDir
   - Removed all 'from testing.wd_wrapper import WorkDir' and 'from .wd_wrapper import WorkDir'

6. Simplified conftest files:
   - setuptools_scm/testing/conftest.py uses pytest_plugins
   - vcs-versioning/testingB/conftest.py uses pytest_plugins
   - Both delegate to vcs_versioning.test_api for common fixtures

Test results:
- All 408 tests pass across both packages
- Can run tests together: pytest -n12 testing/ nextgen/vcs-versioning/testingB/
- No pytest path conflicts or import errors
Using Self as the return type for classmethod PyProjectData.for_testing allows
subclasses (like setuptools_scm's extended PyProjectData) to have the correct
return type without needing overrides or type ignore comments.

Changes:
- Added Self import to vcs_versioning._pyproject_reading
- Changed return type from PyProjectData to Self for for_testing and empty methods
- Removed now-unnecessary type: ignore comments in setuptools.py and test_cli.py

This fixes all remaining mypy errors related to PyProjectData type compatibility.
The griffe API check was failing due to pip install issues. This commit updates
the workflow to use uv for dependency management, which is already used in the
main test workflow.

Changes:
- Added astral-sh/setup-uv@v6 action to install uv
- Replaced 'pip install' commands with 'uv sync --group test' and 'uv pip install griffe'
- Updated griffe command to use 'uv run griffe' for proper environment execution

This ensures consistent dependency resolution and fixes the installation failures.
Migrates the Read the Docs build from pip to uv for faster and more reliable
dependency installation. This follows the official Read the Docs documentation
for uv integration.

Changes:
- Added pre_create_environment step to install uv via asdf
- Added create_environment step to create venv with uv
- Replaced pip install commands with 'uv sync --frozen --group docs'
- Set UV_PROJECT_ENVIRONMENT to use Read the Docs virtualenv path

Benefits:
- Faster dependency resolution and installation
- Better workspace support (handles vcs-versioning dependency correctly)
- Respects uv.lock for reproducible builds with --frozen flag
- Consistent with local development and CI workflows

Reference: https://docs.readthedocs.com/platform/stable/build-customization.html#install-dependencies-with-uv
This merges the PEP 639 compliance changes from PR pypa#1166:
- Updates license format from 'license.file' to 'license = "MIT"'
- Bumps setuptools requirement to >=77.0.3 for PEP 639 support
- Removes 'License :: OSI Approved :: MIT License' classifier (redundant with new license field)
- License file auto-detection relies on setuptools defaults

Co-authored-by: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com>
RonnyPfannschmidt and others added 28 commits March 27, 2026 12:09
- Use valid TOML inline-table syntax in SETUPTOOLS_SCM_OVERRIDES example
- Clarify local_scheme chaining: non-None stops; None defers; empty string counts
- Document fail-on-uncommitted-changes as returning None when clean; link DirtyWorkingTreeError
- Add mkdocstrings block for DirtyWorkingTreeError so cross-refs resolve

Co-authored-by: Cursor AI <ai@cursor.sh>
Co-authored-by: Composer <composer@cursor.com>
Filter out blobs when we unshallow a Git repo
…n-uncommitted-local-scheme

feat(vcs-versioning): fail-on-uncommitted-changes local scheme (fixes pypa#1205)
When HEAD matches a tag (git describe --exact-match), shallow clones
are enough for version inference. warn_on_shallow, fail_on_shallow,
and fetch_on_shallow are skipped in that case.

Closes pypa#1241

Co-authored-by: Cursor AI <ai@cursor.sh>
Co-authored-by: Composer <composer@cursor.com>
…low-exact-tag

feat(git): skip shallow pre-parse when HEAD is on exact tag
Build vcs-versioning with setuptools instead of hatchling to avoid the
bootstrap cycle (hatchling → pluggy → setuptools-scm → vcs-versioning)
reported in pypa#1302.

Use setuptools.build_meta for setuptools-scm and drop the custom
build_meta wrapper; supply dynamic versions from each package setup.py
with logic inlined and guarded by if __name__ == "__main__".

Exclude package setup.py from mypy (duplicate module name) and from the
mypy pre-commit hook.

Co-authored-by: Cursor AI <ai@cursor.sh>
Co-authored-by: Composer <composer@cursor.com>
Pass relative_to and fallback_root so SCM fallbacks do not resolve
against the process cwd (e.g. workspace root in CI).

Co-authored-by: Cursor AI <ai@cursor.sh>
Co-authored-by: Composer <composer@cursor.com>
Use root=".." and fallback_root="." (anchored with relative_to
pyproject.toml) for SCM vs sdist metadata. Add resolved_fallback_root()
so setuptools_scm.parse_scm_fallback finds PKG-INFO under the package
tree; vcs-versioning setup.py routes parse_pkginfo through the same path.

Co-authored-by: Cursor AI <ai@cursor.sh>
Co-authored-by: Composer <composer@cursor.sh>
Include vcs_versioning._cli git archival templates and setuptools_scm
.git_archival.txt in wheels via tool.setuptools.package-data.

Co-authored-by: Cursor AI <ai@cursor.sh>
Co-authored-by: Composer <composer@cursor.sh>
…ools-build-bootstrap

build: setuptools + setup.py for vcs-versioning and setuptools-scm (pypa#1302)
Release: setuptools-scm v10.0.4, vcs-versioning v1.1.0
- vcs-versioning: promote Development Status from Planning to Beta
- Add Python 3.14 classifier to both setuptools-scm and vcs-versioning

Co-authored-by: Cursor AI <ai@cursor.sh>
Co-authored-by: Anthropic Claude Opus <claude@anthropic.com>
fix: Use missing-argument sentinel for dump_version argument
…s-python-3.14

build: update trove classifiers and add Python 3.14 support
pypa#1330)

The `[tool.uv.sources]` section with `vcs-versioning = { workspace = true }`
was baked into the sdist. When users installed setuptools-scm from PyPI via uv,
it failed with "references a workspace but is not a workspace member" because
no workspace context exists outside the monorepo.

The workspace root pyproject.toml already declares the same source mapping,
which is sufficient for development-time resolution across all members.

Co-authored-by: Cursor AI <ai@cursor.sh>
Co-authored-by: Anthropic Claude <claude@anthropic.com>
…orkspace-source-from-member

fix: remove workspace source override from setuptools-scm member (fixes pypa#1330)
Release: setuptools-scm v10.0.5
Bumps the github-actions group with 1 update: [hynek/build-and-inspect-python-package](https://github.com/hynek/build-and-inspect-python-package).


Updates `hynek/build-and-inspect-python-package` from 2.15.0 to 2.17.0
- [Release notes](https://github.com/hynek/build-and-inspect-python-package/releases)
- [Changelog](https://github.com/hynek/build-and-inspect-python-package/blob/main/CHANGELOG.md)
- [Commits](hynek/build-and-inspect-python-package@f3d069d...fe0a0fb)

---
updated-dependencies:
- dependency-name: hynek/build-and-inspect-python-package
  dependency-version: 2.17.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
…ub-actions-1ea44fa805

build(deps): bump hynek/build-and-inspect-python-package from 2.15.0 to 2.17.0 in the github-actions group
Bumps [cryptography](https://github.com/pyca/cryptography) from 46.0.5 to 46.0.6.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](pyca/cryptography@46.0.5...46.0.6)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-version: 46.0.6
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
vcs-versioning builds with plain setuptools (not setuptools-scm) to
avoid the bootstrap cycle (pypa#1302), so no file finder is registered
during its build. Without a MANIFEST.in, setuptools only includes
packages under src/, omitting testing_vcs/ from the sdist entirely.

Fixes pypa#1336

Co-authored-by: Cursor AI <ai@cursor.sh>
Co-authored-by: Anthropic Claude <claude@anthropic.com>
…ioning-sdist-manifest

fix: add MANIFEST.in to vcs-versioning for correct sdist content
build(deps): bump cryptography from 46.0.5 to 46.0.6
Release: vcs-versioning v1.1.1
@RonnyPfannschmidt RonnyPfannschmidt merged commit 3d8b8bf into pypa:main Mar 27, 2026
22 checks passed
@DimitriPapadopoulos DimitriPapadopoulos deleted the typos branch March 30, 2026 07:00
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.

4 participants