Browse Source

Describe development workflow, resolve #1928

pull/2000/head
Hironsan 2 years ago
parent
commit
b899228a49
1 changed files with 66 additions and 8 deletions
  1. 74
      docs/CONTRIBUTING.md

74
docs/CONTRIBUTING.md

@ -51,17 +51,75 @@ Explain the suggestion and include additional details to help developers underst
* Specify which version of doccano you're using.
* Specify the name and version of the OS you're using.
### Pull Request Process
## development workflow
Please follow these steps to have your contribution considered by the maintainers:
1. **Fork the project & clone it locally:** Click the "Fork" button in the header of the [GitHub repository](https://github.com/doccano/doccano), creating a copy of `doccano` in your GitHub account. To get a working copy on your local machine, you have to clone your fork. Click the "Clone or Download" button in the right-hand side bar, then append its output to the `git clone` command.
1. Open a related issue before making a pull request as much as possible.
2. Follow all instructions in [the template](PULL_REQUEST_TEMPLATE.md)
3. Follow the [styleguides](#styleguides)
4. After you submit your pull request, verify that all [status checks](https://help.github.com/articles/about-status-checks/) are passing <details><summary>What if the status checks are failing?</summary>If a status check is failing, and you believe that the failure is unrelated to your change, please leave a comment on the pull request explaining why you believe the failure is unrelated. A maintainer will re-run the status check for you. If we conclude that the failure was a false positive, then we will open an issue to track that problem with our status check suite.</details>
5. You may merge the Pull Request in once you have the sign-off of the project members([@Hironsan](https://github.com/Hironsan) or [@icoxfog417](https://github.com/icoxfog417)).
$ git clone https://github.com/YOUR_USERNAME/doccano.git
While the prerequisites above must be satisfied prior to having your pull request reviewed, the reviewer(s) may ask you to complete additional design work, tests, or other changes before your pull request can be ultimately accepted.
1. **Create an upstream remote and sync your local copy:** Connect your local copy to the original "upstream" repository by adding it as a remote.
$ cd doccano
$ git remote add upstream https://github.com:doccano/doccano.git
You should now have two remotes: read/write-able `origin` points to your GitHub fork, and a read-only `upstream` points to the original repo. Be sure to [keep your fork in sync](https://help.github.com/en/articles/syncing-a-fork) with the original, reducing the likelihood of merge conflicts later on.
1. **Create a branch for each piece of work:** Branch off `develop` for each bugfix or feature that you're working on. Give your branch a descriptive, meaningful name like `bugfix-for-issue-1234` or `improve-io-performance`, so others know at a glance what you're working on.
$ git checkout develop
$ git pull develop master && git push origin develop
$ git checkout -b my-descriptive-branch-name
At this point, you may want to install your version of `doccano`. It's usually best to do this within a dedicated virtual environment; We recomment to use `poetry` with Python 3.8+:
$ cd backend
$ poetry install
$ poetry shell
Second, set up the database and run the development server. Doccano uses Django and Django Rest Framework as a backend. We can set up them by using Django command:
$ python manage.py migrate
$ python manage.py create_roles
$ python manage.py create_admin --noinput --username "admin" --email "admin@example.com" --password "password"
$ python manage.py runserver
In another terminal, you need to run Celery in `backend` directory to use import/export dataset feature:
$ celery --app=config worker --loglevel=INFO --concurrency=1
The doccano frontend is built in Node.js and uses Yarn as a package manager. If you haven't installed them yet, please see Node.js and Yarn documentation.
First, to install the defined dependencies for our project, just run the install command.
$ cd frontend
$ yarn install
Then run the dev command to serve with hot reload at :
$ yarn dev
Now, you can access to the frontend at <http://127.0.0.1:3000/>.
1. **Implement your changes:** Use your preferred text editor to modify the `doccano` source code. Be sure to keep your changes focused and in scope, and follow the coding conventions described below! Document your code as you write it. Run your changes against any existing tests and add new ones as needed to validate your changes; make sure you don’t accidentally break existing functionality! Several common commands can be accessed via the Poetry task:
$ poetry run task mypy
$ poetry run task flake8
$ poetry run task black
$ poetry run task isort
$ poetry run task test
For the frontend, you can execute the following commands:
$ yarn lintfix
$ yarn precommit
$ yarn fix:prettier
1. **Push commits to your forked repository:** Group changes into atomic git commits, then push them to your `origin` repository. There's no need to wait until all changes are final before pushing — it's always good to have a backup, in case something goes wrong in your local copy.
$ git push origin my-descriptive-branch-name
1. **Open a new Pull Request in GitHub:** When you're ready to submit your changes to the main repo, navigate to your forked repository on GitHub. Switch to your working branch then click "New pull request"; alternatively, if you recently pushed, you may see a banner at the top of the repo with a "Compare & pull request" button, which you can click on to initiate the same process. Fill out the PR template completely and clearly, confirm that the code "diff" is as expected, then submit the PR. A number of processes will run automatically via GitHub Workflows (see `.github/workflows/`); we'll want to make sure everything passes before the PR gets merged.
1. **Respond to any code review feedback:** At this point, @Hironsan will review your work and either request additional changes/clarification or approve your work. There may be some necessary back-and-forth; please do your best to be responsive. If you haven’t gotten a response in a week or so, please politely nudge him in the same thread — thanks in advance for your patience!
## Styleguides

Loading…
Cancel
Save