Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
maread99 committed Aug 24, 2023
0 parents commit deacc6e
Show file tree
Hide file tree
Showing 22 changed files with 5,581 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[flake8]

ignore =
# E203 (not PEP 8 compliant) ignored to not conflict with black
E203,
# W503 (not PEP 8 compliant) ignored to not conflict with black
W503,
# D105 Missing docstring in magic method. I have no issue with this.
# D Let pylint pick up all the doc errors
D

exclude =
*.ipynb_checkpoints


per-file-ignores =
# to permit importing * to __init__
src/valimp/__init__.py:F403,F401
tests/test_valimp.py:E101,E501,E741,W191
# D103 Missing docstring in public function - not required for all tests
# D102 Missing docstring in public function - not required for all tests
# D401 First line should be in imperative moood - not useful to describe fixtures
tests/*.py:D103,D102,D401

#max-line-length extended in line with black default style
max-line-length = 100

docstring-convention=numpy
28 changes: 28 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name-template: 'v$NEXT_PATCH_VERSION ✅'
tag-template: '$NEXT_PATCH_VERSION'
categories:
- title: 'New Features'
label: 'enhancement'
- title: 'Deprecation'
label: 'deprecation'
- title: 'Bug Fixes'
labels:
- 'bug'
- 'Fix'
- title: 'Documentation'
label: 'documentation'
- title: 'Maintenance'
labels:
- 'maintenance'
- 'dependencies'
- 'github_actions'
- title: 'Testing'
label: 'tests'
- title: 'Under the Bonnet'
label: 'code improvement'
- title: 'Continuous Integration'
label: 'CI'
template: |
# What's Changed
$CHANGES
50 changes: 50 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build and test

on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
check-black:
# fail it if doesn't conform to black
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
with:
options: "--check --verbose"

build-and-test:

runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.11"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: 'requirements_tests.txt'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements_tests.txt
pip install -e .
- name: Lint with flake8
# fail it if doesn't pass flake8
run: |
flake8 . --statistics
- name: Test with pytest
# fail it if doesn't pass test suite
run: |
pytest
16 changes: 16 additions & 0 deletions .github/workflows/draft-release-notes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Release Drafter

on:
push:
branches:
- main

# Updates next release notes on any push to main. Label a PR to categorize it
# in accordance with .github/release_drafter.yml.
jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63 changes: 63 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Workflow to upload a Python Package using Twine when a release is created
name: Release to PyPI

on:
release:
types: [released]

permissions:
contents: read

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build

- name: Publish to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TEST_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/

- name: Install from testpypi and import
run: |
i=0
while [ $i -lt 12 ] && [ "${{ github.ref_name }}" != $(pip index versions -i https://test.pypi.org/simple --pre valimp | cut -d'(' -f2 | cut -d')' -f1 | sed 1q) ];\
do echo "waiting for package to appear in test index, i is $i, sleeping 5s"; sleep 5s; echo "woken up"; ((i++)); echo "next i is $i"; done
pip install --index-url https://test.pypi.org/simple valimp==${{ github.ref_name }} --no-deps
pip install -r requirements.txt
python -c 'import valimp;print(valimp.__version__)'
- name: Clean pip
run: |
pip uninstall -y valimp
pip cache purge
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

- name: Install and import
run: |
i=0
while [ $i -lt 12 ] && [ "${{ github.ref_name }}" != $(pip index versions -i https://pypi.org/simple --pre valimp | cut -d'(' -f2 | cut -d')' -f1 | sed 1q) ];\
do echo "waiting for package to appear in index, i is $i, sleeping 5s"; sleep 5s; echo "woken up"; ((i++)); echo "next i is $i"; done
pip install --index-url https://pypi.org/simple valimp==${{ github.ref_name }}
python -c 'import valimp;print(valimp.__version__)'
149 changes: 149 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# 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
_version.py

# 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/
tests/_temp*

# 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

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__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/

etc/lunar-ecliptic-longitude/*
etc/solar-ecliptic-longitude/*

# Vscode
.vscode

# Local files not intended for inclusion public project
_local
19 changes: 19 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-yaml
- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black
# It is recommended to specify the latest version of Python
# supported by your project here, or alternatively use
# pre-commit's default_language_version, see
# https://pre-commit.com/#top_level-default_language_version
language_version: python3.11
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
additional_dependencies: [flake8-docstrings]
Loading

0 comments on commit deacc6e

Please sign in to comment.