Skip to content

Commit

Permalink
Fixes circular dependency issue by moving the version to a separate f…
Browse files Browse the repository at this point in the history
…ile (#704)

* Fixes circular dependency issue by moving the version to a separate file.

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.

* Update docs for setting version info
  • Loading branch information
reidsunderland authored Jun 19, 2023
1 parent ef68615 commit c4d3207
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/source/Contribution/Development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1345,7 +1345,7 @@ Set the Version
This is done to *start* development on a version.

* git checkout v03_wip
* Edit ``sarracenia/__init__.py`` manually and set the version number.
* Edit ``sarracenia/_version.py`` manually and set the version number.
* Edit CHANGES.rst to add a section for the version.
* run dch to start the changelog for the current version.
* git commit -a
Expand Down
2 changes: 1 addition & 1 deletion docs/source/fr/Contribution/Développement.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1373,7 +1373,7 @@ Définir la version
Ceci est fait pour *démarrer* le développement d’une version.

* git checkout v03_wip
* Modifier ``sarracenia/__init__.py`` manuellement et définissez le numéro de version.
* Modifier ``sarracenia/_version.py`` manuellement et définissez le numéro de version.
* Modifier CHANGES.rst pour ajouter une section pour la version.
* Exécuter dch pour démarrer le journal des modifications de la version actuelle.
* git commit -a
Expand Down
2 changes: 1 addition & 1 deletion sarracenia/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
__version__ = "3.00.41"
from ._version import __version__

from base64 import b64decode, b64encode
import calendar
Expand Down
1 change: 1 addition & 0 deletions sarracenia/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "3.00.41"
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from setuptools import find_packages
from distutils.core import setup

import sarracenia
#import sarracenia

here = os.path.abspath(os.path.dirname(__file__))

Expand All @@ -28,14 +28,17 @@ def read(*parts):
# https://github.com/pypa/virtualenv/issues/201#issuecomment-3145690
return codecs.open(os.path.join(here, *parts), 'r').read()

metadata = {}
with open(os.path.join(here, "sarracenia", "_version.py"), "r") as f:
exec(f.read(), metadata)

packages = find_packages()
print("packages = %s" % packages)

setup(
name='metpx-sr3',
python_requires='>=3.6',
version=sarracenia.__version__,
version=metadata["__version__"],
description='Subscribe, Acquire, and Re-Advertise products.',
long_description_content_type='text/x-rst',
long_description=(read('README.rst')+latest_changelog()),
Expand Down

0 comments on commit c4d3207

Please sign in to comment.