Skip to content

Commit

Permalink
Merge pull request #79 from PennLINC/enh/pypi
Browse files Browse the repository at this point in the history
[ENH] get ready to release BABS on pypi
  • Loading branch information
Chenying Zhao authored Apr 18, 2023
2 parents 8d51180 + cb9c1ad commit df27e4e
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 7 deletions.
50 changes: 45 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ version: 2.1
# TODO:
# runinstall: &runinstall
# name: Install BABS

# TODO: build; build_docs; see QSIPrep
# TODO: add tests from flake8

jobs:
# TODO: build; build_docs; see QSIPrep

pytest:
<<: *dockersetup
resource_class: xlarge
Expand All @@ -27,6 +26,33 @@ jobs:
command: |
pip install .[tests]
pytest -n 6 -sv
deployable: # checkpoint of deployable: requires all success
<<: *dockersetup
steps:
- run: echo Deploying!

deploy_pypi:
<<: *dockersetup
working_directory: /tmp/src/babs
steps:
- checkout
- run:
name: Generate distribution archives
command: |
THISVERSION=$( python get_version.py )
echo "${CIRCLE_TAG:-$THISVERSION}" > babs/VERSION
python setup.py sdist
pip wheel --no-deps -w dist/ .
- run:
name: Upload packages to PyPI
command: |
pip install --user twine
pip install --user --upgrade importlib-metadata
twine upload --repository testpypi dist/*
# TODO: change back to normal pypi by removing `--repository testpypi`!
# not sure if only `babs*gz` is needed
# not sure if this is needed in `twine upload`: `wrapper/dist/babs*`


workflows:
Expand All @@ -39,7 +65,21 @@ workflows:
# requires:
# - build
filters:
tags:
only: /.*/ # i.e., all branches and tags
- deployable:
requires: # should require all jobs' success before deploying
- pytest
filters: # run when main branch + tags
branches:
only: main
tags:
only: /.*/
- deploy_pypi:
requires:
- deployable
filters: # runs for no branches but runs for any tags
branches:
ignore: /.*/
tags:
only: /.*/

# TODO: add tests from flake8
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ babs.egg-info/*
docs/build
docs/source/generated
build/

# Distribution / packaging
dist/
babs/VERSION
3 changes: 2 additions & 1 deletion babs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""Top-level package for BABS."""
from babs._version import get_versions

__author__ = """PennLINC"""
__email__ = '[email protected]'
__version__ = '0.0.1'
__version__ = get_versions()["version"]

# from .babs import babs
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[build-system]
# "versioneer-518" is needed to use both versioneer and `pyproject.toml`:
requires = ["setuptools", "wheel", "versioneer-518"]
build-backend = "setuptools.build_meta"
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# 30.3.0 allows us to put most metadata in setup.cfg
# Should match pyproject.toml
# Not going to help us much without numpy or new pip, but gives us a shot
SETUP_REQUIRES = ['setuptools >= 40.8']
SETUP_REQUIRES = ['setuptools']
# This enables setuptools to install wheel on-the-fly
SETUP_REQUIRES += ['wheel'] if 'bdist_wheel' in sys.argv else []

Expand Down

0 comments on commit df27e4e

Please sign in to comment.