Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poetry migration example #186

Closed
wants to merge 36 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
dd4f3d9
wip: add pyproject config file
Feb 4, 2022
8855afd
feat: poetry extras for the package
erickisos Feb 4, 2022
b82bf8f
fix: shortest representations for some deps
erickisos Feb 4, 2022
836fda3
feat: pre-commit suggestion
Feb 4, 2022
4336fa1
feat: lint and test jobs
Feb 4, 2022
c52d833
feat: dependabot to keep everything updated
Feb 4, 2022
1d548fe
fix: python location
Feb 4, 2022
ecf77a5
feat: type and pip checking
Feb 4, 2022
37b8346
fix: code quality runs on every branch except main
Feb 4, 2022
16d6cea
wip: build and release workflows
Feb 4, 2022
b625a55
feat: add build docs to code-quality workflow
Feb 4, 2022
bd26f40
fix: typo
Feb 4, 2022
1b7950c
fix: build docs
Feb 4, 2022
8ffc79c
move flake8 config to tox.ini
erickisos Feb 4, 2022
39e898e
add docs deps as optional
erickisos Feb 4, 2022
7caf5ce
feat: code-quality workflow
erickisos Feb 4, 2022
a2851d8
fix: python version
erickisos Feb 4, 2022
e88bba6
fix: python minors
erickisos Feb 4, 2022
12cf92b
build-and-release in terms of poetry
erickisos Feb 4, 2022
4749103
fix: tox config
erickisos Feb 4, 2022
e0550be
fix: build-docs
erickisos Feb 4, 2022
cd235f9
replace black with autopep8
erickisos Feb 4, 2022
9a50df7
fix: workflows
erickisos Feb 4, 2022
3012f12
fix: add cache check before install
erickisos Feb 4, 2022
ad2a4fb
minor fixes to avoid broken steps in workflow
erickisos Feb 4, 2022
d773658
fix: add cython to dependencies
Feb 4, 2022
b6837b4
fix: statsmodels
Feb 4, 2022
435c45e
wip: first step to install deps
Feb 4, 2022
86a126d
fix: cache is shared between jobs
Feb 4, 2022
5d1757a
short version to change cache
Feb 4, 2022
3f0114f
rollback to circleci
Mar 3, 2022
1d94a3a
fix: pipeline image
Mar 3, 2022
e92988f
fix: lack of alias
Mar 3, 2022
0608f80
fix: paths
Mar 3, 2022
17447ae
fix: build-docs
Mar 3, 2022
e9aa06a
wip: install all deps
Mar 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 40 additions & 101 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,178 +1,120 @@
.common-values:
version: 2.1
orbs:
python: circleci/python@2.0.2

.common-values:
docker-image: &docker-image circleci/python:3.6

docker-image-python39: &docker-image-python39 circleci/python:3.9

working_directory: &working-directory ~/repo

# Download and cache dependencies
restore-cache: &restore-cache
keys:
- v1-dependencies-{{ checksum "requirements.txt" }}

create-venv: &create-venv
name: Create virtualenv
command: . scripts/create_venv.sh

save-cache: &save-cache
paths:
- ./venv
key: v1-dependencies-{{ checksum "requirements.txt" }}

install-package: &install-package
name: Install package
command: |
. scripts/helpers.sh
install_package [devel]

install-pandoc: &install-pandoc
name: Install pandoc
command: sudo apt-get install pandoc
command: sudo apt-get install -y -qq pandoc

.master-branch-filter: &master-branch-filter
filters:
branches:
ignore: master

.requires-lint: &requires-lint
requires:
- lint
<<: *master-branch-filter

.tags-only-filter: &tags-only-filter
filters:
branches:
ignore: /.*/
tags:
only: /.*/

.requires-lint: &requires-lint
requires:
- lint
<<: *master-branch-filter

.requires-build: &requires-build
requires:
- build
<<: *tags-only-filter

.lint-steps: &lint-steps
docker:
- image: *docker-image
working_directory: *working-directory
executor: python/default
steps:
- checkout
- restore_cache: *restore-cache
- run: *create-venv
- python/install-packages:
pkg-manager: poetry
args: "-E all"
- run:
name: Check code style (PEP8)
command: . scripts/lint.sh
- save_cache: *save-cache
command: poetry run flake8 src tests

