Skip to content

Commit

Permalink
Merge pull request #88 from pawelzny/dev/poetry
Browse files Browse the repository at this point in the history
Move from pipenv to poetry and pyproject.toml
  • Loading branch information
pawelzny committed Jul 9, 2022
2 parents ae87e3f + a3f4b3f commit 44a1e5c
Show file tree
Hide file tree
Showing 24 changed files with 1,417 additions and 737 deletions.
8 changes: 8 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[bumpversion]
current_version = 1.3.0
commit = True
tag = True

[bumpversion:file:dotty_dict/__init__.py]

[bumpversion:file:docs/conf.py]
141 changes: 78 additions & 63 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,146 +1,161 @@
# Python CircleCI 2.0 configuration file
# Check https://circleci.com/docs/2.0/language-python/ for more details
version: 2
# Python CircleCI 2.1 configuration file
version: 2.1

defaults: &defaults
working_directory: ~/repo

read_cache: &read_cache
keys:
- v1-dependencies-{{ checksum "Pipfile.lock" }}
- v1-dependencies-{{ checksum "poetry.lock" }}
- v1-dependencies-

store_cache: &store_cache
paths:
- ./repo
key: v1-dependencies-{{ checksum "Pipfile.lock" }}
key: v1-dependencies-{{ checksum "poetry.lock" }}

run_tests: &run_tests
name: run tests
command: pipenv run pytest
command: poetry run pytest

install_deps: &install_deps
name: install dependencies
command: poetry install --no-root

jobs:
py35:
<<: *defaults
docker:
- image: circleci/python:3.5.6
- image: cimg/python:3.5.10
steps:
- checkout
- restore_cache: *read_cache
- run:
name: install dependencies
command: |
pipenv install --python 3.5 --ignore-pipfile
pipenv install --python 3.5 --dev --ignore-pipfile
- run: *install_deps
- save_cache: *store_cache
- run: *run_tests
py36:
<<: *defaults
docker:
- image: circleci/python:3.6.7
- image: cimg/python:3.6.15
steps:
- checkout
- restore_cache: *read_cache
- run:
name: install dependencies
command: |
pipenv install --python 3.6 --ignore-pipfile
pipenv install --python 3.6 --dev --ignore-pipfile
- run: *install_deps
- save_cache: *store_cache
- run: *run_tests
py37:
<<: *defaults
docker:
- image: circleci/python:3.7.1
- image: cimg/python:3.7.13
steps:
- checkout
- restore_cache: *read_cache
- run:
name: install dependencies
command: |
pipenv install --python 3.7 --ignore-pipfile
pipenv install --python 3.7 --dev --ignore-pipfile
- run: *install_deps
- save_cache: *store_cache
- run: *run_tests
py38:
<<: *defaults
docker:
- image: circleci/python:3.8.0a3
- image: cimg/python:3.8.13
steps:
- checkout
- restore_cache: *read_cache
- run:
name: install dependencies
command: |
pipenv install --python 3.8 --ignore-pipfile
pipenv install --python 3.8 --dev --ignore-pipfile
- run: *install_deps
- save_cache: *store_cache
- run: *run_tests

pypy35:
py39:
<<: *defaults
docker:
- image: cimg/python:3.9.13
steps:
- checkout
- restore_cache: *read_cache
- run: *install_deps
- save_cache: *store_cache
- run: *run_tests
py310:
<<: *defaults
docker:
- image: cimg/python:3.10.5
steps:
- checkout
- restore_cache: *read_cache
- run: *install_deps
- save_cache: *store_cache
- run: *run_tests
pypy38:
docker:
- image: pypy:3-5.10
- image: pypy:3.8-7.3.9
<<: *defaults
steps:
- checkout
- restore_cache: *read_cache
- run:
name: Install pipenv
command: pip install pipenv==11.7.4
- run:
name: Install missing libraries
command: |
pipenv --python `which pypy3` run pip install pathlib2
- run:
name: install dependencies
command: |
pipenv install --python `which pypy3` --ignore-pipfile
pipenv install --python `which pypy3` --dev --ignore-pipfile
command: pip install pytest
- save_cache: *store_cache
- run: *run_tests

- run:
name: run tests
command: pytest
pypy39:
docker:
- image: pypy:3.9-7.3.9
<<: *defaults
steps:
- checkout
- restore_cache: *read_cache
- run:
name: install dependencies
command: pip install pytest
- save_cache: *store_cache
- run:
name: run tests
command: pytest
flake8:
docker:
- image: circleci/python:3.6.4
- image: cimg/python:3.8.13
<<: *defaults
steps:
- checkout
- restore_cache: *read_cache
- run:
name: install dependencies
command: |
pipenv install --python 3.6 --ignore-pipfile
pipenv install --python 3.6 --dev --ignore-pipfile
- run: *install_deps
- save_cache: *store_cache
- run:
name: run tests
command: pipenv run flake8 vo tests

