Skip to content

Commit

Permalink
[chore] Switches to using poetry for project management
Browse files Browse the repository at this point in the history
  • Loading branch information
ravenoak committed Sep 25, 2023
1 parent 1c09fff commit 5027e88
Show file tree
Hide file tree
Showing 9 changed files with 854 additions and 383 deletions.
158 changes: 6 additions & 152 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,84 +1,4 @@
version: 2.1

commands:

bumpversion:
description: "Uses bump2version to increase version number"
parameters:
version_part:
type: enum
enum: ['major', 'minor', 'patch', 'pre_release', 'pre_release_num']
bump_options:
type: string
default: '--no-tag --commit -m "Bump version: {current_version} → {new_version} [ci skip]"'
steps:
- restore_cache:
key: v1-bumpversion
- run:
name: Install/Upgrade bumpversion
command: |
python3 -m venv venv
. venv/bin/activate
pip3 install -U bump2version
- save_cache:
key: v1-bumpversion
paths:
- "venv"
- run:
name: Bumpversion
command: |
git config --global user.email "git-robot@virtualxistenz.com"
git config --global user.name "Git Robot"
. venv/bin/activate
python3 setup.py --version
bumpversion << parameters.bump_options >> << parameters.version_part >>
python3 setup.py --version
git log -n 1
- run:
name: Push version bump
command: |
git push -u origin $CIRCLE_BRANCH
publish:
description: "Uses twine to publish packages to PyPI"
parameters:
verify_tag:
type: boolean
default: false
steps:
- restore_cache:
keys:
- v1-release-{{ .Branch }}-{{ checksum "requirements.txt" }}
- v1-dependency-cache-{{ .Branch }}-{{ checksum "requirements.txt" }}-py38
- run:
name: Install/Upgrade release requirements
command: |
python3 -m venv venv
. venv/bin/activate
pip3 install -U -r requirements.txt
pip3 install -U wheel
pip3 install -U twine
- save_cache:
key: v1-release-{{ .Branch }}-{{ checksum "requirements.txt" }}
paths:
- "venv"
- when:
condition: << parameters.verify_tag >>
steps:
- run:
name: Verify git tag vs. package version
command: |
. venv/bin/activate
python setup.py verify
- run:
name: Publish to PyPI
command: |
. venv/bin/activate
python3 setup.py sdist
python3 setup.py bdist_wheel
twine upload dist/*
jobs:

install_deps_py38:
Expand All @@ -87,15 +7,13 @@ jobs:
steps:
- checkout
- restore_cache:
key: v1-dependency-cache-{{ .Branch }}-{{ checksum "requirements.txt" }}
key: v1-dependency-cache-{{ .Branch }}-{{ checksum "poetry.lock" }}-py38
- run:
name: Install package dependencies
command: |
python3 -m venv venv
. venv/bin/activate
pip3 install -U -r requirements.txt
poetry install
- save_cache:
key: v1-dependency-cache-{{ .Branch }}-{{ checksum "requirements.txt" }}-py38
key: v1-dependency-cache-{{ .Branch }}-{{ checksum "poetry.lock" }}-py38
paths:
- "venv"

Expand All @@ -107,86 +25,22 @@ jobs:
steps:
- checkout
- restore_cache:
key: v1-dependency-cache-{{ .Branch }}-{{ checksum "requirements.txt" }}-py38
key: v1-dependency-cache-{{ .Branch }}-{{ checksum "poetry.lock" }}-py38
- run:
name: Run tests
command: |
. venv/bin/activate
python3 setup.py test
poetry run pytest
- store_test_results:
path: test-reports
- store_artifacts:
path: test-reports
- run:
name: Smoke Test Install
command: |
. venv/bin/activate
python3 --version
python3 setup.py install
bump_publish_dev:
docker:
- image: cimg/python:3.8
environment:
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
steps:
- checkout
- publish
- bumpversion:
version_part: pre_release_num

bump_publish_release:
docker:
- image: cimg/python:3.8
steps:
- checkout
- publish
- bumpversion:
version_part: pre_release_num

publish_prod_tag:
docker:
- image: cimg/python:3.8
steps:
- checkout
- publish:
verify_tag: true

workflows:
version: 2

build_test_publish_py38:
jobs:
- install_deps_py38:
filters:
tags:
only: /.*/
- install_deps_py38
- unittest_py38:
requires:
- install_deps_py38
filters:
tags:
only: /.*/
- bump_publish_dev:
context: Test PyPI
requires:
- unittest_py38
filters:
branches:
only: develop
- bump_publish_release:
context: Prod PyPI
requires:
- unittest_py38
filters:
branches:
only: /^release\/.*/
- publish_prod_tag:
context: Prod PyPI
requires:
- unittest_py38
filters:
tags:
only: /^v[0-9]+(\.[0-9]+)+$/
branches:
ignore: /.*/
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

0 comments on commit 5027e88

Please sign in to comment.