Skip to content

Commit

Permalink
Merge branch 'main' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
radinceorc authored Sep 2, 2024
2 parents 18f0564 + 8b73e34 commit 72f6138
Show file tree
Hide file tree
Showing 11 changed files with 748 additions and 422 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install coverage codecov pytest
pip install -r packages/requirements-dev.txt
- name: Run tests
run: |
coverage run -m pytest
- name: Generate coverage report
run: coverage xml
- name: Run Tox tests
run: tox
- name: Run pre-commmit hooks
run: tox -e pre-commit
- name: Upload coverage to Codecov
run: codecov
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,4 @@ manage.py
# Ignore all migrations files except __init__.py
**/migrations/*
!**/migrations/__init__.py
bandit_report.txt
30 changes: 29 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ repos:
- id: isort
exclude: (migrations/|tests/|docs/|static/|media/).*

- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.10.1
hooks:
- id: isort
exclude: (migrations/|tests/|docs/|static/|media/).*

- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
Expand Down Expand Up @@ -48,6 +54,28 @@ repos:
hooks:
- id: codespell
exclude: locale|kickstarter-announcement.md|coreapi-0.1.1.js
- id: ruff
args: ["--config=pyproject.toml"]
exclude: (migrations/|tests/|docs/|static/|media/).*

- repo: https://github.com/commitizen-tools/commitizen
rev: v3.28.0
hooks:
- id: commitizen
exclude: (migrations/|tests/|docs/|static/|media/).*

- repo: https://github.com/PyCQA/bandit
rev: 1.7.4
hooks:
- id: bandit
args: ["-c", "pyproject.toml", "-r", "."]
additional_dependencies: [ "bandit[toml]" ]
exclude: (migrations/|tests/|docs/|static/|media/).*

- repo: local
hooks:
- id: docformatter
args: ["--in-place", "--recursive", "--blank"]

- repo: local
hooks:
Expand All @@ -70,7 +98,7 @@ repos:
- "-rn"
- "-sn"
- "--rcfile=pyproject.toml"
files: ^sage_meta/
files: ^sage_invoice/

ci:
skip: [pylint]
8 changes: 4 additions & 4 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ Thank you for your interest in contributing to our package! This document outlin
6. **Run Code Quality Checks**: Ensure code quality with pre-commit, Ruff, and Pylint.
```bash
pre-commit run --all-files
ruff check django_sage_invoice --fix
black django_sage_invoice/
isort django_sage_invoice/
pylint django_sage_invoice
ruff check sage_invoice --fix
black sage_invoice/
isort sage_invoice/
pylint sage_invoice
```

7. **Run Tests**: Ensure all tests pass using Poetry.
Expand Down
153 changes: 153 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
# Contributing to django-sage-invoice

Thank you for considering contributing to `django-sage-invoice`! We welcome contributions from the community to help make this project better.

## Table of Contents

