Skip to content
This repository has been archived by the owner on Jan 7, 2025. It is now read-only.

Fix PyPI publishing by modernizing package configuration #597

Closed
wants to merge 5 commits into from

Conversation

mentatai[bot]
Copy link
Contributor

@mentatai mentatai bot commented Jan 7, 2025

This commit updates our package configuration to use modern Python packaging tools:

  • Moves build configuration to pyproject.toml using hatchling as the build backend
  • Updates metadata version to properly handle license-file
  • Converts setup.py to a custom build hook for dynamic dependency handling
  • Maintains existing functionality while using modern packaging standards

Fixes #596

🤖 See my steps and track the cost of the PR here

This commit updates our package configuration to use modern Python packaging tools:
- Moves build configuration to pyproject.toml using hatchling as the build backend
- Updates metadata version to properly handle license-file
- Converts setup.py to a custom build hook for dynamic dependency handling
- Maintains existing functionality while using modern packaging standards

Fixes #596
@mentatai mentatai bot requested a review from biobootloader January 7, 2025 22:45
@mentatai mentatai bot mentioned this pull request Jan 7, 2025
@biobootloader
Copy link
Member

Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/Users/biobootloader/Library/Application Support/hatch/env/virtual/mentat/XLQuPxx5/mentat-build/lib/python3.12/site-packages/hatchling/main.py", line 6, in
sys.exit(hatchling())
^^^^^^^^^^^
File "/Users/biobootloader/Library/Application Support/hatch/env/virtual/mentat/XLQuPxx5/mentat-build/lib/python3.12/site-packages/hatchling/cli/init.py", line 26, in hatchling
command(**kwargs)
File "/Users/biobootloader/Library/Application Support/hatch/env/virtual/mentat/XLQuPxx5/mentat-build/lib/python3.12/site-packages/hatchling/cli/build/init.py", line 82, in build_impl
for artifact in builder.build(
File "/Users/biobootloader/Library/Application Support/hatch/env/virtual/mentat/XLQuPxx5/mentat-build/lib/python3.12/site-packages/hatchling/builders/plugin/interface.py", line 90, in build
self.metadata.validate_fields()
File "/Users/biobootloader/Library/Application Support/hatch/env/virtual/mentat/XLQuPxx5/mentat-build/lib/python3.12/site-packages/hatchling/metadata/core.py", line 265, in validate_fields
_ = self.version
^^^^^^^^^^^^
File "/Users/biobootloader/Library/Application Support/hatch/env/virtual/mentat/XLQuPxx5/mentat-build/lib/python3.12/site-packages/hatchling/metadata/core.py", line 149, in version
self._version = self._get_version()
^^^^^^^^^^^^^^^^^^^
File "/Users/biobootloader/Library/Application Support/hatch/env/virtual/mentat/XLQuPxx5/mentat-build/lib/python3.12/site-packages/hatchling/metadata/core.py", line 248, in _get_version
version = self.hatch.version.cached
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/biobootloader/Library/Application Support/hatch/env/virtual/mentat/XLQuPxx5/mentat-build/lib/python3.12/site-packages/hatchling/metadata/core.py", line 1456, in cached
raise type(e)(message) from None
ValueError: Error getting the version from source regex: unable to parse the version from the file: mentat/VERSION

mentatai bot added 4 commits January 7, 2025 22:47
Updated the hatch version configuration to use 'raw' source type instead of the default 'regex' source type. This should fix the error when trying to read the version from mentat/VERSION.
- Updated version configuration in pyproject.toml to properly handle VERSION file
- Fixed formatting in multiple files using ruff
- Reformatted files:
  - benchmarks/swe_bench_runner.py
  - mentat/llm_api_handler.py
  - setup.py
- Updated version configuration in pyproject.toml to use 'file' source type
- Ensured VERSION file has no trailing newlines
- Simplified version reading configuration
Changed version source type to 'plain-text' which is a simpler and more reliable way to read the version from a file. This should fix the version reading error during package build.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

issue publishing to pypi
1 participant