Skip to content

fixes #82: added setuptools_scm to fix the issue #84

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

prabhat-kumar96
Copy link

@prabhat-kumar96 prabhat-kumar96 commented Mar 23, 2025

Fixes #82 :

To resolve this issue, setuptools_scm is added to the test-optional dependencies in the pyproject.toml file. This ensures that setuptools_scm is installed when the test dependencies are installed, allowing the tests to run without errors.

Changes Made
The pyproject.toml file is updated to include setuptools_scm in the test-optional dependencies:

[project.optional-dependencies]
test = [
"setuptools_scm", # Added to resolve ModuleNotFoundError
"pytest",
# Other test dependencies
]

Why This Works
setuptools_scm: This package is used for version control and is required by the test environment to access specific files or functionality.

Test Dependencies: Adding setuptools_scm to the test-optional dependencies is automatically installed when running pip install -e ".[test]", ensuring that the test environment has all the necessary packages.

Steps to Verify
Install the project and test dependencies:
Commands: pip install -e .
pip install -e ".[test]"

Run the tests:
command: pytest

Confirm that the tests pass without any ModuleNotFoundError related to setuptools_scm.

Impact
Tests: Tests will now run successfully without requiring manual installation of setuptools_scm.

CI/CD: The CI/CD pipeline will also work correctly, as the test environment will have all the required dependencies.

Future Considerations
Ensure that all required dependencies are explicitly listed in pyproject.toml to avoid similar issues in the future.
Regularly update the dependencies to their latest compatible versions to maintain compatibility and security.

This solution ensures that the test environment is properly configured and that the issue is resolved both locally and in the CI/CD pipeline.

Fixes the issue OpenAstronomy#64

This PR updates the "Compiled Extensions" page to replace `distutils` with `setuptools`, as `distutils` has been deprecated and removed from Python. 

Changes:
- Replaced all references to `distutils` with `setuptools`.
- Added a note explaining the deprecation of `distutils`.
- Updated examples to use `setuptools`.
@mhvk
Copy link

mhvk commented Mar 28, 2025

@Cadair - this fix helped in my class, where students set up their own packages using the package template. Note that there is another fix in #84, which I think as a fix is less good, but the changes to the text there seem to make sense.

Sorry, posted in the wrong PR - I think the fix here is a bit less logical, testing should not require setuptools_scm - however, the text changes here to ensure people use setuptools and not the deprecated distutils seem to make a lot of sense!

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.

Bug: Pytests Fail Due to Missing setuptools_scm
2 participants