diff --git a/pycountry_wrapper/__about__.py b/pycountry_wrapper/__about__.py deleted file mode 100644 index 88e9b11..0000000 --- a/pycountry_wrapper/__about__.py +++ /dev/null @@ -1,2 +0,0 @@ -__version__ = "0.0.4" -__name__ = "pycountry_wrapper" \ No newline at end of file diff --git a/pycountry_wrapper/__init__.py b/pycountry_wrapper/__init__.py index fbd10bf..7d57cfd 100644 --- a/pycountry_wrapper/__init__.py +++ b/pycountry_wrapper/__init__.py @@ -1,6 +1,7 @@ from .country import Country, EmptyCountry, EmptyCountryException from . import config +__name__ = "pycountry_wrapper" __all__ = [ "Country", "EmptyCountry", diff --git a/pycountry_wrapper/__main__.py b/pycountry_wrapper/__main__.py index 16afc37..054f9ee 100644 --- a/pycountry_wrapper/__main__.py +++ b/pycountry_wrapper/__main__.py @@ -1,11 +1,10 @@ -from .__about__ import __name__, __version__ +from . import __name__ from . import Country, EmptyCountry, config -import pycountry - def cli(): - print(f"Running {__name__} version {__version__} from __main__.py") + print(f"Running {__name__} from __main__.py") + import pycountry config.fallback_country = "US" t = pycountry.countries.get(alpha_2="DE") diff --git a/pycountry_wrapper/country.py b/pycountry_wrapper/country.py index aeb0072..e33bfec 100644 --- a/pycountry_wrapper/country.py +++ b/pycountry_wrapper/country.py @@ -1,7 +1,6 @@ from __future__ import annotations from typing import Optional, Union from functools import wraps -from typing_extensions import Self import pycountry import pycountry.db @@ -120,7 +119,7 @@ class EmptyCountry(Country): This will be used if you don't want to use a fallback country but you still want to be able to not have None You can access the same attributes but they will just return None """ - def __new__(cls, country: Optional[str] = None, pycountry_object: Optional[pycountry.db.Country] = None, **kwargs): + def __new__(cls, country: Optional[str] = None, pycountry_object: Optional[pycountry.db.Country] = None, **kwargs) -> Union[Country, EmptyCountry]: try: return Country(country=country, pycountry_object=pycountry_object, disable_fallback=True) except EmptyCountryException: diff --git a/pyproject.toml b/pyproject.toml index 3255e58..8412c0f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,8 @@ name = "pycountry-wrapper" dependencies = [ "pycountry~=24.6.1", ] -dynamic = ["version"] +version = "1.0.0" +dynamic = [] authors = [] description = "This is a wrapper for pycountry, to make said library more usable." readme = "README.md" @@ -32,6 +33,3 @@ packages = ["pycountry_wrapper"] [tool.hatch.metadata] allow-direct-references = true - -[tool.hatch.version] -path = "pycountry_wrapper/__about__.py"