diff --git a/bids_validator/version.py b/bids_validator/version.py deleted file mode 100644 index 473b67475..000000000 --- a/bids_validator/version.py +++ /dev/null @@ -1,37 +0,0 @@ -from __future__ import absolute_import, division, print_function -import os - -CLASSIFIERS = ["Development Status :: 3 - Alpha", - "Environment :: Console", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - "Programming Language :: Python", - "Topic :: Scientific/Engineering"] - -NAME = "bids-validator" -MAINTAINER = "BIDS Developers" -MAINTAINER_EMAIL = "bids-discussion@googlegroups.com" -DESCRIPTION = "Python package for validation of BIDS projects." -URL = "https://github.com/bids-standard/bids-validator" -DOWNLOAD_URL = "" -LICENSE = "MIT" -AUTHOR = "PyBIDS developers" -AUTHOR_EMAIL = "bids-discussion@googlegroups.com" -PLATFORMS = "OS Independent" -# No data for now -REQUIRES = [] - - -def package_files(directory): - # from https://stackoverflow.com/questions/27664504/how-to-add-package-data-recursively-in-python-setup-py - paths = [] - for (path, directories, filenames) in os.walk(directory): - for filename in filenames: - paths.append(os.path.join('..', path, filename)) - return paths - - -PACKAGE_DATA = { - 'bids_validator': package_files('bids_validator/rules') -} diff --git a/circle.yml b/circle.yml index 1774f13c5..db6de28ac 100644 --- a/circle.yml +++ b/circle.yml @@ -42,6 +42,25 @@ jobs: - run: ./node_modules/.bin/gulp build && rsync -av --exclude=".*" --exclude="node_modules" --exclude="src" --exclude="tests" . ~/web_version/ - store_artifacts: path: ~/web_version/ + pypi_precheck: + docker: + - image: alpine:3.8 + steps: + - checkout + - run: + name: Set up environment + command: | + apk --no-cache add ca-certificates git build-base + - run: + name: Install Python 3 and update setuptools + command: | + apk --no-cache add python3 python3-dev py3-cffi + python3 -m pip install --upgrade pip setuptools wheel twine readme_renderer[md] + - run: + name: Check build and readme rendering + command: | + python3 setup.py sdist bdist_wheel + twine check dist/* deployment: docker: - image: node:8.11.3-alpine @@ -59,6 +78,17 @@ jobs: # Set the version number - run: sed -i -E "s/0.0.0/$CIRCLE_TAG/" package.json - run: ./node_modules/.bin/publish + # Publish to PyPI + - run: + name: Install Python 3 and update setuptools + command: | + apk --no-cache add python3 python3-dev py3-cffi + python3 -m pip install --upgrade pip setuptools wheel twine + - run: + name: Build and push to PyPI + command: | + python3 setup.py sdist bdist_wheel + twine upload dist/* # Update gh-pages demo site - run: git config --global user.email circleci@circleci - run: git config --global user.name CircleCI @@ -91,10 +121,15 @@ workflows: only: /.*/ tags: only: /.*/ + - pypi_precheck: + filters: + tags: + only: /.*/ - deployment: requires: - test - githubPagesTest + - pypi_precheck filters: branches: ignore: /.*/ diff --git a/setup.cfg b/setup.cfg index e979da7cf..0e3d083fd 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,34 @@ [metadata] -description-file = README.md +name = bids-validator +url = https://github.com/bids-standard/bids-validator +author = PyBIDS developers +author_email = bids-discussion@googlegroups.com +maintainer = BIDS Developers +maintainer_email = bids-discussion@googlegroups.com +description = Validator for the Brain Imaging Data Structure +long_description = file:README.md +long_description_content_type="text/markdown" +license = MIT +classifiers = + Development Status :: 3 - Alpha + Environment :: Console + Intended Audience :: Science/Research + License :: OSI Approved :: MIT License + Operating System :: OS Independent + Programming Language :: Python + Topic :: Scientific/Engineering + +[options] +packages = find: +include_package_data = True + +[options.package_data] +bids_validator = + rules/*.json + tsv/*.json + +[bdist_wheel] +universal=1 [versioneer] VCS = git diff --git a/setup.py b/setup.py index 2a0697866..4419af6ba 100644 --- a/setup.py +++ b/setup.py @@ -1,33 +1,6 @@ #!/usr/bin/env python -import os -from setuptools import setup, find_packages +from setuptools import setup import versioneer - -PACKAGES = find_packages() - -# Get version and release info, which is all stored in bids/version.py -ver_file = os.path.join('bids_validator', 'version.py') -with open(ver_file) as f: - exec(f.read()) - -opts = dict(name=NAME, - maintainer=MAINTAINER, - maintainer_email=MAINTAINER_EMAIL, - description=DESCRIPTION, - url=URL, - download_url=DOWNLOAD_URL, - license=LICENSE, - classifiers=CLASSIFIERS, - author=AUTHOR, - author_email=AUTHOR_EMAIL, - platforms=PLATFORMS, - version=versioneer.get_version(), - cmdclass=versioneer.get_cmdclass(), - packages=PACKAGES, - package_data=PACKAGE_DATA, - install_requires=REQUIRES) - - -if __name__ == '__main__': - setup(**opts) +setup(version=versioneer.get_version(), + cmdclass=versioneer.get_cmdclass())