GithubHelp home page GithubHelp logo

ons-innovation / sml-python-method-template Goto Github PK

View Code? Open in Web Editor NEW

This project forked from onsdigital/sml-python-method-template

0.0 0.0 0.0 44 KB

This repository templates the development of a new python method for the statistical method library

License: MIT License

Python 100.00%

sml-python-method-template's Introduction

sml-python-method-template

This repository templates the development of a new python method for the Statistical Method Library

Table of Contents

Getting Started

This template is an example repository for a new Python implementation of a method targeted for the Statistical Method Library. You should use the template to produce the basic repository structure and tooling useful for developing a method in Python.

  1. Click on the "Use this template" button available on the top right of this page.
  2. Provide a name for your new repository, follow the naming convention sml-<method_name>- e.g sml-totals-and-components-python, sml-totals-and-components-pyspark or sml-totals-and-components-r.
  3. Click the "Create repository from template" button.

You now have a copy of the template repository and can clone this to your local machine to begin development.

git clone https://github.com/ONSdigital/your-new-method-repository.git
cd your-new-method-repository

Prerequisites

This repository uses poetry for python package and dependency management. To install use the poetry installation documentation for guidance

Installation

Use poetry to install and create a virtual environment, from the root directory of your repository run:

poetry install

Ensure you are in the associated virtual environment:

poetry shell

Usage

You can run the template code using:

poetry run python method_name/method_name.py

Unit tests can be run using pytest.

cd tests
pytest

Tooling

This repository includes an example CICD flow using github actions that will run code quality tooling (flake8, black, isort and bandit)

Release

This repository includes an example release and packaging CICD flow using github actions that will create a github release, producing a .whl file and zip of the source code.

To trigger this flow add a tag in the format of a semantic version to the commit that you want to package and release:

  1. Update the docs/release-notes markdown is updated to reflect the latest change

  2. Determine the next sematic version

    • 1.0.0 should be the first official release, once all testing and documentation has been executed and approved
    • x.y.z
      • increment z (patch release) for backward compatible bug fix
      • increment y (minor release) for backward compatible enhancements (e.g new method introduced). z (patch release) is reset to 0
      • increment x (major release) for non-backward compatible changes (e.g method name change / interface change). y (minor release) and z (patch release) are reset to 0.
  3. Update pyproject.toml to reflect the next semantic version

  4. Tag the release

    • git checkout main
    • git tag semantic version
    • git push origin semantic version
  5. Github Action will be triggered and release assets should be made available under the Releases tab in Github

License

See the LICENSE file for further information

sml-python-method-template's People

Contributors

gibbardsteve avatar wojciechp-ons avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.