Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
arneso-ssb committed Oct 14, 2024
0 parents commit 875d6b6
Show file tree
Hide file tree
Showing 18 changed files with 4,812 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .cruft.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"template": "https://github.com/statisticsnorway/ssb-project-template-stat",
"commit": "b41ddc5575550db3fe01c16181e6b05701bd41d4",
"checkout": "1.1.7",
"context": {
"cookiecutter": {
"full_name": "arneso-ssb",
"email": "[email protected]",
"project_name": "docker-rpython",
"description": "Repo for creating a docker images containing both python and R, for use in vscode asCI and dev containers.",
"license_year": "2024",
"_template": "https://github.com/statisticsnorway/ssb-project-template-stat"
}
},
"directory": null
}
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* text=auto eol=lf
*.ipynb filter=nbstripout
*.ipynb diff=ipynb
50 changes: 50 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Tests

on:
push:
branches:
- main
- master
pull_request:

jobs:
tests:
runs-on: ubuntu-latest

steps:
- name: Check out the repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones disabled for a better SonarCloud analysis

- name: Install Poetry
run: |
pipx install poetry
poetry --version
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "poetry"

- name: Install dependencies
run: poetry install --no-root

- name: Run tests
run: poetry run pytest -v --cov --cov-report=term-missing --cov-report=xml

# Need to fix coverage source paths for SonarCloud scanning in GitHub actions.
# Replace root path with /github/workspace (mounted in docker container).
- name: Override coverage source paths for SonarCloud
run: |
sed -i "s/<source><\/source>/<source>\/github\/workspace<\/source>/g" coverage.xml
sed -i "s/<source>tests/<source>\/github\/workspace\/tests/g" coverage.xml
- name: SonarCloud Scan
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# No need to run SonarCloud analysis if dependabot update or token not defined
if: env.SONAR_TOKEN != '' && (github.actor != 'dependabot[bot]')
uses: SonarSource/[email protected]
215 changes: 215 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
# This .gitignore file is based on SSB's recommended gitignore template stored
# in: https://github.com/statisticsnorway/kvakk-git-tools
# It contains three sections: SSB specific ignores, GitHub's Python-ignore
# template and GitHub's R-ignore template.


# The section below contains SSB specific ignores, not included in the Python-
# and R-ignores from GitHub.
*.csv
*.db
*.feather
*.parquet
*.sas7bdat
*.xls
*.xlsx
*.zip

# Notebooks shall be stored in .py or .R-format.
# See https://adr.ssb.no/0020-lagringsformat-for-jupyter-notebooks/
*.ipynb


# The section below is from the GitHub .gitignore template for Python:
# https://raw.githubusercontent.com/github/gitignore/main/Python.gitignore

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
.poetry/cache/

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

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

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pdm
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# The section below is from the GitHub .gitignore template for R:
# https://raw.githubusercontent.com/github/gitignore/main/R.gitignore

# History files
.Rhistory
.Rapp.history

# Session Data files
.RData
.RDataTmp

# User-specific files
.Ruserdata

# Example code in package build process
*-Ex.R

# Output files from R CMD build
/*.tar.gz

# Output files from R CMD check
/*.Rcheck/

# RStudio files
.Rproj.user/

# produced vignettes
vignettes/*.html
vignettes/*.pdf

# OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3
.httr-oauth

# knitr and R markdown default cache directories
*_cache/
/cache/

# Temporary files created by R markdown
*.utf8.md
*.knit.md

# R Environment Variables
.Renviron

# translation temp files
po/*~

# RStudio Connect folder
rsconnect/

# ignore poetry in .config
.poetry/**

# Blaise specific ignores
*.bdix
*.bdbx
73 changes: 73 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
repos:
- repo: local
hooks:
# General file checkers
- id: check-added-large-files
name: Check for added large files
entry: check-added-large-files
language: system
- id: check-merge-conflict
name: Check for merge conflict strings
entry: check-merge-conflict
language: system
- id: check-case-conflict
name: Check for problematic file names
entry: check-case-conflict
language: system

# General text checkers
- id: end-of-file-fixer
name: Fix End of Files
entry: end-of-file-fixer
language: system
types: [text]
stages: [commit, push, manual]
- id: trailing-whitespace
name: Trim Trailing Whitespace
entry: trailing-whitespace-fixer
language: system
types: [text]
stages: [commit, push, manual]
- id: mixed-line-ending
name: Mixed Line Ending
entry: mixed-line-ending
language: system
types: [text]
stages: [commit, push, manual]

# Serialization format checkers
- id: check-yaml
name: Check Yaml
entry: check-yaml
language: system
types: [yaml]
- id: check-json
name: Check JSON
entry: check-json
language: system
types: [json]
- id: check-toml
name: Check Toml
entry: check-toml
language: system
types: [toml]

# Python tools
- id: check-ast
name: Check Python syntax
entry: check-ast
language: system
types: [python]
- id: isort
name: isort
entry: isort
require_serial: true
language: system
types_or: [cython, pyi, python]
args: ["--filter-files"]
- id: black
name: black
entry: black
language: system
types_or: [python, jupyter]
require_serial: true
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Statistics Norway

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.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# docker-rpython

Repo for creating a docker images containing both python and R, for use in vscode asCI and dev containers.

Opprettet av:
arneso-ssb <[email protected]>

---

Legg inn beskrivelse av prosjektet her.
Loading

0 comments on commit 875d6b6

Please sign in to comment.