It's awesome that you want to contribute to this service! You can contribute in several ways, like:
- Creating new features
- Fixing existing bugs
- Improving documentation and examples
To help you on this journey we've created this document that will guide you through several steps, like creating your development environment, deploying dependencies and running tests.
On this project, we're following some conventions and it would be awesome if you could do so! Following conventions make it easier for any developer to stretch and maintain your code 😀. The major guidelines that you must follow are:
- Domain Driven Design => you can learn about it here, here and here
- Test Driven Development => you can learn about it here and here
After understanding some of our core concepts, you can now check out our folder structure. We're following the DDD structure on that:
python-chain
│
├── chain
| ├── core
│ │ └── domains
│ │ └── <domain>
| └── tests
| ├── acceptance
| | └── steps
| └── <unit tests>
├── requirements
├── docs
└── deploy
Our entire source code is inside the chain
folder. Everything else is just folders and files to help you build the project or documentation. Inside the chain
folder we have the following sections:
You can find it on the following path: <root>/chain/core
. There, you'll find every code of our core module. The codebase is organized in the following sections (folders):
domains
- All the domains of the application.
Most of the magic happens on the domains
section. There's no pattern of file naming inside a specific domain. They can contain any type of file which is needed to perform a task. But, the most commons are: handlers
, models
, generators
, transformers
and so on.
You can find it on the following path: <root>/chain/tests
. There, you'll find all the unit tests that are currently active. We're using Pytest for the unit tests and Behave to acceptance tests. Please, read their docs before creating new tests.
All unit tests are organized mimicking the structure of the chain folders. The acceptance tests are organized inside the acceptance
folder and divided by features.
To install the development version of the application on your machine you must first install all the following dependencies:
It is strongly recommended to also install the following tools:
Now, with all the dependencies installed, you can follow the installation steps on your favorite shell:
$ git clone [email protected]:quintoandar/python-chain.git
$ cd python-chain
$ make environment
$ make install-dev
Now, your module is good to go! And you can start debugging it.
Since our application is TDD all code must have automated tests. Please, be aware to not "overtest" it too. You should focus on integration and acceptance tests and write unit tests only when a function really needs it. You can see a pretty good article about it here.
On this application, we're using Pytest as our unit test framework and Behave as our behavior test framework. You can run them with:
$ pytest
$ behave
We use SemVer 2.0.0 for versioning our releases. Also, we recommend you to use the Python Black format. We've created a script to do it for you. You can run the make black
command before committing your code.