Skip to content

Commit

Permalink
Merge pull request #35 from vnmabus/fix_version
Browse files Browse the repository at this point in the history
Fix version string.
  • Loading branch information
vnmabus committed Mar 25, 2022
2 parents e6fea42 + d0a41cd commit c8d10f6
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 69 deletions.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include MANIFEST.in
include VERSION
include dcor/VERSION
include LICENSE
include *.txt
File renamed without changes.
57 changes: 32 additions & 25 deletions dcor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,42 @@

import errno as _errno
import os as _os
import pathlib as _pathlib

from . import distances # noqa
from . import homogeneity # noqa
from . import independence # noqa
from ._dcor import (distance_covariance_sqr, distance_covariance, # noqa
distance_correlation_sqr, distance_correlation,
distance_stats_sqr, distance_stats,
u_distance_covariance_sqr,
u_distance_correlation_sqr,
u_distance_stats_sqr,
distance_correlation_af_inv_sqr,
distance_correlation_af_inv,
DistanceCovarianceMethod, CompileMode)
from ._dcor_internals import (double_centered, u_centered, # noqa
mean_product, u_product,
u_projection,
u_complementary_projection)
from ._energy import energy_distance, EstimationStatistic # noqa
from ._partial_dcor import (partial_distance_covariance, # noqa
partial_distance_correlation)
from ._rowwise import rowwise, RowwiseMode

from ._dcor import ( # noqa
CompileMode,
DistanceCovarianceMethod,
distance_correlation,
distance_correlation_af_inv,
distance_correlation_af_inv_sqr,
distance_correlation_sqr,
distance_covariance,
distance_covariance_sqr,
distance_stats,
distance_stats_sqr,
u_distance_correlation_sqr,
u_distance_covariance_sqr,
u_distance_stats_sqr,
)
from ._dcor_internals import ( # noqa
double_centered,
mean_product,
u_centered,
u_complementary_projection,
u_product,
u_projection,
)
from ._energy import EstimationStatistic, energy_distance # noqa
from ._partial_dcor import partial_distance_covariance # noqa
from ._partial_dcor import partial_distance_correlation
from ._rowwise import RowwiseMode, rowwise

try:
with open(_os.path.join(_os.path.dirname(__file__),
'..', 'VERSION'), 'r') as version_file:
__version__ = version_file.read().strip()
except IOError as e:
if e.errno != _errno.ENOENT:
raise

__version__ = (
_pathlib.Path(_os.path.dirname(__file__)) / 'VERSION'
).read_text().strip()
except FileNotFoundError:
__version__ = "0.0"
5 changes: 3 additions & 2 deletions dcor/tests/test_package.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
"""Tests of the dcor package"""
"""Tests of the dcor package."""

import re
import unittest

import dcor


class TestVersion(unittest.TestCase):
"""Tests of the version number."""

def test_version(self):
def test_version(self) -> None:
"""Test that the version has the right format."""
regex = re.compile(r"\d+\.\d+(\.\d+)?")
self.assertTrue(regex.match(dcor.__version__))
Expand Down
93 changes: 52 additions & 41 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"""
import os
import pathlib
import sys

from setuptools import find_packages, setup
Expand All @@ -52,45 +53,55 @@

DOCLINES = (__doc__ or '').split("\n")

with open(os.path.join(os.path.dirname(__file__),
'VERSION'), 'r') as version_file:
version = version_file.read().strip()
version = (
pathlib.Path(os.path.dirname(__file__)) / 'dcor' / 'VERSION'
).read_text().strip()

setup(name='dcor',
version=version,
description=DOCLINES[1],
long_description="\n".join(DOCLINES[3:]),
url='https://github.com/vnmabus/dcor',
author='Carlos Ramos Carreño',
author_email='vnmabus@gmail.com',
include_package_data=True,
platforms=['any'],
license='MIT',
packages=find_packages(),
python_requires='>=3.7, <4',
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Topic :: Scientific/Engineering :: Mathematics',
'Topic :: Software Development :: Libraries :: Python Modules',
],
keywords=['distance correlation', 'distance covariance',
'energy distance', 'e-statistic',
'dependency measure', 'homogeneity'],
install_requires=['numpy',
'numba>=0.51',
'scipy'],
setup_requires=pytest_runner,
tests_require=['pytest-cov',
'pytest-subtests',
'numpy>=1.17' # Requires matmul on objects
],
test_suite='dcor.tests',
zip_safe=False)
setup(
name='dcor',
version=version,
description=DOCLINES[1],
long_description="\n".join(DOCLINES[3:]),
url='https://github.com/vnmabus/dcor',
author='Carlos Ramos Carreño',
author_email='vnmabus@gmail.com',
include_package_data=True,
platforms=['any'],
license='MIT',
packages=find_packages(),
python_requires='>=3.7, <4',
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Topic :: Scientific/Engineering :: Mathematics',
'Topic :: Software Development :: Libraries :: Python Modules',
],
keywords=[
'distance correlation',
'distance covariance',
'energy distance',
'e-statistic',
'dependency measure',
'homogeneity',
],
install_requires=[
'numpy',
'numba>=0.51',
'scipy',
],
setup_requires=pytest_runner,
tests_require=[
'pytest-cov',
'pytest-subtests',
'numpy>=1.17', # Requires matmul on objects
],
test_suite='dcor.tests',
zip_safe=False,
)

0 comments on commit c8d10f6

Please sign in to comment.