Welcome to hrflow-connectors contributor's guide.
We thank you for your interest in contributing to our open source project hrflow-connectors.
If you are a first time contributor we recommend reading the project documentation. Following the LocalJSON
tutorial should give you a hands-on introduction to the HrFlow.ai Connectors' Framework.
You can also refer to the hrflow developers documentation for matters related to other HrFlow.ai services.
We welcome any contributions from the community big or small.
Please notice, all users and contributors are expected to be open, considerate, reasonable, and respectful. When in doubt, Python Software Foundation's Code of Conduct is a good reference in terms of behavior guidelines.
The master
branch is the stable version of the package where tests and other enforced policies (code style, etc...) should be always passing.
The dev
branch can be used to merge various contributions and test them in conjunction while bypassing the sometimes time consuming process of conforming to master
merging rules.
Depending on the version you would like to use you can git checkout origin (master|dev)
.
Mind that your PR should ultimately target master
and be based on master
Automatic versionning is enabled for the master
branch. For each push
Python Semantic Release (PSR) is used in order to release a new version to Github.
PSR uses commit based rules to determine if a new version should be published and how the version number should be bumped.
PSR does also update the CHANGELOG.md file following the custom template defined in templates/CHANGELOG.md.j2
The current parsing rules are based on Angular Commit Guidelines. This is configured by commit_parser
in [tool.semantic_release]
section of pyproject.toml. See here for details about commit parsing for PSR.
The behavior can be further customized by changing any of allowed_tags
, minor_tags
or patch_tags
in the [tool.semantic_release.commit_parser_options]
section of pyproject.toml.
Below we give some example of what is expected to happen given different situations.
You can also check the Automatic Version bumping section of Python Packages e-book for other examples.
Assume that the last release is v4.5.22
having:
- MAJOR: 4
- MINOR: 5
- PATCH: 22
Then branch feature/some-new-feature
is merged onto master
.
We examine the following three scenarios with regards to the new commits brought to master
after the merge.
- Commit 1
docs: update the documentation generation process
some changes were made to the generate_documentation helper
in core
- Commit 2
refactor: create a helper enum to hold possible value for trigger_type
The parsed tags for this commit history are docs
and refactor
.
None of them are part of minor_tags
nor patch_tags
and there is no mention of any BREAKING CHANGE in any of the commit bodies.
Result: After merge PSR does not trigger any release. The last release remains v4.5.22
- Commit 1
docs: update the documentation generation process
some changes were made to the generate_documentation helper
in core
- Commit 2
fix: correct a bug in MyConnector profile Warehouse
- Commit 3
refactor: create a helper enum to hold possible value for trigger_type
The parsed tags for this commit history are docs
, fix
and refactor
.
There is no mention of any BREAKING CHANGE in any of the commit bodies but fix
is within the currently configured patch_tags
in [tool.semantic_release.commit_parser_options]
section of pyproject.toml.
Result: After merge PSR does increment the PATCH tag making a new release v4.5.
23
- Commit 1
docs: update the documentation generation process
some changes were made to the generate_documentation helper
in core
- Commit 2
feat: add a new MyNewConnector to connectors' list
- Commit 3
refactor: create a helper enum to hold possible value for trigger_type
The parsed tags for this commit history are docs
, feat
refactor
.
There is no mention of any BREAKING CHANGE in any of the commit bodies but feat
is within the currently configured minor_tags
in [tool.semantic_release.commit_parser_options]
section of pyproject.toml.
Result => After merge PSR does increment the MINOR tag making a new release v4.
6
.0
- Commit 1
docs: update the documentation generation process
some changes were made to the generate_documentation helper
in core
- Commit 2
feat: remove previously deprecated helper
BREAKING CHANGE: Warehouse.my_removed_helper is not longer available
- Commit 3
refactor: create a helper enum to hold possible value for trigger_type
The parsed tags for this commit history are docs
, feat
refactor
.
There is a mention of a BREAKING CHANGE in the second commit.
Result: After merge PSR does increment the MAJOR tag making a new release v
5
.0.0
- Fork the repository
- Make sure you have one of the supported
python
versions installed - Install poetry
- Install dependencies by running
poetry install
- [Optional] Install git-lfs if necessary. Run
sudo apt-get install git-lfs
for Ubuntu 18.04, Debian 10, and newer versions - [Optional] Install developpment hooks
make init-hooks
. This installsgit-lfs
addpre-commit
hooks defined in.pre-commit-config.yaml
If you are contributing work related to the S3 backend store you need to update step 4 of the Basic Environment setup with:
poetry install -E s3
- Properly configure the store as described here
nox
sessions are used to test core components across supported versions of Python. The following sessions are defined:
manifest
: Generates themanifest.json
file across supported versions. Fails if themanifest.json
file is different for any given versiondocs
: Genetates documentation files accross supported versions. Fails if any file is different for any given versiontests
: Run tests without s3 extrastests_s3
: Run tests with s3 extras
In order to run the nox
sessions you must:
- Install locally a python interpreter matching each of the supported major versions
- Run
poetry run nox -s manifest
to test thepoetry run nox -s manifest
suite
By default both
tests
andtests_s3
run core tests only. To run tests for connectors use one of the following commands:# Only connector's tests poetry run nox -s (tests|tests_s3) -- --no-cov --ignore tests/core --allconnectors # Only a specific connector's tests poetry run nox -s (tests|tests_s3) -- --no-cov --ignore tests/core > --connector=SomeConnector # Core + All Connectors + Coverage poetry run nox -s (tests|tests_s3) -- --allconnectors
In order to run the
tests_s3
session you need to export the following environment variablesexport S3_STORE_TEST_BUCKET="==========FILL==ME==========" export S3_STORE_TEST_AWS_REGION="==========FILL==ME==========" # This pair of credentials is expected to have # s3:GetObject, s3:ListBucket and s3:PutObject export S3_STORE_TEST_AWS_ACCESS_KEY_ID="==========FILL==ME==========" export S3_STORE_TEST_AWS_SECRET_ACCESS_KEY="==========FILL==ME==========" # This pair of credentials is expected to have **READ ONLY** access # s3:GetObject, s3:ListBucket export S3_STORE_TEST_READ_ONLY_AWS_ACCESS_KEY_ID="==========FILL==ME==========" export S3_STORE_TEST_READ_ONLY_AWS_SECRET_ACCESS_KEY="==========FILL==ME==========" # This pair of credentials is expected to have **WRITE ONLY** access # s3:PutObject, s3:ListBucket export S3_STORE_TEST_WRITE_ONLY_AWS_ACCESS_KEY_ID="==========FILL==ME==========" export S3_STORE_TEST_WRITE_ONLY_AWS_SECRET_ACCESS_KEY="==========FILL==ME=========="
Assuming you would like to use python 3.10.5
. Update instructions accordingly
pyenv install 3.10.5
- Activate version
pyenv local 3.10.5
- Check that version is activated
python --version
should print3.10.5
- Force
poetry
to usepyenv
python versionpoetry env use $(pyenv which python)
- Check that
poetry
uses correct python versionpoetry run python --version
should print3.10.5
- Then run
poetry install
- [Optional] Activate s3 extras
poetry install -E s3
Hypothetically assuming that the supported versions are 3.10
and 3.11
. Update instructions accordingly
- Pick versions matching
3.10
and3.11
. Below we use3.10.10
and3.11.2
- Run
pyenv install 3.10.10
andpyenv install 3.11.2
- Add
.python-version
file in the top directory at the same level of noxfile.py with following content
3.10.10
3.11.2
- If you run
pyenv versions
you should see that both versions are activated and set by.python-version
file - Test that
nox
can properly use the python3.10
and3.11
by runningpoetry run nox -s manifest -p 3.10 3.11
For all kind of contributions make sure that :
- Your work respects the folder and file naming conventions in the Connector Developpment Tutorial
- Make sure that
manifest.json
was updated to reflect your work. See here for instructions - Make sure that documentation was updated to reflect your work. See here for instructions
- Enforce code style by running
make style
- Ensure proper linting by running
make flake8
- Make sure that core tests are ok. These do not involve any connector code so you should'nt need to provide any kind of secrets. Run
make pytest-core
. If you introduced new functionality in core make sure to maintain a _100% coverage score_. - [Optional] [Only if your are contributing a new connector] Make sure that your own connector tests are ok. Run
poetry run pytest --no-cov --ignore tests/core --connector=${YOUR_CONNECTOR_NAME}
- If you reach this step then your PR is very welcome ! From your fork you can target our
master
branch
If you experience bugs or general issues with hrflow-connectors, please have a look at the issue tracker before firing a new issue report.
ℹ️ Please don't forget to include the closed issues in your search.
New issue reports should include information about your programming environment (e.g., operating system, Python version) and steps to reproduce the problem. Please try to simplify the reproduction steps to a very minimal example that still illustrates the problem you are facing. By removing other factors, you help us identify the root cause of the issue.