Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[flake8]
max-line-length = 120
max-line-length = 160
extend-ignore = E203
13 changes: 13 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Synopsis

Briefly describe the purpose of the pr.

## Checklist

- [ ] Documentation created/updated
- [ ] Tests created/updated

## Description

Add a more detailed description of the pr including any necessary background
information.
32 changes: 23 additions & 9 deletions .github/workflows/ci-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
max-parallel: 4
matrix:
python-version: [3.7]
fail-fast: false
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -19,7 +19,7 @@ jobs:
- name: Run image
uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: 1.1.11
poetry-version: 1.3.2
- name: Install dependencies
run: poetry install
- name: build
Expand All @@ -30,7 +30,7 @@ jobs:
max-parallel: 4
matrix:
python-version: [3.7]
fail-fast: false
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -40,17 +40,31 @@ jobs:
- name: Run image
uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: 1.1.11
poetry-version: 1.3.2
- name: Install dependencies
run: poetry install
- name: test
run: cd tests && poetry run python -m unittest
run: cd tests && poetry run pytest --tap-stream --cov-report=html --junitxml=junit.xml
- name: Upload Test report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: test-results
path: tests/junit.xml
reporter: java-junit
fail-on-error: false
- name: upload-coverage-report
uses: actions/upload-artifact@v2
with:
name: coverage-report
path: tests/htmlcov/
if-no-files-found: warn
flake8:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [ 3.9 ]
python-version: [3.9]
fail-fast: false
steps:
- uses: actions/checkout@v3
Expand All @@ -61,7 +75,7 @@ jobs:
- name: Run image
uses: abatilo/actions-poetry@v2.1.4
with:
poetry-version: 1.1.12
poetry-version: 1.3.2
- name: setup netrc
run: |-
echo "machine github.com login ${GITHUB_PAT} password x-oauth-basic" > ~/.netrc
Expand All @@ -77,7 +91,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: [ 3.9 ]
python-version: [3.9]
fail-fast: false
steps:
- uses: actions/checkout@v3
Expand All @@ -88,7 +102,7 @@ jobs:
- name: Run image
uses: abatilo/actions-poetry@v2.1.4
with:
poetry-version: 1.1.12
poetry-version: 1.3.2
- name: setup netrc
run: |-
echo "machine github.com login ${GITHUB_PAT} password x-oauth-basic" > ~/.netrc
Expand Down
61 changes: 58 additions & 3 deletions .github/workflows/package-release-artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ jobs:
max-parallel: 4
matrix:
python-version: [3.7]
fail-fast: false
fail-fast: false
outputs:
upload: ${{ steps.set.outputs.upload }}
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -23,13 +25,42 @@ jobs:
- name: Run image
uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: 1.1.11
poetry-version: 1.3.2
- name: Install dependencies
run: poetry install --no-dev
- name: build
run: poetry build
- name: echo version
run: poetry version -s > sml-python-small.version
run: |
poetry version -s > sml-python-small.version
if ! grep -i -q "rc" sml-python-small.version; then
echo ::set-output name=upload::"yes"
fi
- name: Archive dist
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
retention-days: 1
- name: Archive version
uses: actions/upload-artifact@v3
with:
name: sml-python-small.version
path: sml-python-small.version
retention-days: 1

release-to-github:
name: Build and release artifact
runs-on: ubuntu-latest
needs: build-and-release
strategy:
max-parallel: 4
matrix:
python-version: [ 3.7 ]
fail-fast: false
steps:
- name: Download all workflow run artifacts
uses: actions/download-artifact@v3
- name: Create GitHub release
uses: softprops/action-gh-release@v1
with:
Expand All @@ -39,3 +70,27 @@ jobs:
sml-python-small.version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

upload-to-pypi:
name: Upload to pypi
runs-on: ubuntu-latest
needs: build-and-release
if: needs.build-and-release.outputs.upload == 'yes'
environment:
name: pypi
url: https://pypi.org/p/sml-small
permissions:
id-token: write
strategy:
max-parallel: 4
matrix:
python-version: [ 3.7 ]
fail-fast: false
steps:
- name: Download all workflow run artifacts
uses: actions/download-artifact@v3
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@v1.8.10
with:
user: ${{ secrets.PYPI_USERNAME }}
password: ${{ secrets.PYPI_PASSWORD }}
18 changes: 17 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,20 @@ dist/
*~
/tests/fixtures/date_adjustment/testing_output.csv
/tests/testing_output.csv
/.venv/
.venv/

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
junit.xml

# pyenv
.python-version
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @ONSdigital/spp-sml
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Crown Copyright (Office for National Statistics)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

##### Statistical Methods Library for Python Pandas methods used in the **S**tatistical **P**roduction **P**latform (SPP).

This library contains pandas statistical methods that are *only suitable* for
use on *small* datasets which can safely be processed in-memory.
This library contains pandas statistical methods that are only suitable for use on small datasets which can safely be processed in-memory.

For documentation, please refer to the method-specific documentation in the
docs directory.
For further information about the methods contained in this module see the [method specifications](https://github.com/ONSdigital/Statistical-Method-Specifications)

For user documentation and example data relating to the methods in this module see the [supporting information](https://github.com/ONSdigital/sml-supporting-info)

Loading