Skip to content

Commit

Permalink
feat: migrate packaging to Poetry
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Stable release
  • Loading branch information
Bruno Alla authored and browniebroke committed Nov 11, 2020
1 parent 46184af commit 8ed12c8
Show file tree
Hide file tree
Showing 17 changed files with 1,320 additions and 238 deletions.
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
exclude = docs
max-line-length = 88
17 changes: 7 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: abatilo/actions-poetry@v2.1.0
- name: Install Dependencies
run: |
python -m pip install -U pip
pip install --use-feature=2020-resolver -r requirements.txt .
run: poetry install
- name: Test with Pytest
run: pytest
run: poetry run pytest --cov-report=xml
- uses: codecov/codecov-action@v1.0.14

lint:
Expand All @@ -43,7 +42,7 @@ jobs:
matrix:
linter:
- name: Flake8
run: flake8 --config=setup.cfg
run: flake8
- name: Black
run: black --check .
- name: PyUpgrade
Expand All @@ -57,16 +56,14 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: abatilo/actions-poetry@v2.1.0
- name: Install Dependencies
run: |
python -m pip install -U pip
pip install --use-feature=2020-resolver -r requirements.txt .
run: poetry install
- name: ${{ matrix.linter.name }}
run: ${{ matrix.linter.run }}
run: poetry run ${{ matrix.linter.run }}

# Make sure commit messages follow the conventional commits convention:
# https://www.conventionalcommits.org

commitlint:
name: Lint Commit Messages
runs-on: ubuntu-latest
Expand Down
10 changes: 1 addition & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v4.0.0
hooks:
- id: commitlint
stages: [ commit-msg ]
additional_dependencies: ['@commitlint/config-conventional']
- repo: https://github.com/asottile/pyupgrade
rev: v2.7.3
hooks:
Expand All @@ -23,8 +17,7 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.3.0
hooks:
# disabled due to bump2commit compatibility
# - id: trailing-whitespace
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-json
Expand All @@ -33,4 +26,3 @@ repos:
rev: 3.8.4
hooks:
- id: flake8
args: [--config=setup.cfg]
3 changes: 2 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ sphinx:
python:
version: 3.8
install:
- requirements: docs/requirements.txt
- method: pip
path: .
extra_requirements:
- docs
50 changes: 25 additions & 25 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ You can contribute in many ways:

### Report Bugs

Report bugs at <https://github.com/browniebroke/django-codemod/issues>.
Report bugs at [on our issue tracker][bug-tracker].

If you are reporting a bug, please include:

Expand All @@ -18,23 +18,19 @@ If you are reporting a bug, please include:

### Fix Bugs

Look through the GitHub issues for bugs. Anything tagged with "bug"
and "help wanted" is open to whoever wants to implement it.
Look through the GitHub issues for bugs. Anything tagged with "bug" and "help wanted" is open to whoever wants to implement it.

### Implement Features

Look through the GitHub issues for features. Anything tagged with
"enhancement" and "help wanted" is open to whoever wants to
implement it.
Look through the GitHub issues for features. Anything tagged with "enhancement" and "help wanted" is open to whoever wants to implement it.

### Write Documentation

Django Codemod could always use more documentation, whether as part of the official Django Codemod docs, in docstrings, or even on the web in blog posts, articles, and such.

### Submit Feedback

The best way to send feedback is to file an issue at
<https://github.com/browniebroke/django-codemod/issues>.
The best way to send feedback is [to file an issue on Github][bug-tracker].

If you are proposing a feature:

Expand All @@ -44,25 +40,25 @@ If you are proposing a feature:

## Get Started!

Ready to contribute? Here's how to set up `django_codemod`
Ready to contribute? Here's how to set up `django-codemod`
for local development.

1. Fork the `django_codemod` repo on GitHub.
1. Fork the `django-codemod` repo on GitHub.

2. Clone your fork locally:

```shell
$ git clone git@github.com:your_name_here/django-codemod.git
```

3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:
3. Make sure you have [Poetry] installed, and from the root of the project run:

```shell
$ mkvirtualenv django_codemod
$ cd django-codemod/
$ python setup.py develop
$ poetry install
```

This will install all the needed dependencies for development in an isolated environment.

4. Create a branch for local development:

