Skip to content

Commit

Permalink
Remove pkginfo dependency, hardcode package info (#167)
Browse files Browse the repository at this point in the history
Remove pkginfo dependency, hardcode package info.
Use GitHub username for author.
  • Loading branch information
CasperWA committed Sep 26, 2020
1 parent 5ec584c commit 33e6aa4
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/static/update_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ invoke update-version --version="${GITHUB_REF#refs/tags/}"
echo "\n### Commit updated files ###"
git add setup.py
git add optimade_client/__init__.py
git add optimade_client/informational.py
git commit -m "Release ${GITHUB_REF#refs/tags/}"
4 changes: 1 addition & 3 deletions optimade_client/informational.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
from urllib.parse import urlencode

import ipywidgets as ipw
from pkginfo import Installed

from optimade_client.logger import LOGGER, WIDGET_HANDLER, REPORT_HANDLER
from optimade_client.utils import __optimade_version__


IMG_DIR = Path(__file__).parent.joinpath("img")
SOURCE_URL = "https://github.com/CasperWA/voila-optimade-client/"
PKG_INFO = Installed("optimade_client")


class HeaderDescription(ipw.VBox):
Expand All @@ -35,7 +33,7 @@ class HeaderDescription(ipw.VBox):

HEADER = f"""<p style="font-size:14px;">
<b>Currently valid OPTIMADE API version</b>: <code>v{__optimade_version__[0]}</code><br>
<b>Client version</b>: <code>{PKG_INFO.version}</code><br>
<b>Client version</b>: <code>2020.9.26</code><br>
<b>Source code</b>: <a href="{SOURCE_URL}" target="_blank">GitHub</a>
</p>
"""
Expand Down
4 changes: 1 addition & 3 deletions optimade_client/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@

import appdirs
import ipywidgets as ipw
from pkginfo import Installed


PKG_INFO = Installed("optimade_client")
LOG_DIR = Path(appdirs.user_log_dir(PKG_INFO.name, PKG_INFO.author))
LOG_DIR = Path(appdirs.user_log_dir("optimade-client", "CasperWA"))
LOG_DIR.mkdir(parents=True, exist_ok=True)

LOG_FILE = LOG_DIR / "optimade_client.log"
Expand Down
4 changes: 1 addition & 3 deletions optimade_client/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from json import JSONDecodeError

import appdirs
from pkginfo import Installed
from pydantic import ValidationError, AnyUrl # pylint: disable=no-name-in-module
import requests

Expand All @@ -36,8 +35,7 @@
"/links/v1/providers.json",
]

PKG_INFO = Installed("optimade_client")
CACHE_DIR = Path(appdirs.user_cache_dir(PKG_INFO.name, PKG_INFO.author))
CACHE_DIR = Path(appdirs.user_cache_dir("optimade-client", "CasperWA"))
CACHE_DIR.mkdir(parents=True, exist_ok=True)
CACHED_PROVIDERS = CACHE_DIR / "cached_providers.json"

Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ nglview~=2.7
numpy~=1.19
optimade~=0.12.1
pandas~=1.1
pkginfo~=1.5
requests~=2.24
voila~=0.2.3
widget_periodictable~=2.1
4 changes: 4 additions & 0 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,9 @@ def update_version(_, version=""):
update_file(
TOP_DIR.joinpath("setup.py"), ("version=([^,]+),", f'version="{version}",')
)
update_file(
TOP_DIR.joinpath("optimade_client/informational.py"),
(r"Client version.*</code>", f"Client version</b>: <code>{version}</code>"),
)

print(f"Bumped version to {version} !")

0 comments on commit 33e6aa4

Please sign in to comment.