Contributors

Coding guidelines

Coding style

  • Comments: Add comments to make the code readable. NB: Elaborate!

  • Use PEP-8 to guide you in writing beautiful code. Read and apply the PyCharm tips found here: Code Quality Assistance Tips and Tricks, or How to Make Your Code Look Pretty?

  • Use Google style docstrings to enhance readability. In PyCharm: Settings-> Integrated Tools -> Docstring format: Google

  • Create a serializable training pipeline by deriving the objects from pydantic.BaseModel or pydantic.dataclasses.dataclass. Add them to the job settings to ensure parameters are available on the platform.

Code management: git branches and releases

When building new features to the code base, use the JIRA task to create a new feature branch.

Then follow the Smart commands guidelines:

  • ISSUE_KEY #comment <comment_string> Example

  • JRA-34 #comment corrected indent issue

brevettiai merge feature branches to development

brevettiai merge to master requirements

brevettiai release to pypi requirements

Manage the release number, following https://semver.org/:

  • Given a version number MAJOR.MINOR.PATCH, increment the:

    • MAJOR version when you make incompatible API changes,

    • MINOR version when you add functionality in a backwards compatible manner, and

    • PATCH version when you make backwards compatible bug fixes.

    • Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format

  • The code documentation See and edit the python package documentation by installing pdoc3 and using this command, from your main source directory and listing the paths to the modules you want to document pdoc --http :8888 core/brevettiai telescope

Brevettiai development environment setup

If you want to develop features on the brevettiai library follow these steps:

Alternatives:

  • Install the package directly with pip from the source files

  • add the repository directory to PYTHONPATH

  • add the code repositories to source directories in e.g. PyCharm

Requirements:

Python poetry: https://python-poetry.org/docs/master/#installing-with-the-official-installer

brevettiai installation steps:

  • Pull the sources from the repository git clone git@bitbucket.org:criterionai/core.git

  • Create folder for your code and navigate to it

  • Add the following content to the pyproject.toml file, alternatively use poetry init to generate it:Update the path of the brevettiai package if your project folder is not adjacent to the core repository.

[tool.poetry]
name = "development"
version = "0.1.0"
description = ""
authors = [""]

[tool.poetry.dependencies]
python = "^3.7"
brevettiai = {path = "../core", extras = ["cv2", "tf", "tfa"], develop = true}

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
  • Install additional dependencies / development dependencies with poetry add ...

  • Run your virtual environment poetry run or poetry shell

Brevettiai library releases

The Bitbucket pipeline for the core repository now builds and uploads the library to PyPi.

For the deployment step you must be aware of the following three things:

  • Once a version exists on PyPi it cannot be removed. Please test the code well beforehand

  • Only one version may exist with the same version number poetry version can help you manage updates. Poetry version documentation

  • When updating dependencies run poetry update find new versions and then commit the poetry.lock to apply the changes to the build on the pipeline. poetry update can also get a package name if you are only looking to change one package version

Last updated