Skip to content

Conversation

@prabhat-kumar96
Copy link
Contributor

@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.

@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!

prabhat-kumar96 and others added 3 commits August 19, 2025 14:47
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`.
@Cadair Cadair merged commit 67566ad into OpenAstronomy:main Aug 19, 2025
7 checks passed
@Cadair
Copy link
Member

Cadair commented Aug 19, 2025

Thanks @prabhat-kumar96 🥳

@prabhat-kumar96
Copy link
Contributor Author

I will be glad to contribute further!

CyclingNinja pushed a commit to CyclingNinja/packaging-guide that referenced this pull request Sep 2, 2025
This is an autogenerated PR, which merges commits from
OpenAstronomy/packaging-guide.



*Do not squash merge this PR! All commits from upstream should be
present in the repos history.*
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

3 participants