-
-
Notifications
You must be signed in to change notification settings - Fork 603
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3102 from smilerz/yapf_prettier
Yapf prettier
- Loading branch information
Showing
23 changed files
with
523 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[flake8] | ||
extend-ignore = | ||
# Whitespace before ':' - Required for black compatibility | ||
E203, | ||
# Line break occurred before a binary operator - Required for black compatibility | ||
W503, | ||
# Comparison to False should be 'if cond is False:' or 'if not cond:' | ||
E712 | ||
exclude = | ||
.git, | ||
**/__pycache__, | ||
**/.git, | ||
**/.svn, | ||
**/.hg, | ||
**/CVS, | ||
**/.DS_Store, | ||
.vscode, | ||
**/*.pyc | ||
per-file-ignores= | ||
cookbook/apps.py:F401 | ||
max-line-length = 179 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
If you like this application and want it to give back, there are many ways to contribute. | ||
|
||
!!! success "Contribution List" | ||
If you help bring this project forward you deserve to be credited for it. | ||
Feel free to add yourself to `CONTRIBUTERS.md` or message me to add you if you have contributed anything. | ||
|
||
## Translations | ||
|
||
If you know any foreign languages you can: | ||
Improve the translations for any of the existing languages. | ||
|
||
Add a new language to the long list of existing translations. | ||
|
||
- Armenian | ||
- Bulgarian | ||
- Catalan | ||
- Czech | ||
- Danish | ||
- Dutch | ||
- English | ||
- French | ||
- German | ||
- Hungarian | ||
- Italian | ||
- Latvian | ||
- Norwegian | ||
- Polish | ||
- Russian | ||
- Spanish | ||
- Swedish | ||
|
||
See [here](/contribute/translations) for further information on how to contribute translation to Tandoor. | ||
|
||
## Issues and Feature Requests | ||
|
||
The most basic but also very important way of contributing is reporting issues and commenting on ideas and feature requests | ||
over at [GitHub issues](https://github.com/vabene1111/recipes/issues). | ||
|
||
Without feedback improvement can't happen, so don't hesitate to say what you want to say. | ||
|
||
## Documentation | ||
|
||
Helping improve the documentation for Tandoor is one of the easiest ways to give back and doesn't even require deep technical knowledge. | ||
You can write guides on how to install and configure Tandoor expanding our repository of non-standard configuations. | ||
Or you can write how-to guides using some of Tandoor's advanced features such as authentication or automation. | ||
|
||
See [here](/contribute/documentation) for more information on how to add documentation to Tandoor. | ||
|
||
## Contributing Code | ||
|
||
For the truly ambitious, you can help write code to fix issues, add additional features, or write your own scripts using | ||
Tandoor's extensive API and share your work with the community. | ||
|
||
Before writing any code, please make sure that you review [contribution guidelines](/contribute/guidelines) and | ||
[VSCode](/contribute/vscode) or [PyCharm](/contribute/pycharm) specific configurations. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
The documentation is built from the markdown files in the [docs](https://github.com/vabene1111/recipes/tree/develop/docs) | ||
folder of the GitHub repository. | ||
|
||
In order to contribute to the documentation, there are a couple of methods that you can use. | ||
|
||
## Directly on GitHub | ||
|
||
You can fork the develop repository and edit the markdown files directly on the GitHub website. | ||
|
||
## With an IDE | ||
|
||
You can fork the develop repository and edit the markdown files from your favorite IDE such as VSCode or PyCharm. | ||
One advantage of using as IDE is that you can preview your changes by: | ||
|
||
### Installing mkdocs | ||
|
||
Now install mkdocs and dependencies: `pip install mkdocs-material mkdocs-include-markdown-plugin`. | ||
|
||
### Serving Documetation | ||
|
||
If you want to test the documentation, locally run `mkdocs serve` from the project root. | ||
|
||
## Super Low Tech | ||
|
||
Create your documentation in any work processor (or even create a video!) and [open a feature request](https://github.com/vabene1111/recipes/issues) | ||
attaching your document and requesting that someone add the documentation to Tandoor. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
If you want to contribute bug fixes or small tweaks then your pull requests are always welcome! | ||
|
||
!!! danger "Discuss First!" | ||
If you want to contribute larger features that introduce more complexity to the project please | ||
make sure to **first submit a technical description** outlining what and how you want to do it. | ||
This allows me and the community to give feedback and manage the complexity of the overall | ||
application. If you don't do this please don't be mad if I reject your PR. | ||
|
||
## License | ||
|
||
Contributing to Tandoor requires signing a Contributor License Agreement. You can review the CLA [here](https://cla-assistant.io/TandoorRecipes/recipes). | ||
|
||
## Linting & Formatting | ||
|
||
Tandoor uses a number of libraries to maintain style and formatting consistency. | ||
To contribute to the project you are required to use the following packages with the project defined configurations: | ||
|
||
- flake8 | ||
- yapf | ||
- isort | ||
- prettier | ||
|
||
!!! tip "Manual Formatting" | ||
It is possible to run formatting manually, but it is recommended to setup your IDE to format on save. | ||
``` bash | ||
flake8 file.py --ignore=E501 | isort -q file.py | yapf -i file.py | ||
prettier --write file.vue | ||
``` | ||
|
||
## Testing | ||
Django uses pytest-django to implement a full suite of testing. If you make any functional changes, please implment the appropriate | ||
tests. | ||
|
||
Tandoor is also actively soliciting contribors willing to setup vue3 testing. If you have knowledge in this area it would be greatly appreciated. | ||
|
||
## API Client | ||
|
||
Tandoor uses [django-rest-framework](https://www.django-rest-framework.org/) for API implementation. Making contributions that impact the API requires an understanding of | ||
Viewsets and Serializers. | ||
|
||
Also double check that your changes are actively reflected in the schema so that client apis are generated accurately. | ||
|
||
The API Client is generated automatically from the OpenAPI interface provided by the Django REST framework. | ||
For this [openapi-generator](https://github.com/OpenAPITools/openapi-generator) is used. | ||
|
||
Install it using your desired setup method. (For example, using `npm install @openapitools/openapi-generator-cli -g`.) | ||
|
||
### Vue | ||
|
||
Navigate to `vue/src/utils/openapi`. | ||
|
||
Generate the schema using `openapi-generator-cli generate -g typescript-axios -i http://127.0.0.1:8000/openapi/`. (Replace your dev server url if required.) | ||
|
||
### Vue3 | ||
|
||
Navigate to `vue3/src/openapi`. | ||
|
||
Generate the schema using `openapi-generator-cli generate -g typescript-fetch -i http://127.0.0.1:8000/openapi/`. (Replace your dev server url if required.) | ||
|
||
## Install and Configuration | ||
|
||
Instructions for [VSCode](/contribute/vscode) | ||
Instructions for [PyCharm](/contribute/pycharm) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
!!! info | ||
The dev setup is a little messy as this application combines the best (at least in my opinion) of both Django and Vue.js. | ||
|
||
### Devcontainer Setup | ||
|
||
There is a [devcontainer](https://containers.dev) set up to ease development. It is optimized for VSCode, but should be able to | ||
be used by other editors as well. Once the container is running, you can do things like start a Django dev server, start a Vue.js | ||
dev server, run python tests, etc. by either using the VSCode tasks below, or manually running commands described in the individual | ||
technology sections below. | ||
|
||
In VSCode, simply check out the git repository, and then via the command palette, choose `Dev Containers: Reopen in container`. | ||
|
||
If you need to change python dependencies (requierments.txt) or OS packages, you will need to rebuild the container. If you are | ||
changing OS package requirements, you will need to update both the main `Dockerfile` and the `.devcontainer/Dockerfile`. | ||
|
||
### Django | ||
|
||
This application is developed using the Django framework for Python. They have excellent | ||
[documentation](https://www.djangoproject.com/start/) on how to get started, so I will only give you the basics here. | ||
|
||
1. Clone this repository wherever you like and install the Python language for your OS (I recommend using version 3.10 or above). | ||
2. Open it in your favorite editor/IDE (e.g. PyCharm). | ||
a. If you want, create a virtual environment for all your packages. | ||
3. Install all required packages: `pip install -r requirements.txt`. | ||
4. Run the migrations: `python manage.py migrate`. | ||
5. Start the development server: `python manage.py runserver`. | ||
|
||
There is **no** need to set any environment variables. By default, a simple SQLite database is used and all settings are | ||
populated from default values. | ||
|
||
### Vue.js | ||
|
||
Most new frontend pages are build using [Vue.js](https://vuejs.org/). | ||
|
||
In order to work on these pages, you will have to install a Javascript package manager of your choice. The following examples use yarn. | ||
|
||
In the `vue` folder run `yarn install` to install the dependencies. After that you can use `yarn serve` to start the development server, | ||
and proceed to test your changes. If you do not wish to work on those pages, but instead want the application to work properly during | ||
development, run `yarn build` to build the frontend pages once. |
Oops, something went wrong.