Skip to content

Commit

Permalink
MAINT: Use setuptools_scm for versioning (#356)
Browse files Browse the repository at this point in the history
  • Loading branch information
larsoner authored Apr 6, 2023
1 parent 5336d47 commit d6a3f5a
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 20 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,5 @@ docs/external_examples.rst

# vim
*.swp

pyvistaqt/_version.py
5 changes: 3 additions & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ fail-under=10
ignore=rwi.py,
conf.py,
conftest.py,
_version.py,
setup.py # ignore and fix in future PR

# Add files or directories matching the regex patterns to the blacklist. The
Expand Down Expand Up @@ -527,5 +528,5 @@ preferred-modules=

# Exceptions that will emit a warning when being caught. Defaults to
# "BaseException, Exception".
overgeneral-exceptions=BaseException,
Exception
overgeneral-exceptions=builtins.BaseException,
builtins.Exception
1 change: 0 additions & 1 deletion mypy_checklist.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pyvistaqt/_version.py
pyvistaqt/counter.py
pyvistaqt/dialog.py
pyvistaqt/editor.py
Expand Down
11 changes: 10 additions & 1 deletion pyvistaqt/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
"""PyVista package for 3D plotting and mesh analysis."""
from ._version import __version__

try:
from importlib.metadata import version

__version__ = version("pyvistaqt")
except Exception: # pragma: no cover # pylint: disable=broad-exception-caught
try:
from ._version import __version__
except ImportError:
__version__ = '0.0.0'

try:
from qtpy import QtCore # noqa
Expand Down
6 changes: 0 additions & 6 deletions pyvistaqt/_version.py

This file was deleted.

19 changes: 9 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,19 @@
Installation file for python pyvistaqt module
"""
import os
from pathlib import Path
from io import open as io_open

from setuptools import setup

package_name = 'pyvistaqt'

__version__ = None
filepath = os.path.dirname(__file__)
version_file = os.path.join(filepath, package_name, '_version.py')
with io_open(version_file, mode='r') as fd:
exec(fd.read())

readme_file = os.path.join(filepath, 'README.rst')
readme_file = Path(__file__).parent / 'README.rst'

setup(
name=package_name,
packages=[package_name, package_name],
version=__version__,
description='pyvista qt plotter',
long_description=io_open(readme_file, encoding="utf-8").read(),
long_description=readme_file.read_text(),
long_description_content_type='text/x-rst',
author='PyVista Developers',
author_email='[email protected]',
Expand All @@ -42,9 +35,15 @@
url='https://github.com/pyvista/pyvistaqt',
keywords='vtk numpy plotting mesh qt',
python_requires='>=3.7',
setup_requires=["setuptools>=45", "setuptools_scm>=6.2"],
use_scm_version={
"write_to": "pyvistaqt/_version.py",
"version_scheme": "release-branch-semver",
},
install_requires=[
'pyvista>=0.32.0',
'QtPy>=1.9.0',
"importlib_resources>=5.10.2; python_version<'3.9'",
],
package_data={'pyvistaqt': [
os.path.join('data', '*.png'),
Expand Down

0 comments on commit d6a3f5a

Please sign in to comment.