.test-steps: &test-steps
docker:
- image: *docker-image
working_directory: *working-directory
executor: python/default
steps:
- checkout
- restore_cache: *restore-cache
- run: *create-venv
- save_cache: *save-cache
- run: *install-package
- python/install-packages:
pkg-manager: poetry
- run:
name: Run tests
command: . scripts/run_tests.sh

.test-steps-python39: &test-steps-python39
<< : *test-steps
docker:
- image: *docker-image-python39
command: poetry run tox

.pip-check: &pip-check
docker:
- image: *docker-image
working_directory: *working-directory
executor: python/default
steps:
- checkout
- restore_cache: *restore-cache
- run: *create-venv
- save_cache: *save-cache
- run: *install-package
- python/install-packages:
pkg-manager: poetry
- run:
name: Run pip check
command: |
. scripts/helpers.sh
activate_venv
pip check
command: poetry run pip check

.build: &build
docker:
- image: *docker-image
working_directory: *working-directory
executor: python/default
steps:
- checkout
- restore_cache: *restore-cache
- run: *create-venv
- save_cache: *save-cache
- python/install-packages:
pkg-manager: poetry
- run:
name: Build package
command: . scripts/build.sh
command: poetry build
- persist_to_workspace:
root: ~/repo
root: .
paths:
- dist

.build-docs: &build-docs
docker:
- image: *docker-image
working_directory: *working-directory
executor: python/default
steps:
- checkout
- restore_cache: *restore-cache
- run: *create-venv
- save_cache: *save-cache
- python/install-packages:
pkg-manager: poetry
- run: *install-pandoc
- run: *install-package
- run:
name: Build documentation
command: . scripts/build_docs.sh
command: poetry run sphinx-build -b html source build

.release: &release
docker:
- image: *docker-image
working_directory: *working-directory
executor: python/default
steps:
- attach_workspace:
at: /tmp/package
- checkout
- restore_cache: *restore-cache
- run: *create-venv
- save_cache: *save-cache
- run:
name: init .pypirc
command: . scripts/init_pypirc.sh
- python/install-packages:
pkg-manager: poetry
- run:
name: Release package
command: . scripts/release.sh /tmp/package/dist
command: poetry publish -u $PYPI_USER -p $PYPI_PASSWORD

.type-check: &type-check
docker:
- image: *docker-image
working_directory: *working-directory
executor: python/default
steps:
- checkout
- restore_cache: *restore-cache
- run: *create-venv
- save_cache: *save-cache
- run: *install-package
- python/install-packages:
pkg-manager: poetry
- run:
name: Run type tests
command: . scripts/run_type_check.sh
command: poetry run mypy src tests

version: 2
jobs:
lint:
<<: *lint-steps
test:
<<: *test-steps
test-python39:
<<: *test-steps-python39
pip-check:
<<: *pip-check
build:
Expand All @@ -184,7 +126,6 @@ jobs:
type-check:
<<: *type-check


workflows:
version: 2
test-all:
Expand All @@ -193,8 +134,6 @@ workflows:
<<: *master-branch-filter
- test:
<<: *requires-lint
- test-python39:
<<: *requires-lint
- pip-check:
<<: *requires-lint
- type-check:
Expand Down
22 changes: 11 additions & 11 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
coverage:
range: 85..95
round: nearest
precision: 2
project:
default:
target: 95
base: auto
if_no_uploads: error
if_not_found: success
if_ci_failed: error
only_pulls: false
range: 85..95
round: nearest
precision: 2
project:
default:
target: 95
base: auto
if_no_uploads: error
if_not_found: success
if_ci_failed: error
only_pulls: false

comments: off
4 changes: 0 additions & 4 deletions .flake8

This file was deleted.

6 changes: 6 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
33 changes: 33 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
default_stages: [commit, push]
repos:
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
name: isort (python)
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: check-added-large-files
- id: debug-statements
- id: double-quote-string-fixer
- id: end-of-file-fixer
- id: mixed-line-ending
- id: check-yaml
- id: requirements-txt-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: "v1.6.0"
hooks:
- id: autopep8
- repo: https://github.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
name: flake8 (python)
- repo: https://github.com/myint/docformatter
rev: v1.4
hooks:
- id: docformatter
args: ["--wrap-descriptions", "0"]
8 changes: 0 additions & 8 deletions mypy.ini

This file was deleted.

Loading