name: run flake8
command: poetry run flake8
docs:
docker:
- image: circleci/python:3.6.4
- image: cimg/python:3.8.13
<<: *defaults
steps:
- checkout
- restore_cache: *read_cache
- run: *install_deps
- run:
name: install dependencies
name: Install Sphinx
command: |
pipenv install --python 3.6 --ignore-pipfile
pipenv install --python 3.6 --dev --ignore-pipfile
sudo apt update
sudo apt install -y python3-sphinx python3-sphinx-rtd-theme
- save_cache: *store_cache
- run:
name: build docs
command: pipenv run make docs
name: run doctest
command: sphinx-build -aEW -b html -d docs/_build/doctrees docs docs/_build/html

workflows:
version: 2
test_all:
linters:
jobs:
- flake8
unit-tests:
jobs:
- py35
- py36
- py37
- py38
- pypy35
- flake8
- py39
- py310
- pypy38
- pypy39
release-dry-run:
jobs:
- docs
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ insert_final_newline = true
charset = utf-8
end_of_line = lf

[{LICENSE,Pipfile,Pipfile.lock}]
[{LICENSE,poetry.lock}]
insert_final_newline = false

[Makefile]
Expand Down
2 changes: 1 addition & 1 deletion AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Credits
Development
***********

* Paweł Zadrożny @pawelzny <pawel.zny@gmail.com>
* Pawel Zadrozny @pawelzny <pawel.zny@gmail.com>


************
Expand Down
21 changes: 14 additions & 7 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,30 +72,37 @@ Ready to contribute? Here's how to set up `dotty_dict` for local development.

$ git clone git@github.com:your_name_here/dotty_dict.git

3. Install your local copy into a virtualenv. Assuming you have PipEnv installed,
this is how you set up your fork for local development::
3. Install your local copy into a virtualenv. This is how you set up your fork for local development::

$ cd dotty_dict/
$ make install-dev
$ make install

or if you don't have 'make', do it manually::

$ cd dotty_dict/
$ pip install poetry==1.1.14
$ poetry install --no-root

4. Create a branch for local development::

$ git checkout -b name-of-your-bugfix-or-feature

Now you can make your changes locally.
Now you can introduce your changes locally.

5. When you're done making changes, check that your changes pass flake8 and the
tests, including testing other Python versions with tox::

$ make test-all

To get flake8 and tox, just pip install them into your virtualenv.
or if you don't have 'make', run tox directly::

$ poetry run tox --skip-missing-interpreters

6. Commit your changes and push your branch to GitHub::

$ git add .
$ git commit -m "Your detailed description of your changes."
$ git push origin name-of-your-bugfix-or-feature
$ git push origin HEAD

7. Submit a pull request through the GitHub website.

Expand All @@ -110,7 +117,7 @@ Before you submit a pull request, check that it meets these guidelines:
your new functionality into a function with a docstring, and add the
feature to the list in README.rst.
3. The pull request should work for:
**Python 3.5**, **Python 3.6**, and for **PyPy3.5-5.10**.
**Python >=3.5,<4.0** and for **>=PyPy3.8-7.3.9**.

Check https://circleci.com/gh/pawelzny/dotty_dict
and make sure that the tests pass for all supported Python versions.
19 changes: 13 additions & 6 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@

MIT License

Copyright (c) 2017, Paweł Zadrożny

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Copyright (c) 2017, Pawel Zadrozny

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following conditions:

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The above copyright notice and this permission notice shall be included in all copies
or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4 changes: 2 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ include CONTRIBUTING.rst
include LICENSE
include README.rst

include PipFile
include PipFile.lock
include pyproject.toml
include poetry.lock

recursive-exclude * __pycache__
recursive-exclude * *.py[co]
Expand Down
28 changes: 14 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ help:
@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-25s\033[0m %s\n", $$1, $$2}'

install: ## install dependencies
pipenv install
pipenv install --dev
pip install poetry==1.1.14
poetry install --no-root

clean: clean-build clean-pyc clean-cache

Expand All @@ -25,29 +25,29 @@ clean-cache: ## remove .cache and .pytest_cache
rm -rf .pytest_cache

lint: ## check style with flake8
pipenv run flake8
poetry run flake8

test: ## run tests quickly with the default Python
pipenv run pytest
poetry run pytest

test-all: ## run tests on every Python version with tox
pipenv run tox --skip-missing-interpreters
poetry run tox --skip-missing-interpreters

coverage: ## check code coverage quickly with the default Python
rm -rf htmlcov
pipenv run coverage erase
pipenv run coverage run -m pytest
pipenv run coverage report -m
pipenv run coverage html
poetry run coverage erase
poetry run coverage run -m pytest
poetry run coverage report -m
poetry run coverage html

docs: ## generate Sphinx HTML documentation, including API docs
pipenv run $(MAKE) -C docs clean
pipenv run $(MAKE) -C docs html
$(MAKE) -C docs clean
$(MAKE) -C docs html

release: sdist ## package and upload a release
pipenv run twine upload dist/*

sdist: clean ## package
pipenv run python setup.py sdist
gpg --detach-sign -a dist/*.tar.gz
build: clean ## package
poetry build
# gpg --detach-sign -a dist/*.tar.gz
ls -l dist

0 comments on commit 44a1e5c

Please sign in to comment.