Skip to content
Snippets Groups Projects
Unverified Commit c4334ecb authored by Jon Crall's avatar Jon Crall
Browse files

Update xcookie with sdist

parent c4111f25
No related branches found
No related tags found
1 merge request!34Dev/0.8.0
Pipeline #411065 passed
......@@ -4,8 +4,8 @@ stages:
# TEMPLATES
- lint
- build
- test
- gpgsign
- test
- deploy
.common_template: &common_template
tags:
......@@ -26,7 +26,17 @@ stages:
cache:
paths:
- .cache/pip
.build_template: &build_template
.build_sdist_template: &build_sdist_template
<<: *common_template
stage: build
script:
- python -m pip install setuptools>=0.8 wheel build twine
- python -m build --sdist --outdir dist
- python -m twine check ./dist/scriptconfig*.tar.gz
artifacts:
paths:
- ./dist/scriptconfig*.tar.gz
.build_wheel_template: &build_wheel_template
<<: *common_template
stage: build
before_script:
......@@ -64,13 +74,16 @@ stages:
- echo "Installing helpers"
- pip install setuptools>=0.8 setuptools_scm wheel build -U
- pip install tomli pkginfo
- export WHEEL_FPATH=$(python -c "import pathlib;
print(str(sorted(pathlib.Path('dist').glob('scriptconfig*.whl'))[-1]).replace(chr(92),
chr(47)))")
- export MOD_VERSION=$(python -c "from pkginfo import Wheel; print(Wheel('$WHEEL_FPATH').version)")
- echo "$WHEEL_FPATH=WHEEL_FPATH"
- echo "$INSTALL_EXTRAS=INSTALL_EXTRAS"
- echo "$MOD_VERSION=MOD_VERSION"
- "export WHEEL_FPATH=$(python -c \"if 1:\n import pathlib\n dist_dpath =
pathlib.Path('dist')\n candidates = list(dist_dpath.glob('scriptconfig*.whl'))\n\
\ candidates += list(dist_dpath.glob('scriptconfig*.tar.gz'))\n fpath =
sorted(candidates)[-1]\n print(str(fpath).replace(chr(92), chr(47)))\n\")"
- "export MOD_VERSION=$(python -c \"if 1:\n from pkginfo import Wheel, SDist\n\
\ fpath = '$WHEEL_FPATH'\n cls = Wheel if fpath.endswith('.whl') else SDist\n\
\ print(cls(fpath).version)\n\")"
- echo "WHEEL_FPATH=$WHEEL_FPATH"
- echo "INSTALL_EXTRAS=$INSTALL_EXTRAS"
- echo "MOD_VERSION=$MOD_VERSION"
- pip install --prefer-binary "scriptconfig[$INSTALL_EXTRAS]==$MOD_VERSION" -f dist
- echo "Install finished."
- echo "Creating test sandbox directory"
......@@ -116,13 +129,16 @@ stages:
- echo "Installing helpers"
- pip install setuptools>=0.8 setuptools_scm wheel build -U
- pip install tomli pkginfo
- export WHEEL_FPATH=$(python -c "import pathlib;
print(str(sorted(pathlib.Path('dist').glob('scriptconfig*.whl'))[-1]).replace(chr(92),
chr(47)))")
- export MOD_VERSION=$(python -c "from pkginfo import Wheel; print(Wheel('$WHEEL_FPATH').version)")
- echo "$WHEEL_FPATH=WHEEL_FPATH"
- echo "$INSTALL_EXTRAS=INSTALL_EXTRAS"
- echo "$MOD_VERSION=MOD_VERSION"
- "export WHEEL_FPATH=$(python -c \"if 1:\n import pathlib\n dist_dpath =
pathlib.Path('dist')\n candidates = list(dist_dpath.glob('scriptconfig*.whl'))\n\
\ candidates += list(dist_dpath.glob('scriptconfig*.tar.gz'))\n fpath =
sorted(candidates)[-1]\n print(str(fpath).replace(chr(92), chr(47)))\n\")"
- "export MOD_VERSION=$(python -c \"if 1:\n from pkginfo import Wheel, SDist\n\
\ fpath = '$WHEEL_FPATH'\n cls = Wheel if fpath.endswith('.whl') else SDist\n\
\ print(cls(fpath).version)\n\")"
- echo "WHEEL_FPATH=$WHEEL_FPATH"
- echo "INSTALL_EXTRAS=$INSTALL_EXTRAS"
- echo "MOD_VERSION=$MOD_VERSION"
- pip install --prefer-binary "scriptconfig[$INSTALL_EXTRAS]==$MOD_VERSION" -f dist
- echo "Install finished."
- echo "Creating test sandbox directory"
......@@ -168,13 +184,16 @@ stages:
- echo "Installing helpers"
- pip install setuptools>=0.8 setuptools_scm wheel build -U
- pip install tomli pkginfo
- export WHEEL_FPATH=$(python -c "import pathlib;
print(str(sorted(pathlib.Path('dist').glob('scriptconfig*.whl'))[-1]).replace(chr(92),
chr(47)))")
- export MOD_VERSION=$(python -c "from pkginfo import Wheel; print(Wheel('$WHEEL_FPATH').version)")
- echo "$WHEEL_FPATH=WHEEL_FPATH"
- echo "$INSTALL_EXTRAS=INSTALL_EXTRAS"
- echo "$MOD_VERSION=MOD_VERSION"
- "export WHEEL_FPATH=$(python -c \"if 1:\n import pathlib\n dist_dpath =
pathlib.Path('dist')\n candidates = list(dist_dpath.glob('scriptconfig*.whl'))\n\
\ candidates += list(dist_dpath.glob('scriptconfig*.tar.gz'))\n fpath =
sorted(candidates)[-1]\n print(str(fpath).replace(chr(92), chr(47)))\n\")"
- "export MOD_VERSION=$(python -c \"if 1:\n from pkginfo import Wheel, SDist\n\
\ fpath = '$WHEEL_FPATH'\n cls = Wheel if fpath.endswith('.whl') else SDist\n\
\ print(cls(fpath).version)\n\")"
- echo "WHEEL_FPATH=$WHEEL_FPATH"
- echo "INSTALL_EXTRAS=$INSTALL_EXTRAS"
- echo "MOD_VERSION=$MOD_VERSION"
- pip install --prefer-binary "scriptconfig[$INSTALL_EXTRAS]==$MOD_VERSION" -f dist
- echo "Install finished."
- echo "Creating test sandbox directory"
......@@ -220,13 +239,16 @@ stages:
- echo "Installing helpers"
- pip install setuptools>=0.8 setuptools_scm wheel build -U
- pip install tomli pkginfo
- export WHEEL_FPATH=$(python -c "import pathlib;
print(str(sorted(pathlib.Path('dist').glob('scriptconfig*.whl'))[-1]).replace(chr(92),
chr(47)))")
- export MOD_VERSION=$(python -c "from pkginfo import Wheel; print(Wheel('$WHEEL_FPATH').version)")
- echo "$WHEEL_FPATH=WHEEL_FPATH"
- echo "$INSTALL_EXTRAS=INSTALL_EXTRAS"
- echo "$MOD_VERSION=MOD_VERSION"
- "export WHEEL_FPATH=$(python -c \"if 1:\n import pathlib\n dist_dpath =
pathlib.Path('dist')\n candidates = list(dist_dpath.glob('scriptconfig*.whl'))\n\
\ candidates += list(dist_dpath.glob('scriptconfig*.tar.gz'))\n fpath =
sorted(candidates)[-1]\n print(str(fpath).replace(chr(92), chr(47)))\n\")"
- "export MOD_VERSION=$(python -c \"if 1:\n from pkginfo import Wheel, SDist\n\
\ fpath = '$WHEEL_FPATH'\n cls = Wheel if fpath.endswith('.whl') else SDist\n\
\ print(cls(fpath).version)\n\")"
- echo "WHEEL_FPATH=$WHEEL_FPATH"
- echo "INSTALL_EXTRAS=$INSTALL_EXTRAS"
- echo "MOD_VERSION=$MOD_VERSION"
- pip install --prefer-binary "scriptconfig[$INSTALL_EXTRAS]==$MOD_VERSION" -f dist
- echo "Install finished."
- echo "Creating test sandbox directory"
......@@ -251,8 +273,16 @@ stages:
- |-
python -m pytest --verbose -p pytester -p no:doctest --xdoctest --cov-config ../pyproject.toml --cov-report term --durations=100 --cov="$MOD_NAME" "$MOD_DPATH" ../tests
- echo "pytest command finished, moving the coverage file to the repo root"
build/sdist:
<<: *build_sdist_template
image: python:3.11
test/sdist/minimal-loose/cp311-linux-x86_64:
<<: *test_minimal-loose_template
image: python:3.11
needs:
- build/sdist
build/cp38-linux-x86_64:
<<: *build_template
<<: *build_wheel_template
image: python:3.8
test/minimal-loose/cp38-linux-x86_64:
<<: *test_minimal-loose_template
......@@ -275,7 +305,7 @@ test/full-strict/cp38-linux-x86_64:
needs:
- build/cp38-linux-x86_64
build/cp39-linux-x86_64:
<<: *build_template
<<: *build_wheel_template
image: python:3.9
test/minimal-loose/cp39-linux-x86_64:
<<: *test_minimal-loose_template
......@@ -298,7 +328,7 @@ test/full-strict/cp39-linux-x86_64:
needs:
- build/cp39-linux-x86_64
build/cp310-linux-x86_64:
<<: *build_template
<<: *build_wheel_template
image: python:3.10
test/minimal-loose/cp310-linux-x86_64:
<<: *test_minimal-loose_template
......@@ -321,7 +351,7 @@ test/full-strict/cp310-linux-x86_64:
needs:
- build/cp310-linux-x86_64
build/cp311-linux-x86_64:
<<: *build_template
<<: *build_wheel_template
image: python:3.11
test/minimal-loose/cp311-linux-x86_64:
<<: *test_minimal-loose_template
......@@ -344,7 +374,7 @@ test/full-strict/cp311-linux-x86_64:
needs:
- build/cp311-linux-x86_64
build/cp312-linux-x86_64:
<<: *build_template
<<: *build_wheel_template
image: python:3.12
test/minimal-loose/cp312-linux-x86_64:
<<: *test_minimal-loose_template
......@@ -383,6 +413,7 @@ gpgsign/wheels:
artifacts:
paths:
- dist/*.asc
- dist/*.tar.gz
- dist/*.whl
- dist/*.ots
only:
......@@ -393,17 +424,6 @@ gpgsign/wheels:
- master
- main
- release
needs:
- job: build/cp38-linux-x86_64
artifacts: true
- job: build/cp39-linux-x86_64
artifacts: true
- job: build/cp310-linux-x86_64
artifacts: true
- job: build/cp311-linux-x86_64
artifacts: true
- job: build/cp312-linux-x86_64
artifacts: true
script:
- ls dist
- export GPG_EXECUTABLE=gpg
......@@ -426,7 +446,7 @@ gpgsign/wheels:
- GPG_SIGN_CMD="$GPG_EXECUTABLE --batch --yes --detach-sign --armor --local-user
$GPG_KEYID"
- |-
WHEEL_PATHS=(dist/*.whl)
WHEEL_PATHS=(dist/*.whl dist/*.tar.gz)
WHEEL_PATHS_STR=$(printf '"%s" ' "${WHEEL_PATHS[@]}")
echo "$WHEEL_PATHS_STR"
for WHEEL_PATH in "${WHEEL_PATHS[@]}"
......@@ -439,7 +459,20 @@ gpgsign/wheels:
done
- ls dist
- python -m pip install opentimestamps-client
- ots stamp dist/*.whl dist/*.asc
- ots stamp dist/*.tar.gz dist/*.whl dist/*.asc
needs:
- job: build/sdist
artifacts: true
- job: build/cp38-linux-x86_64
artifacts: true
- job: build/cp39-linux-x86_64
artifacts: true
- job: build/cp310-linux-x86_64
artifacts: true
- job: build/cp311-linux-x86_64
artifacts: true
- job: build/cp312-linux-x86_64
artifacts: true
deploy/wheels:
<<: *common_template
image: python:3.11
......@@ -451,7 +484,7 @@ deploy/wheels:
- pip install pyopenssl ndg-httpsclient pyasn1 requests[security] twine -U
- ls dist
- |-
WHEEL_PATHS=(dist/*.whl)
WHEEL_PATHS=(dist/*.whl dist/*.tar.gz)
WHEEL_PATHS_STR=$(printf '"%s" ' "${WHEEL_PATHS[@]}")
source dev/secrets_configuration.sh
TWINE_PASSWORD=${!VARNAME_TWINE_PASSWORD}
......@@ -460,7 +493,7 @@ deploy/wheels:
for WHEEL_PATH in "${WHEEL_PATHS[@]}"
do
twine check $WHEEL_PATH.asc $WHEEL_PATH
twine upload --username $TWINE_USERNAME --password $TWINE_PASSWORD $WHEEL_PATH.asc $WHEEL_PATH || echo "upload already exists"
twine upload --username $TWINE_USERNAME --password $TWINE_PASSWORD $WHEEL_PATH || echo "upload already exists"
done
- |-
# Have the server git-tag the release and push the tags
......
include requirements/*.txt
\ No newline at end of file
......@@ -17,7 +17,7 @@ Notes:
# need to edit the conf.py
cd ~/code/scriptconfig/docs
sphinx-apidoc --private --separate -f -o ~/code/scriptconfig/docs/source/auto ~/code/scriptconfig/scriptconfig
sphinx-apidoc --private --separate --force --output-dir ~/code/scriptconfig/docs/source/auto ~/code/scriptconfig/scriptconfig
# Note: the module should importable before running this
# (e.g. install it in developer mode or munge the PYTHONPATH)
......
#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
"""
CommandLine:
cd ~/code/scriptconfig
python examples/basic.py --help
# The command line if flexible by default
python examples/basic.py --my-option1=3
python examples/basic.py --my_option1=4
python examples/basic.py "a positional arg"
python examples/basic.py --position-arg "positional args can always be given as key/value pairs"
"""
import scriptconfig as scfg
import ubelt as ub
import rich
import rich.markup
class MyConfig(scfg.DataConfig):
position_arg = scfg.Value(None, help='position argument', position=1)
my_option1 = scfg.Value(None, help='option1')
my_option2 = scfg.Value(None, help='option2')
@classmethod
def main(cls, cmdline=1, **kwargs):
self = cls.cli(cmdline=cmdline, data=kwargs)
rich.print('Called My Script With: ' + rich.markup.escape(ub.urepr(self)))
if __name__ == '__main__':
MyConfig().main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment