Skip to content

Commit

Permalink
Be better python citizens regarding distributed files (wright-group#595)
Browse files Browse the repository at this point in the history
* Remove tests from distributed version of WT

Previously find_packages include

* Move Version Files

* Distribute LICENSE in dist-info

* Fix docs

* pep8
  • Loading branch information
ksunden authored and untzag committed May 30, 2018
1 parent efdd996 commit 8735b94
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 24 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion WrightTools/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


# read from VERSION file
with open(os.path.join(os.path.dirname(here), 'VERSION')) as f:
with open(os.path.join(here, 'VERSION')) as f:
__version__ = f.read().strip()


Expand Down
2 changes: 1 addition & 1 deletion WrightTools/__wt5_version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@


# read from VERSION file
with open(os.path.join(os.path.dirname(here), 'WT5_VERSION')) as f:
with open(os.path.join(here, 'WT5_VERSION')) as f:
__wt5_version__ = f.read().strip()
3 changes: 1 addition & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

here = os.path.abspath(os.path.dirname(__file__))

with open(os.path.join(os.path.dirname(here), 'VERSION')) as version_file:
with open(os.path.join(os.path.dirname(here), 'WrightTools', 'VERSION')) as version_file:
version = version_file.read().strip()


Expand Down Expand Up @@ -263,4 +263,3 @@
'matplotlib': ('http://matplotlib.org', None),
'numpy': ('https://docs.scipy.org/doc/numpy/', None)
}

4 changes: 3 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ convention = numpy
add-ignore = D105

[metadata]
description-file = README.rst
description_file = README.rst
license_file = LICENSE.txt


[tool:pytest]
addopts = --durations=10 --cov=WrightTools --verbose --cov-report term:skip-covered
Expand Down
26 changes: 7 additions & 19 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,26 @@
from setuptools import setup, find_packages


def package_files(directory):
paths = []
for (path, directories, filenames) in os.walk(directory):
for filename in filenames:
paths.append(os.path.join('..', path, filename))
return paths


here = os.path.abspath(os.path.dirname(__file__))


def read(fname):
return open(os.path.join(here, fname)).read()


extra_files = package_files(os.path.join(here, 'WrightTools', 'datasets'))
extra_files.append(os.path.join(here, 'CONTRIBUTORS'))
extra_files.append(os.path.join(here, 'LICENSE'))
extra_files.append(os.path.join(here, 'README.rst'))
extra_files.append(os.path.join(here, 'requirements.txt'))
extra_files.append(os.path.join(here, 'VERSION'))
extra_files.append(os.path.join(here, 'WT5_VERSION'))
extra_files = {'WrightTools': ['datasets', 'datasets/*', 'datasets/*/*', 'datasets/*/*/*',
'VERSION', 'WT5_VERSION']}

with open(os.path.join(here, 'requirements.txt')) as f:
required = f.read().splitlines()

with open(os.path.join(here, 'VERSION')) as version_file:
with open(os.path.join(here, 'WrightTools', 'VERSION')) as version_file:
version = version_file.read().strip()

setup(
name='WrightTools',
packages=find_packages(),
package_data={'': extra_files},
packages=find_packages(exclude=('tests', 'tests.*')),
package_data=extra_files,
python_requires='>=3.5',
setup_requires=['pytest-runner'],
tests_require=['pytest', 'pytest-cov',
Expand All @@ -57,5 +44,6 @@ def read(fname):
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Topic :: Scientific/Engineering']
'Topic :: Scientific/Engineering',
]
)

0 comments on commit 8735b94

Please sign in to comment.