Skip to content

Commit 1767506

Browse files
committed
Introduce poetry and poethepoet
1 parent 7fcafa7 commit 1767506

File tree

27 files changed

+1734
-197
lines changed

27 files changed

+1734
-197
lines changed

.coveragerc

Lines changed: 0 additions & 2 deletions
This file was deleted.

.github/CONTRIBUTING.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,28 @@ Follow the following steps to get started contributing to this project.
1616
git checkout -b name-of-your-bugfix-or-feature
1717

1818
3. Create a virtual environment of your choice and activate it.
19-
4. Install the dependencies via pip and run the migrations for django application.
19+
4. Install the dependencies via poetry and activate poetry virtual environment.
2020

21-
make
21+
poetry install
22+
poetry shell
2223

23-
5. Now you can run the django application on localhost:8000 to see the changes you make in action real-time.
24+
5. Run the migrations for django application.
2425

25-
make dev
26+
python dev/manage.py migrate
27+
28+
6. Press F5 if you are using vscode to start the application debugger.
29+
7. Otherwise you can run the django application on localhost:8000 to see the changes you make in action real-time.
30+
31+
python dev/manage.py runserver
2632

2733

2834
## Testing
2935

3036
1. Run the tests by the following command.
3137

32-
make test
38+
pytest
3339

3440
2. See the coverage report by the following command.
3541

36-
make coverage
42+
poe coverage
3743

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
custom: ['https://www.buymeacoffee.com/monim67']

.github/workflows/build.yml

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,37 @@ name: build
22

33
on:
44
push:
5-
branches: ['*']
5+
branches: ["*"]
66
pull_request:
77

88
jobs:
99
build:
1010
if: "!contains(github.event.head_commit.message, 'skip-ci')"
1111
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.10", "3.9", "3.8", "3.7"]
1215
steps:
13-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v3
1417

15-
- name: Set up Python 3.6
16-
uses: actions/setup-python@v2
18+
- name: Install poetry
19+
run: pipx install poetry
20+
21+
- uses: actions/setup-python@v3
1722
with:
18-
python-version: '3.6'
23+
python-version: ${{ matrix.python-version }}
24+
cache: poetry
1925

20-
- name: Install
21-
run: python3 -m pip install -r requirements/build.txt
26+
- name: Install dependencies
27+
run: |
28+
poetry env use ${{ matrix.python-version }}
29+
poetry install --no-interaction
2230
2331
- name: Lint
24-
run: make lint
32+
run: poetry run poe lint
2533

26-
- name: Test & Coverage
27-
run: make coverage
34+
- name: Test Coverage
35+
run: poetry run coverage run
2836

2937
- name: Coveralls.io notification
3038
uses: AndreMiras/coveralls-python-action@develop
@@ -36,7 +44,7 @@ jobs:
3644
needs: build
3745
runs-on: ubuntu-latest
3846
steps:
39-
- name: Coveralls Finished
40-
uses: AndreMiras/coveralls-python-action@develop
41-
with:
42-
parallel-finished: true
47+
- name: Coveralls Finished
48+
uses: AndreMiras/coveralls-python-action@develop
49+
with:
50+
parallel-finished: true

.github/workflows/deploy.yml

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: deploy
1+
name: Deploy to PyPI
22

33
on:
44
release:
@@ -7,21 +7,26 @@ on:
77
jobs:
88
deploy:
99
runs-on: ubuntu-latest
10+
env:
11+
POETRY_VIRTUALENVS_CREATE: "false"
1012
steps:
11-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v3
1214

13-
- name: Set up Python 3.6
14-
uses: actions/setup-python@v2
15-
with:
16-
python-version: '3.6'
15+
- name: Install poetry
16+
run: pipx install poetry
1717

18-
- name: Install dependencies
19-
run: 'python -m pip install build wheel --user'
18+
- uses: actions/setup-python@v3
19+
with:
20+
python-version: "3.10"
2021

21-
- name: Build
22-
run: make build
22+
- name: Build
23+
run: |
24+
poetry version ${{ github.ref_name }}
25+
sed -i "" "s/\[tool.poetry.dependencies\]/[tool.poetry.group.excluded.dependencies]/" pyproject.toml
26+
sed -i "" "s/\[tool.poetry.group.pypi.dependencies\]/[tool.poetry.dependencies]/" pyproject.toml
27+
poetry build
2328
24-
- name: Publish to PyPI
25-
uses: pypa/gh-action-pypi-publish@master
26-
with:
27-
password: ${{ secrets.PYPI_API_TOKEN }}
29+
- name: Publish
30+
run: |
31+
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
32+
poetry publish

.gitignore

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
1-
/venv*
2-
.vscode
1+
/tmp
32
node_modules
43
db.sqlite3
54
docs/_build
6-
docs/pydoc.io/autoapi
75

86
# Byte-compiled / optimized / DLL files
97
__pycache__/
108
.pytest_cache/
119
*.py[cod]
1210
*$py.class
1311

12+
# IDE - VSCode
13+
.vscode/*
14+
!.vscode/settings.json
15+
!.vscode/tasks.json
16+
!.vscode/launch.json
17+
!.vscode/extensions.json
18+
.history/*
19+
1420
# Unit test / coverage reports
1521
htmlcov/
1622
.tox/

.pylintrc

Lines changed: 0 additions & 11 deletions
This file was deleted.

.vscode/launch.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Django: runserver",
9+
"type": "python",
10+
"request": "launch",
11+
"program": "${workspaceFolder}/dev/manage.py",
12+
"args": [
13+
"runserver"
14+
],
15+
"django": true,
16+
"justMyCode": true
17+
},
18+
]
19+
}

.vscode/settings.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"python.formatting.provider": "black",
3+
"python.testing.pytestEnabled": true,
4+
"python.testing.unittestEnabled": false,
5+
"[python]": {
6+
"editor.formatOnSave": true,
7+
"editor.codeActionsOnSave": {
8+
"source.organizeImports": true,
9+
}
10+
},
11+
"yaml.schemas": {
12+
"https://json.schemastore.org/github-workflow.json": ".github/workflows/*.yml"
13+
},
14+
}

.vscode/tasks.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"type": "shell",
6+
"label": "docs:build",
7+
"command": "poetry run make -C docs html",
8+
"problemMatcher": [],
9+
"group": {
10+
"kind": "build",
11+
"isDefault": true
12+
}
13+
},
14+
]
15+
}

0 commit comments

Comments
 (0)