-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use setuptools_scm Follows up #47 - on [pypi](https://pypi.org/project/torchsampler/0.1.1/) it's 0.1.1 - on github it's [0.1.0](https://github.com/ufoym/imbalanced-dataset-sampler/releases/tag/v0.1.0) - but the attached [wheel](https://github.com/ufoym/imbalanced-dataset-sampler/releases/download/v0.1.0/torchsampler-0.1.1-py3-none-any.whl) and [sdist](https://github.com/ufoym/imbalanced-dataset-sampler/releases/download/v0.1.0/torchsampler-0.1.1.tar.gz) are 0.1.1 [`setuptools-scm`](https://pypi.org/project/setuptools-scm/) makes git the single-source of truth for the version of the package, and works well with the build script in #47 (which is triggered by tagging a new version in git). `setuptools-scm` also replaces most of MANIFEST.in, so this removes the redundant lines from that too. * Deprecate torchsampler.__about__ It's better to keep all metadata in setup.py and use importlib.metadata. Otherwise, you need to 'import __about__' during the build process means importlib-metadata needs to be installed during the build if building on python 3.6 or python 3.7, and potentially running an unbounded amount of other code during the build. It's easier to just sidestep the issue. * Squash a build warning > .../site-packages/setuptools/dist.py:726: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead description_file has been superseded recently in 4c4a6e3 anyway.
- Loading branch information
Showing
6 changed files
with
41 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,11 @@ | ||
# Manifest syntax https://docs.python.org/2/distutils/sourcedist.html | ||
graft wheelhouse | ||
# Manifest syntax https://setuptools.pypa.io/en/latest/deprecated/distutils/commandref.html#sdist-cmd | ||
|
||
recursive-exclude __pycache__ *.py[cod] *.orig | ||
|
||
# Include the README | ||
include *.md | ||
|
||
# Include the license file | ||
include LICENSE | ||
|
||
recursive-include torchsampler *.py | ||
|
||
# Include the Requirements | ||
include requirements.txt | ||
# FIXME: switching to a src/ layout would obviate the need for this file entirely. | ||
# see https://setuptools.pypa.io/en/latest/userguide/package_discovery.html#src-layout | ||
|
||
# Exclude build configs | ||
exclude *.yml | ||
exclude *.yaml | ||
|
||
prune .github | ||
prune example* | ||
prune temp* | ||
prune test* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
torch>=1.3 | ||
torchvision>=0.5 | ||
pandas | ||
# only needed by __about__.py, which is deprecated: | ||
importlib_metadata; python_version<'3.8' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
[metadata] | ||
license_file = LICENSE | ||
description-file = README.md | ||
|
||
[flake8] | ||
max-line-length = 120 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,9 @@ | ||
"""A setuptools based setup module.""" | ||
|
||
import sys | ||
from pathlib import Path | ||
|
||
from setuptools import setup | ||
|
||
try: | ||
from torchsampler import __about__ as about | ||
except ImportError: | ||
# alternative https://stackoverflow.com/a/67692/4521646 | ||
sys.path.append("torchsampler") | ||
import __about__ as about | ||
|
||
PATH_HERE = Path(__file__).parent | ||
|
||
with open(PATH_HERE / 'requirements.txt', encoding='utf-8') as fp: | ||
|
@@ -20,16 +12,18 @@ | |
|
||
setup( | ||
name='torchsampler', | ||
version=about.__version__, | ||
url=about.__homepage__, | ||
author=about.__author__, | ||
author_email=about.__author_email__, | ||
license=about.__license__, | ||
description=about.__doc__, | ||
use_scm_version=True, | ||
url="https://github.com/ufoym/imbalanced-dataset-sample", | ||
author="Ming, et al.", | ||
author_email="[email protected]", | ||
license="MIT", | ||
description="A (PyTorch) imbalanced dataset sampler for oversampling low classes" | ||
"and undersampling high frequent ones.", | ||
long_description=long_description, | ||
long_description_content_type='text/markdown', | ||
packages=['torchsampler'], | ||
keywords='sampler,pytorch,dataloader', | ||
setup_requires=['setuptools_scm'], | ||
install_requires=requirements, | ||
python_requires='>=3.6', | ||
include_package_data=True, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,31 @@ | ||
__version__ = "0.1.1" | ||
__author__ = "Ming, et al." | ||
__author_email__ = "[email protected]" | ||
__license__ = "MIT" | ||
__homepage__ = "https://github.com/ufoym/imbalanced-dataset-sampler" | ||
__doc__ = "A (PyTorch) imbalanced dataset sampler for oversampling low frequent classes" \ | ||
" and undersampling high frequent ones." | ||
import sys | ||
|
||
if sys.version_info < (3, 8): | ||
from importlib_metadata import distribution, PackageNotFoundError | ||
else: | ||
from importlib.metadata import distribution, PackageNotFoundError | ||
|
||
import warnings | ||
|
||
warnings.warn( | ||
"Use importlib.metadata.distribution('torchsampler').metadata instead of torchsampler.__about__.", | ||
category=DeprecationWarning | ||
) | ||
|
||
try: | ||
_m = distribution('torchsampler').metadata | ||
__version__ = _m['version'] | ||
__author__ = _m['author'] | ||
__author_email__ = _m['author-email'] | ||
__license__ = _m['license'] | ||
__homepage__ = _m['homepage'] | ||
__doc__ = _m['summary'] | ||
del _m | ||
except PackageNotFoundError: | ||
# package is not installed (i.e. we're probably in the build process itself) | ||
pass | ||
|
||
del sys, distribution, PackageNotFoundError, warnings | ||
|
||
__all__ = [ | ||
"__author__", | ||
|