Skip to content

Commit

Permalink
Merge pull request #78 from vintasoftware/feat/poetry
Browse files Browse the repository at this point in the history
Replace `pip-tools` with `poetry`
  • Loading branch information
pamella authored May 27, 2024
2 parents 575b1e9 + bb0859b commit 2a339b7
Show file tree
Hide file tree
Showing 18 changed files with 2,198 additions and 701 deletions.
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ docs/modules.rst
docs/drf_rw_serializers.rst
docs/drf_rw_serializers.*.rst

# Private requirements
requirements/private.in
requirements/private.txt

# tox environment temporary artifacts
tests/__init__.py

Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ repos:
pass_filenames: true
- id: missing-migrations
name: missing-migrations-local
entry: pipenv run python manage.py makemigrations --check
entry: poetry run python manage.py makemigrations --check
language: system
always_run: true
pass_filenames: false
Expand Down
36 changes: 0 additions & 36 deletions .ruff.toml

This file was deleted.

40 changes: 14 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,59 +31,47 @@ clean: ## remove generated byte code, coverage reports, and build artifacts
rm -fr *.egg-info

coverage: clean ## generate and view HTML coverage report
py.test --cov-report html
poetry run pytest --cov-report html
$(BROWSER) htmlcov/index.html

docs: ## generate Sphinx HTML documentation, including API docs
rm -f docs/drf-rw-serializers.rst
rm -f docs/modules.rst
sphinx-apidoc -o docs/ drf_rw_serializers
poetry run sphinx-apidoc -o docs/ drf_rw_serializers
$(MAKE) -C docs clean
$(MAKE) -C docs html
$(BROWSER) docs/_build/html/index.html


upgrade: ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
pip install -q pip-tools
pip-compile --upgrade -o requirements/dev.txt requirements/base.in requirements/dev.in requirements/quality.in
pip-compile --upgrade -o requirements/doc.txt requirements/base.in requirements/doc.in
pip-compile --upgrade -o requirements/quality.txt requirements/quality.in
pip-compile --upgrade -o requirements/test.txt requirements/base.in requirements/test.in
# Let tox control the Django version for tests
sed '/^django==/d' requirements/test.txt > requirements/test.tmp
mv requirements/test.tmp requirements/test.txt

upgrade_private: ## update requirements/private.txt with the latest packages satisfying requirements/private.in
pip install -q pip-tools
pip-compile --upgrade -o requirements/private.txt requirements/private.in
upgrade: ## update the dependencies in pyproject.toml with the latest versions
poetry update

quality: ## check coding style with pycodestyle and pylint
tox -e quality
poetry run tox -e quality

requirements: ## install development environment requirements
pip install -qr requirements/dev.txt --exists-action w
pip-sync requirements/dev.txt requirements/private.txt requirements/test.txt
poetry install

test: clean ## run tests in the current virtualenv
py.test
poetry run pytest

diff_cover: test
diff-cover coverage.xml
poetry run diff-cover coverage.xml

test-all: ## run tests on every supported Python/Django combination
tox -e quality
tox
poetry run tox -e quality
poetry run tox

validate: quality test ## run tests and quality checks

selfcheck: ## check that the Makefile is well-formed
@echo "The Makefile is well-formed."

release: clean ## package and upload a release
python setup.py sdist
python setup.py bdist_wheel
twine upload dist/*
poetry build
poetry run twine check dist/*
poetry run twine upload dist/*

sdist: clean ## package
python setup.py sdist
poetry build
ls -l dist
2,086 changes: 2,086 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

78 changes: 78 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
[tool.poetry]
name = "drf-rw-serializers"
version = "1.1.1"
description = "Generic views, viewsets and mixins that extend the Django REST Framework ones adding separated serializers for read and write operations"
authors = ["Vinta Software <[email protected]>"]
license = "MIT"
readme = "README.rst"

[tool.poetry.dependencies]
python = "^3.8"
djangorestframework = "^3.15.1"


[tool.poetry.group.dev.dependencies]
django = "^4.2"
tox = "^4.15.0"
wheel = "^0.43.0"
docutils = "^0.20.1"
twine = "^5.1.0"
ruff = "^0.4.5"
prospector = "^1.10.3"


[tool.poetry.group.test.dependencies]
pytest-cov = "^5.0.0"
pytest-django = "^4.8.0"
model-bakery = "^1.18.0"
pytest = "^8.2.1"


[tool.poetry.group.docs.dependencies]
django = "^4.2"
doc8 = "^1.1.1"
readme-renderer = "^43.0"
sphinx = "7.1.2"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.ruff]
exclude = [
"env",
"venv",
".pyenv",
".pytest_cache",
"*/__pycache__/*",
"*/migrations/*",
"docs",
]
line-length = 100
target-version = "py38"

[tool.ruff.format]
quote-style = "double"
indent-style = "space"
line-ending = "auto"

[tool.ruff.lint]
extend-select = [
# isort
"I",
]

[tool.ruff.lint.isort.sections]
django = ["django"]
drf = ["rest_framework"]

[tool.ruff.lint.isort]
section-order = [
"future",
"standard-library",
"django",
"drf",
"third-party",
"first-party",
"local-folder",
]
3 changes: 0 additions & 3 deletions requirements/base.in

This file was deleted.

9 changes: 0 additions & 9 deletions requirements/dev.in

This file was deleted.

Loading

0 comments on commit 2a339b7

Please sign in to comment.