Skip to content
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

Fixes circular dependency issue by moving the version to a separate file #704

Merged
merged 2 commits into from
Jun 19, 2023

Conversation

reidsunderland
Copy link
Member

@reidsunderland reidsunderland commented Jun 19, 2023

pip couldn't install depedencies because sarracenia/init.py was importing them, and setup.py was importing sarracenia.

There might be better ways of doing this in newer versions of Python (>3.6), but this way seems to be common in packages like Paramiko, Requests, etc.

# When Sarracenia is installed, pip is aware of the version because it's set in setup.py
aspyras@srdev6:~/sr3$ pip3 show metpx-sr3
Name: metpx-sr3
Version: 3.0.41
Summary: Subscribe, Acquire, and Re-Advertise products.
Home-page: https://github.com/MetPX/sarracenia
Author: Shared Services Canada, Supercomputing, Data Interchange
Author-email: [email protected]
License: GPLv2
Location: /home/ib/dads/ras/sr3
Requires: appdirs, humanfriendly, humanize, jsonpickle, paramiko, psutil, watchdog
Required-by:


# And sarracenia.__version__ still works 
aspyras@srdev6:~/sr3$ python3
Python 3.6.9 (default, Mar 10 2023, 16:46:00)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sarracenia
>>> sarracenia.__version__
'3.00.41'
>>> exit()

# Also works if the package is not installed and you import sarracenia from the current directory
aspyras@srdev6:~/sr3$ pip3 uninstall metpx-sr3
Found existing installation: metpx-sr3 3.0.41
Uninstalling metpx-sr3-3.0.41:
  Would remove:
    /home/ib/dads/ras/.local/bin/sr3
    /home/ib/dads/ras/.local/bin/sr3_post
    /home/ib/dads/ras/.local/bin/sr3_tailf
    /home/ib/dads/ras/.local/lib/python3.6/site-packages/metpx-sr3.egg-link
Proceed (Y/n)? y
  Successfully uninstalled metpx-sr3-3.0.41
aspyras@srdev6:~/sr3$ python3
Python 3.6.9 (default, Mar 10 2023, 16:46:00)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sarracenia
>>> sarracenia.__version__
'3.00.41'
>>> exit()

…ile.

pip couldn't install depedencies because sarracenia/__init__.py was importing them, and setup.py was importing sarracenia.

There seem to be better ways of doing this in newer versions of Python (>3.6), but this way seems to be common in packages like Paramiko, Requests, etc.
@petersilva
Copy link
Contributor

Please have a look at docs/Source/Contribution/Development.rst there is a release process documented there, that needs adjustment... have to change the French also.

@petersilva petersilva merged commit c4d3207 into v03_wip Jun 19, 2023
@petersilva petersilva deleted the v03_versioning branch October 24, 2023 21:42
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.

2 participants