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

Add poetry support; drop pipenv support; bump version #544

Merged
merged 3 commits into from
Oct 13, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
13 changes: 6 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
init:
pipenv install --dev
pipenv run pip install -e .
poetry install -e test

build:
python setup.py compile_catalog
python setup.py bdist_wheel
poetry run pybabel compile --domain django --directory djoser/locale
poetry build

test:
pipenv run py.test --capture=no --cov-report term-missing --cov-report html --cov=djoser testproject/
poetry run py.test --capture=no --cov-report term-missing --cov-report html --cov=djoser testproject/

migrate:
pipenv run python testproject/manage.py migrate
poetry run python testproject/manage.py migrate

runserver:
pipenv run python testproject/manage.py runserver
poetry run python testproject/manage.py runserver
67 changes: 54 additions & 13 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ Requirements

To be able to run **djoser** you have to meet following requirements:

- Python (3.5, 3.6, 3.7, 3.8)
- Django (1.11, 2.2, 3.1)
- Django REST Framework (3.9, 3.10, 3.11.1)
- Python (3.6, 3.7, 3.8)
- Django (2.2, 3.1)
- Django REST Framework 3.11.1

If you need to support other versions, please use djoser<2.

Expand Down Expand Up @@ -74,40 +74,81 @@ To start developing on **djoser**, clone the repository:

$ git clone [email protected]:sunscrapers/djoser.git

If you are a **pipenv** user you can quickly setup testing environment by
using Make commands:
We use `poetry <https://python-poetry.org/>`_ as dependency management and packaging tool.

.. code-block:: bash

$ cd djoser
$ poetry install

This will create a virtualenv with all development dependencies.

To activate the virtual environment run

.. code-block:: bash

$ poetry shell

To run tests outside of tox, install test dependencies with:

..code-block:: bash

$ poetry install -e test

We also preapred a convenient ``Makefile``

.. code-block:: bash

$ make init
$ make test

Otherwise, if you cannot use Make commands, please create virtualenv and install
requirements manually:
Without poetry
--------------

New versions of ``pip`` can use ``pyproject.toml`` to build the package and install its dependencies.

.. code-block:: bash

$ pip install django djangorestframework
$ pip install -r requirements.txt
$ pip install .

.. code-block:: bash

$ cd testproject
$ ./manage.py test

Tox
---

If you need to run tests against all supported Python and Django versions then invoke:

.. code-block:: bash

$ pip install tox
$ tox -p all
$ poetry run tox -p all

Example project
---------------

You can also play with test project by running following commands:

.. code-block:: bash

$ ./manage.py migrate
$ ./manage.py runserver
$ make migrate
$ make runserver

Commiting your code
-------------------

Before sending patches please make sure you have `pre-commit <https://pre-commit.com/>`_ activated in your local git repository:

.. code-block:: bash

$ pre-commit install

This will ensure that your code is cleaned before you commit it.
Some steps (like black) automatically fix issues but the show their status as FAILED.
Just inspect if eveything is OK, git-add the files and retry the commit.
Other tools (like flake8) require you to manually fix the issues.


Similar projects
================
Expand Down
Loading