```shell
Expand All @@ -71,16 +67,13 @@ for local development.

Now you can make 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:
5. When you're done making changes, check that your the tests are passing:
```shell
$ flake8 django_codemod tests
$ pytest
$ tox
$ poetry run pytest
```
To get flake8 and tox, pip install them into your virtualenv.
Please write tests for any new feature or bug fix, we aim to keep 100% code coverage.
6. Commit your changes and push your branch to GitHub:
Expand All @@ -89,19 +82,26 @@ for local development.
$ git commit -m "feat(something): your detailed description of your changes"
$ git push origin name-of-your-bugfix-or-feature
```
Note: the commit message should follow [the conventional commits guidelines](https://www.conventionalcommits.org), this is to enable the automation of releases. We run [`commitlint` on CI](https://github.com/marketplace/actions/commit-linter) which will validate the commit messages.
Note: the commit message should follow [the conventional commits guidelines][conv-commits], this is to enable the automation of releases. We run [`commitlint` on CI][commitlint] which will validate the commit messages.
7. Submit a pull request through the GitHub website.
## Pull Request Guidelines
Before you submit a pull request, check that it meets these guidelines:
When you submit a pull request, check that it meets these guidelines:
1. The pull request should include tests.
2. If the pull request adds functionality, the docs should be updated. Put 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.6, 3.7 and 3.8. Check the build on Github and make sure that the tests pass for all supported Python versions.
3. The pull request should work for Python 3.6, 3.7, 3.8 and 3.9. Check the build on Github and make sure that the tests pass for all supported Python versions.
## Deploying
The deployment should be automated and can be triggered from the Semantic Release workflow in Github. The next version will be based on [the commit logs](https://python-semantic-release.readthedocs.io/en/latest/commit-log-parsing.html#commit-log-parsing). This is done by [python-semantic-release](https://python-semantic-release.readthedocs.io/en/latest/index.html) via a Github action.
The deployment should be automated and can be triggered from the Semantic Release workflow in Github. The next version will be based on [the commit logs][commit-log-parsing]. This is done by [python-semantic-release][psr] via a Github action.
[bug-tracker]: https://github.com/browniebroke/django-codemod/issues
[Poetry]: https://python-poetry.org/
[conv-commits]: https://www.conventionalcommits.org
[commitlint]: https://github.com/marketplace/actions/commit-linter
[commit-log-parsing]: https://python-semantic-release.readthedocs.io/en/latest/commit-log-parsing.html#commit-log-parsing
[psr]: https://python-semantic-release.readthedocs.io
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
<a href="https://codecov.io/gh/browniebroke/django-codemod">
<img src="https://img.shields.io/codecov/c/github/browniebroke/django-codemod.svg?logo=codecov&logoColor=fff&style=flat-square" alt="Test coverage percentage">
</a>
</p>
<p align="center">
<a href="https://python-poetry.org/">
<img src="https://img.shields.io/badge/packaging-poetry-299bd7?style=flat-square&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAASCAYAAABrXO8xAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJJSURBVHgBfZLPa1NBEMe/s7tNXoxW1KJQKaUHkXhQvHgW6UHQQ09CBS/6V3hKc/AP8CqCrUcpmop3Cx48eDB4yEECjVQrlZb80CRN8t6OM/teagVxYZi38+Yz853dJbzoMV3MM8cJUcLMSUKIE8AzQ2PieZzFxEJOHMOgMQQ+dUgSAckNXhapU/NMhDSWLs1B24A8sO1xrN4NECkcAC9ASkiIJc6k5TRiUDPhnyMMdhKc+Zx19l6SgyeW76BEONY9exVQMzKExGKwwPsCzza7KGSSWRWEQhyEaDXp6ZHEr416ygbiKYOd7TEWvvcQIeusHYMJGhTwF9y7sGnSwaWyFAiyoxzqW0PM/RjghPxF2pWReAowTEXnDh0xgcLs8l2YQmOrj3N7ByiqEoH0cARs4u78WgAVkoEDIDoOi3AkcLOHU60RIg5wC4ZuTC7FaHKQm8Hq1fQuSOBvX/sodmNJSB5geaF5CPIkUeecdMxieoRO5jz9bheL6/tXjrwCyX/UYBUcjCaWHljx1xiX6z9xEjkYAzbGVnB8pvLmyXm9ep+W8CmsSHQQY77Zx1zboxAV0w7ybMhQmfqdmmw3nEp1I0Z+FGO6M8LZdoyZnuzzBdjISicKRnpxzI9fPb+0oYXsNdyi+d3h9bm9MWYHFtPeIZfLwzmFDKy1ai3p+PDls1Llz4yyFpferxjnyjJDSEy9CaCx5m2cJPerq6Xm34eTrZt3PqxYO1XOwDYZrFlH1fWnpU38Y9HRze3lj0vOujZcXKuuXm3jP+s3KbZVra7y2EAAAAAASUVORK5CYII=" alt="Poetry">
</a>
<a href="https://github.com/ambv/black">
<img src="https://img.shields.io/badge/code%20style-black-000000.svg?amp;style=flat-square" alt="black">
</a>
Expand Down
4 changes: 0 additions & 4 deletions django_codemod/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
"""Top-level package for Django Codemod."""

__author__ = """Bruno Alla"""
__email__ = "alla.brunoo@gmail.com"
__version__ = "0.21.0"
2 changes: 1 addition & 1 deletion django_codemod/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def _split_digits(self, value, param, ctx):

@click.group()
def djcodemod():
"""CLI entry point."""
"""Automatically fix Django deprecations."""


@djcodemod.command()
Expand Down
3 changes: 0 additions & 3 deletions docs/requirements.in

This file was deleted.

38 changes: 0 additions & 38 deletions docs/requirements.txt

This file was deleted.

Loading

0 comments on commit 8ed12c8

Please sign in to comment.