- [Contributing to django-sage-invoice](#contributing-to-django-sage-invoice)
- [Table of Contents](#table-of-contents)
- [Getting Started](#getting-started)
- [Running Tests](#running-tests)
- [Code Style](#code-style)
- [Security Checks](#security-checks)
- [Pre-commit Hooks](#pre-commit-hooks)
- [Setting Up Pre-commit Hooks](#setting-up-pre-commit-hooks)
- [Submitting a Pull Request](#submitting-a-pull-request)
- [Reporting Issues](#reporting-issues)
- [Additional Resources](#additional-resources)

## Getting Started

1. **Fork the repository on GitHub**:

Go to the [django-sage-invoice](https://github.com/your-username/django-sage-invoice) repository and click on the "Fork" button in the top-right corner.

2. **Clone your fork locally**:

```bash
git clone https://github.com/your-username/django-sage-invoice.git
cd django-sage-invoice
```

3. **Install dependencies using Poetry**:

If you don't have Poetry installed, you can install it by following the instructions on the [Poetry website](https://python-poetry.org/docs/#installation).

```bash
poetry install
```

4. **Create a new branch for your feature or bugfix**:

```bash
git checkout -b feature/your-feature
```

## Running Tests

We use `pytest` for testing. To run the tests, execute:

```bash
poetry run pytest
```

Ensure that all tests pass before submitting a pull request.

## Code Style

We use `black` and `isort` to format our code. Please ensure your code is formatted correctly before submitting a pull request:

```bash
poetry run black .
poetry run isort .
```

Additionally, we use `flake8` and `pylint` for linting. You can run these tools to check for code style issues:

```bash
poetry run flake8
poetry run pylint sage_invoice
```

## Security Checks

We use `bandit` to perform security checks on our codebase. Bandit helps identify common security issues in Python code.

### Running Bandit

To run Bandit with the current configuration:

```bash
poetry run bandit -c pyproject.toml
```


## Pre-commit Hooks

We use `pre-commit` to ensure code quality and consistency. Pre-commit hooks will run automatically before each commit to check and format the code.

### Setting Up Pre-commit Hooks

1. **Install pre-commit**:

```bash
poetry add --dev pre-commit
```

2. **Install the pre-commit hooks**:

```bash
poetry run pre-commit install
```

3. **Run pre-commit hooks manually (optional but recommended before committing)**:

```bash
poetry run pre-commit run --all-files
```

The pre-commit configuration is defined in the `.pre-commit-config.yaml` file. Make sure to review and understand the hooks configured.

## Submitting a Pull Request

1. **Commit your changes**:

Write clear and descriptive commit messages. Follow the guidelines in the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification if possible.

```bash
git commit -am 'feat: add new email feature'
```

2. **Push to the branch**:

```bash
git push origin feature/your-feature
```

3. **Open a pull request on GitHub**:

Go to the original repository on GitHub and open a pull request. Provide a clear and descriptive title and description for your pull request. Link to any relevant issues or discussions.

4. **Wait for review**:

One of the project maintainers will review your pull request. Be responsive to feedback and be prepared to make changes if necessary.

## Reporting Issues

If you find a bug or have a feature request, please open an issue on GitHub. Provide as much detail as possible to help us understand and address the issue:

1. **Go to the [Issues](https://github.com/your-username/django-sage-invoice/issues) section of the repository.**
2. **Click on "New issue".**
3. **Fill out the issue template with relevant details.**

## Additional Resources

- [Poetry Documentation](https://python-poetry.org/docs/)
- [Black Documentation](https://black.readthedocs.io/en/stable/)
- [isort Documentation](https://pycqa.github.io/isort/)
- [pytest Documentation](https://docs.pytest.org/en/stable/)
- [flake8 Documentation](https://flake8.pycqa.org/en/latest/)
- [pylint Documentation](https://pylint.pycqa.org/en/latest/)
- [Pre-commit Documentation](https://pre-commit.com/)

Thank you for contributing!
25 changes: 25 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Contributors

We would like to thank the following people for their contributions to the `django-sage-invoice` project:

## Core Contributors

- **Sepehr Akbarzadeh**
- GitHub: [sageteam](https://github.com/sepehr-akbarzadeh)
- Email: [email protected]
- Contributions: Project creator and lead maintainer.

- **Radin Ghahremani**
- GitHub: [radinceorc](https://github.com/radinceorc)
- Email: [email protected]
- Contributions: maintainer.

- **Aryan Niknezhad**
- GitHub: [ARYAN-NIKNEZHAD](https://github.com/ARYAN-NIKNEZHAD)
- Email: [email protected]
- Contributions: maintainer.
---

To be added to this list, please contribute to the project by submitting a pull request, opening issues, or helping improve the documentation. We appreciate all contributions, big and small!

If you have contributed and are not listed here, please feel free to add your name and details in a pull request.
88 changes: 88 additions & 0 deletions packages/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -950,3 +950,91 @@ websockets==13.0.1 ; python_version >= "3.11" and python_version < "4.0" \
--hash=sha256:f9c9e258e3d5efe199ec23903f5da0eeaad58cf6fccb3547b74fd4750e5ac47a \
--hash=sha256:fac2d146ff30d9dd2fcf917e5d147db037a5c573f0446c564f16f1f94cf87462 \
--hash=sha256:faef9ec6354fe4f9a2c0bbb52fb1ff852effc897e2a4501e25eb3a47cb0a4f89
=======
alabaster==0.7.13 ; python_version >= "3.8" and python_version < "4.0"
argcomplete==3.5.0 ; python_version >= "3.8" and python_version < "4.0"
asgiref==3.8.1 ; python_version >= "3.8" and python_version < "4.0"
astroid==3.2.4 ; python_version >= "3.8" and python_version < "4.0"
babel==2.16.0 ; python_version >= "3.8" and python_version < "4.0"
backports-zoneinfo==0.2.1 ; python_version >= "3.8" and python_version < "3.9"
bandit[toml]==1.7.9 ; python_version >= "3.8" and python_version < "4.0"
black==24.8.0 ; python_version >= "3.8" and python_version < "4.0"
cachetools==5.5.0 ; python_version >= "3.8" and python_version < "4.0"
certifi==2024.7.4 ; python_version >= "3.8" and python_version < "4.0"
cffi==1.17.0 ; python_version >= "3.8" and python_version < "4.0" and platform_python_implementation != "PyPy"
cfgv==3.4.0 ; python_version >= "3.8" and python_version < "4.0"
chardet==5.2.0 ; python_version >= "3.8" and python_version < "4.0"
charset-normalizer==3.3.2 ; python_version >= "3.8" and python_version < "4.0"
click==8.1.7 ; python_version >= "3.8" and python_version < "4.0"
codecov==2.1.13 ; python_version >= "3.8" and python_version < "4.0"
colorama==0.4.6 ; python_version >= "3.8" and python_version < "4.0"
commitizen==3.29.0 ; python_version >= "3.8" and python_version < "4.0"
coverage==7.6.1 ; python_version >= "3.8" and python_version < "4.0"
coverage[toml]==7.6.1 ; python_version >= "3.8" and python_version < "4.0"
cryptography==43.0.0 ; python_version >= "3.8" and python_version < "4.0"
decli==0.6.2 ; python_version >= "3.8" and python_version < "4.0"
dill==0.3.8 ; python_version >= "3.8" and python_version < "4.0"
distlib==0.3.8 ; python_version >= "3.8" and python_version < "4.0"
django-sage-tools==0.2.2 ; python_version >= "3.8" and python_version < "4.0"
django==4.2.15 ; python_version >= "3.8" and python_version < "3.10"
django==5.1 ; python_version >= "3.10" and python_version < "4.0"
docutils==0.19 ; python_version >= "3.8" and python_version < "4.0"
exceptiongroup==1.2.2 ; python_version >= "3.8" and python_version < "3.11"
filelock==3.15.4 ; python_version >= "3.8" and python_version < "4.0"
identify==2.6.0 ; python_version >= "3.8" and python_version < "4.0"
idna==3.8 ; python_version >= "3.8" and python_version < "4.0"
imagesize==1.4.1 ; python_version >= "3.8" and python_version < "4.0"
importlib-metadata==8.4.0 ; python_version >= "3.8" and python_version < "3.10"
iniconfig==2.0.0 ; python_version >= "3.8" and python_version < "4.0"
isort==5.13.2 ; python_version >= "3.8" and python_version < "4.0"
jinja2==3.1.4 ; python_version >= "3.8" and python_version < "4.0"
markdown-it-py==3.0.0 ; python_version >= "3.8" and python_version < "4.0"
markupsafe==2.1.5 ; python_version >= "3.8" and python_version < "4.0"
mccabe==0.7.0 ; python_version >= "3.8" and python_version < "4.0"
mdurl==0.1.2 ; python_version >= "3.8" and python_version < "4.0"
mimesis==11.1.0 ; python_version >= "3.8" and python_version < "4.0"
mypy-extensions==1.0.0 ; python_version >= "3.8" and python_version < "4.0"
nodeenv==1.9.1 ; python_version >= "3.8" and python_version < "4.0"
packaging==24.1 ; python_version >= "3.8" and python_version < "4.0"
pathspec==0.12.1 ; python_version >= "3.8" and python_version < "4.0"
pbr==6.1.0 ; python_version >= "3.8" and python_version < "4.0"
pillow==10.4.0 ; python_version >= "3.8" and python_version < "4.0"
platformdirs==4.2.2 ; python_version >= "3.8" and python_version < "4.0"
pluggy==1.5.0 ; python_version >= "3.8" and python_version < "4.0"
pre-commit==3.5.0 ; python_version >= "3.8" and python_version < "4.0"
prompt-toolkit==3.0.36 ; python_version >= "3.8" and python_version < "4.0"
pycparser==2.22 ; python_version >= "3.8" and python_version < "4.0" and platform_python_implementation != "PyPy"
pygments==2.18.0 ; python_version >= "3.8" and python_version < "4.0"
pylint==3.2.6 ; python_version >= "3.8" and python_version < "4.0"
pyproject-api==1.7.1 ; python_version >= "3.8" and python_version < "4.0"
pytest-cov==5.0.0 ; python_version >= "3.8" and python_version < "4.0"
pytest-django==4.8.0 ; python_version >= "3.8" and python_version < "4.0"
pytest==8.3.2 ; python_version >= "3.8" and python_version < "4.0"
pytz==2024.1 ; python_version >= "3.8" and python_version < "3.9"
pyyaml==6.0.2 ; python_version >= "3.8" and python_version < "4.0"
questionary==2.0.1 ; python_version >= "3.8" and python_version < "4.0"
requests==2.32.3 ; python_version >= "3.8" and python_version < "4.0"
rich==13.8.0 ; python_version >= "3.8" and python_version < "4.0"
ruff==0.5.7 ; python_version >= "3.8" and python_version < "4.0"
snowballstemmer==2.2.0 ; python_version >= "3.8" and python_version < "4.0"
sphinx-rtd-theme==2.0.0 ; python_version >= "3.8" and python_version < "4.0"
sphinx==6.2.1 ; python_version >= "3.8" and python_version < "4.0"
sphinxcontrib-applehelp==1.0.4 ; python_version >= "3.8" and python_version < "4.0"
sphinxcontrib-devhelp==1.0.2 ; python_version >= "3.8" and python_version < "4.0"
sphinxcontrib-htmlhelp==2.0.1 ; python_version >= "3.8" and python_version < "4.0"
sphinxcontrib-jquery==4.1 ; python_version >= "3.8" and python_version < "4.0"
sphinxcontrib-jsmath==1.0.1 ; python_version >= "3.8" and python_version < "4.0"
sphinxcontrib-qthelp==1.0.3 ; python_version >= "3.8" and python_version < "4.0"
sphinxcontrib-serializinghtml==1.1.5 ; python_version >= "3.8" and python_version < "4.0"
sqlparse==0.5.1 ; python_version >= "3.8" and python_version < "4.0"
stevedore==5.3.0 ; python_version >= "3.8" and python_version < "4.0"
termcolor==2.4.0 ; python_version >= "3.8" and python_version < "4.0"
tomli==2.0.1 ; python_version >= "3.8" and python_full_version <= "3.11.0a6"
tomlkit==0.13.2 ; python_version >= "3.8" and python_version < "4.0"
tox==4.18.0 ; python_version >= "3.8" and python_version < "4.0"
typing-extensions==4.12.2 ; python_version >= "3.8" and python_version < "3.11"
tzdata==2024.1 ; python_version >= "3.8" and python_version < "4.0" and sys_platform == "win32"
urllib3==2.2.2 ; python_version >= "3.8" and python_version < "4.0"
virtualenv==20.26.3 ; python_version >= "3.8" and python_version < "4.0"
wcwidth==0.2.13 ; python_version >= "3.8" and python_version < "4.0"
zipp==3.20.1 ; python_version >= "3.8" and python_version < "3.10"
Loading

0 comments on commit 72f6138

Please sign in to comment.