Skip to content

Commit

Permalink
Switch to poetry and update some versions.
Browse files Browse the repository at this point in the history
This switches completely to poetry even in the travis testing.  It
integrates more easily with Nix and even has a built in package
definition.
  • Loading branch information
alunduil committed Oct 19, 2020
1 parent f7e66b2 commit e5d18d1
Show file tree
Hide file tree
Showing 45 changed files with 839 additions and 221 deletions.
11 changes: 7 additions & 4 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
layout_python3
use nix
watch_file nix/shell.nix
watch_file nix/default.nix
watch_file pyproject.toml
watch_file poetry.lock

pip install -r requirements.txt

watch_file requirements.txt
# Used by pre-commit
layout python3
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
max-line-length = 120
57 changes: 39 additions & 18 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
.direnv/
.shadows/

# Created by https://www.gitignore.io/api/python
# Created by https://www.toptal.com/developers/gitignore/api/python,direnv
# Edit at https://www.toptal.com/developers/gitignore?templates=python,direnv

### direnv ###
.direnv
.envrc

### Python ###
# Byte-compiled / optimized / DLL files
Expand All @@ -26,6 +29,8 @@ parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
Expand All @@ -44,14 +49,17 @@ pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
pytestdebug.log

# Translations
*.mo
Expand All @@ -61,6 +69,7 @@ coverage.xml
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
Expand All @@ -71,18 +80,34 @@ instance/

# Sphinx documentation
docs/_build/
doc/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# celery beat schedule file
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py
Expand All @@ -95,6 +120,7 @@ venv/
ENV/
env.bak/
venv.bak/
pythonenv*

# Spyder project settings
.spyderproject
Expand All @@ -108,21 +134,16 @@ venv.bak/

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

### Python Patch ###
.venv/
# Pyre type checker
.pyre/

### Python.VirtualEnv Stack ###
# Virtualenv
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
[Bb]in
[Ii]nclude
[Ll]ib
[Ll]ib64
[Ll]ocal
[Ss]cripts
pyvenv.cfg
pip-selfcheck.json
# pytype static type analyzer
.pytype/

# profiling data
.prof

# End of https://www.gitignore.io/api/python
# End of https://www.toptal.com/developers/gitignore/api/python,direnv
54 changes: 13 additions & 41 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.1.0
rev: v3.2.0
hooks:
- id: check-added-large-files
- id: check-merge-conflict
Expand All @@ -12,54 +12,26 @@ repos:
- id: end-of-file-fixer
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
rev: 0.1.0
hooks:
- id: yamlfmt
- repo: https://github.com/psf/black
rev: 19.10b0
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.782
rev: v0.790
hooks:
- id: mypy
additional_dependencies:
- hypothesis
exclude: ^setup\.py$
- repo: https://github.com/doublify/pre-commit-isort
rev: v4.3.0
hooks:
- id: isort
args:
- -m3
- -tc
- -l 120
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.3
- repo: https://github.com/pycqa/pydocstyle
rev: 4.0.0 # pick a git hash / tag to point to
hooks:
- id: flake8
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
rev: 0.0.11
hooks:
- id: yamlfmt
- repo: local
hooks:
- id: pytest
name: pytest
entry: pytest
language: python
files: ^zfs.*?\.py$
additional_dependencies:
- click
- hypothesis
- pre-commit
- pytest
- pytest-cov
- stringcase
pass_filenames: false
- id: vulture
name: vulture
entry: vulture
args:
- --min-confidence=61
- --exclude=zfs/replicate/cli/click.py
- --ignore-names=main
language: python
files: .*\.py
- id: pydocstyle
39 changes: 28 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,51 @@ python:
- '3.6' # EOL 2021-12-23
- '3.7' # EOL 2023-06-27
- '3.8' # EOL 2024-10
- 3.9-dev # RC1 2020-09-10
- 3.9-dev # EOL 2025-10
- nightly
matrix:
allow_failures:
- python: 3.9-dev
- python: nightly
fast_finish: true

cache:
directores:
pip: true
directories:
- $HOME/.cache/pre-commit

install:
- pip install -qU --compile pip
- pip install -r requirements.txt
- pip install --upgrade pip
- pip install pre-commit
- pre-commit install-hooks
- pip install poetry
- poetry install -v

script:
- python setup.py sdist
- pip install .
- pre-commit run --all-files
- vulture --min-confidence=61 --exclude=zfs/replicate/cli/click.py --ignore-names=main zfs
- zfs-replicate --help
- pytest
- poetry build
- tar -zvtf dist/zfs-replicate-*.tar.gz | grep zfs/replicate/

after_success:
- coveralls

before_deploy:
# User and password environment variables are set as hidden variables through
# the web interface in the project settings.
- pip install --upgrade pip
- pip install poetry
- poetry config http-basic.pypi $PYPI_USER $PYPI_PASS
- poetry build

deploy:
provider: pypi
user: alunduil
password:
secure: Kcsqc4VJM2uzhwd2xw3uByM0zLibN03Aq/lRMvcNSJbdwfL7Mfz9RaO6hMzfQYrcndO4MH8iYZxVbnh+xQSo52PBCIBeitbcwmdco6BWRF0Y9APo+t1koJ8fw+Zms4Tb+B4lMeYXoil5+hySv5sVlbAUaZyMgm+cm5ccennyTsxcrV3rU8JG0jND9WonXcvVWuV2LnLM8+FAdb5Habbfbus98KQTQjj4Acsq2xuoWq5i8DYAVteMe7j/Oazpb4/BXoyK7/bNLnzZ3wM/E9gzb6ZZy6gkd36T7s691BVDCMmLnIJpwRxBq4H+4DeM0SigzqpItk0Sunnw2wI/C44/q9LA6h3VOKEQAGkLALV5c6pq61TxvO7Sw2e7hoLSZk5F3abHYh6Ka6NivMfoQldCOIo46HdUOetEQEeHvrzRHsi6sVRtiKddgBZQMB0ULmSy9AFNa4HVU9JSPa5+Z0e+smrykQmpwj0GzWPW2s4Y4uc/qnNCCoO1ZS+8+Qfjvy2R1H/y0lRnmusnalbvZc8hShRSWKhpXe7WWMOJMaQ0a0xebM+RmmKdFrhtDUf8iDwoXfbBh+FDhKhoBsEolB9C+CXZZ4JPhR12Rww1t2qOS3EfM28kNGPidHrMLEEmcC0B7XD4Kz6ZlO83MXumTxvyHJ9i6D9VoCIwgZNSamkZi68=
provider: script
script: poetry publish
skip_cleanup: true
on:
all_branches: true # Travis recognizes tag names as "branches"
condition: $TRAVIS_BUILD_STAGE_NAME = Deploy
repo: alunduil/zfs-replicate
tags: true
python: '3.6'
6 changes: 0 additions & 6 deletions MANIFEST.in

This file was deleted.

6 changes: 6 additions & 0 deletions nix/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
let
pkgs = import <nixpkgs> {};
in
pkgs.poetry2nix.mkPoetryApplication {
projectDir = ../.;
}
12 changes: 12 additions & 0 deletions nix/shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
let
pkgs = import <nixpkgs> {};
cron-install = import ./default.nix;
in
pkgs.mkShell {
buildInputs = [
cron-install
pkgs.poetry
pkgs.python3
pkgs.python37Packages.virtualenv
];
}
Loading

0 comments on commit e5d18d1

Please sign in to comment.