Skip to content

Commit

Permalink
Move __version__ to version.py and fix build issue
Browse files Browse the repository at this point in the history
Importing __version__ in setup.py somehow caused tox to raise an error when importing Babel.
  • Loading branch information
tomasvana10 committed Jun 25, 2024
1 parent 5c220ab commit a60a2e9
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
2 changes: 0 additions & 2 deletions crossword_puzzle/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from .main import main

__version__ = "2.2.82"
__package__ = "crossword_puzzle"
__all__ = ["main"]
4 changes: 2 additions & 2 deletions crossword_puzzle/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
from configparser import ConfigParser
try:
from ctypes import windll
from locale import windows_locale
except ImportError:
pass
from locale import windows_locale
from os import name as os_name
from os import environ

from babel import Locale, UnknownLocaleError
from babel import Locale

from crossword_puzzle.base import Base
from crossword_puzzle.utils import (
Expand Down
2 changes: 1 addition & 1 deletion crossword_puzzle/pages/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
CTkRadioButton,
CTkTextbox,
)
from pathvalidate import validate_filename, ValidationError
from pathvalidate import validate_filename
from regex import search

from crossword_puzzle.base import Addons, Base
Expand Down
4 changes: 2 additions & 2 deletions crossword_puzzle/pages/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
)
from concurrent.futures import ThreadPoolExecutor
from threading import Thread
from typing import List, Union
from typing import List
from webbrowser import open_new_tab

from babel import Locale, numbers
Expand Down Expand Up @@ -35,6 +35,7 @@
Colour,
)
from crossword_puzzle.utils import GUIHelper, _update_cfg, _check_version
from crossword_puzzle.version import __version__


class HomePage(CTkFrame, Addons):
Expand Down Expand Up @@ -341,5 +342,4 @@ async def check_version(self) -> None:
with ThreadPoolExecutor() as executor:
ver = await loop.run_in_executor(executor, _check_version)
if ver:
from crossword_puzzle import __version__
self._make_version_label(__version__, ver)
4 changes: 2 additions & 2 deletions crossword_puzzle/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
)
from crossword_puzzle.errors import DefinitionsParsingError
from crossword_puzzle.td import CrosswordInfo
from crossword_puzzle.version import __version__


class GUIHelper:
Expand Down Expand Up @@ -223,8 +224,6 @@ def _check_version() -> Union[None, str]:
response = req.urlopen(request)

if response.status == 200:
from crossword_puzzle import __version__

data = loads(response.read().decode())
local_ver = __version__.split(".")
remote_ver = data["name"].split(".")
Expand Down Expand Up @@ -439,6 +438,7 @@ def _make_cword_info_json(
total_definitions=total_definitions,
difficulty=difficulty,
symbol="0x2717",
name=adjusted_cword_name,
translated_name="",
category=category
),
Expand Down
1 change: 1 addition & 0 deletions crossword_puzzle/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "2.2.83"
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from setuptools import find_namespace_packages, setup
from crossword_puzzle import __version__, __package__


setup(
name=__package__,
version=__version__,
name="crossword_puzzle",
version="2.2.83", # If I import crossword_puzzle.version.__version__,
# setuptools fails to build the project for some reason
author="Tomas Vana",
url="https://github.com/tomasvana10/crossword_puzzle",
description="Select, generate and play always-unique crosswords.",
Expand Down

0 comments on commit a60a2e9

Please sign in to comment.