-
Notifications
You must be signed in to change notification settings - Fork 0
Set up uv-based package management #657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Add uv.lock for reproducible dependency resolution - Update requires-python to >=3.8 for PyGithub compatibility - Add SETUP.md with development environment instructions - Update README.md with link to setup guide - Add CI workflow for testing with uv across multiple platforms - Addresses issue #656
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces uv as the recommended package manager for MSML, modernizing the dependency management approach with faster installs and reproducible builds.
Changes:
- Updated minimum Python version requirement from 3.7 to 3.8 in pyproject.toml
- Created comprehensive SETUP.md guide with uv installation and usage instructions
- Added reference to SETUP.md in README.md for contributors
- Introduced CI workflow for testing package installation with uv across Python 3.8-3.12 and multiple platforms
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| pyproject.toml | Updates Python version requirement to >=3.8, aligning with modern Python support and uv compatibility |
| SETUP.md | New comprehensive development setup guide with uv installation, dependency management, and workflow instructions |
| README.md | Adds link to new SETUP.md for contributors seeking development setup guidance |
| .github/workflows/test.yml | New CI workflow for automated testing of package installation across multiple Python versions and operating systems |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| run: uv sync --frozen | ||
|
|
||
| - name: Verify installation | ||
| run: uv run python -c "import math_spec_mapping; print(math_spec_mapping.__version__)" |
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The verification step attempts to print math_spec_mapping.__version__, but the __init__.py file does not define a __version__ attribute. This will cause the workflow to fail. Either add a __version__ attribute to the package's __init__.py file, or change this verification to a simpler import check without accessing the version attribute.
| run: uv run python -c "import math_spec_mapping; print(math_spec_mapping.__version__)" | |
| run: uv run python -c "import math_spec_mapping" |
| @@ -0,0 +1,33 @@ | |||
| name: Test | |||
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workflow is named "Test" but only verifies that the package can be imported successfully. It doesn't run any actual test suite. Consider renaming this workflow to something more accurate like "Install and Verify" or "Build" to avoid confusion, or add actual test execution if test files exist or are planned.
| name: Test | |
| name: Install and Verify |
| run: uv python install ${{ matrix.python-version }} | ||
|
|
||
| - name: Install dependencies | ||
| run: uv sync --frozen |
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workflow installs Python with uv python install but doesn't explicitly configure uv to use that specific Python version for subsequent commands. Consider pinning the Python version by either: (1) using uv sync --python ${{ matrix.python-version }}, or (2) setting up the Python version using GitHub's actions/setup-python action before installing uv, which will ensure uv automatically detects and uses that Python version.
| run: uv sync --frozen | |
| run: uv sync --frozen --python ${{ matrix.python-version }} |
| # Add a development dependency | ||
| uv add --dev <package-name> |
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The flag --dev for adding development dependencies may not be the correct syntax for uv. As of recent uv versions, development dependencies are typically added using --group dev or by specifying them in [project.optional-dependencies] or [tool.uv.dev-dependencies] sections in pyproject.toml. Please verify the correct syntax for the version of uv being used.
| # Add a development dependency | |
| uv add --dev <package-name> | |
| # Add a development dependency (in the "dev" group) | |
| uv add --group dev <package-name> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot can you help solve
The failure is due to this line in src/math_spec_mapping/Load/type.py (ref: 187b270):
from typing import _UnionGenericAlias, List, _GenericAliasThe names _UnionGenericAlias and _GenericAlias are private members of the typing module and are not guaranteed to exist in all Python versions. In Python 3.8, these members areThe job failed due to ImportError: cannot import name '_UnionGenericAlias' from 'typing'. This occurs because _UnionGenericAlias and _GenericAlias are internal classes and are not part of the public API of the typing module. They are not guaranteed to exist across Python versions and their use is discouraged outside the standard library.
To fix this, replace any references to _UnionGenericAlias and _GenericAlias with public interfaces. For checking generic types like Union or List, you can use typing.get_origin and typing.get_args (available in Python 3.8+).
Update the relevant section in src/math_spec_mapping/Load/type.py (ref: 187b270) as follows:
from typing import List, get_origin
# Remove: from typing import _UnionGenericAlias, List, _GenericAlias
# In your logic where _UnionGenericAlias or _GenericAlias not directly importable, causing the ImportError.
To fix this:
1. Remove the import of _UnionGenericAlias and _GenericAlias from the import statement.
2. Use typing's public API to check for union and generic aliases. In Python 3.8+, the best practice is to use typing.get_origin and typing.get_args (Python 3.8+ with typing_extensions, otherwise Python 3.9+ natively).
Here's how you could change the logic:
```python
from are used:
if get_origin(data["type"]["python"]) is not None:
data["type_name"]["python"] = data["type"]["python"].__repr__()
else:
data["type_name"]["python"] = data["type"]["python"].__name__This change uses get_origin to check for generic types instead of relying on internal classes. This will resolve the ImportError and make the code forward-compatible with modern Python versions.
|
@rororowyourboat I've opened a new pull request, #661, to work on those changes. Once the pull request is ready, I'll request review from you. |
Closes #656
Summary
This PR introduces uv as the recommended package manager for MSML, providing fast and reproducible dependency management.
Changes
Benefits
Testing