Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
lingjie00 committed Sep 4, 2022
0 parents commit 6846b17
Show file tree
Hide file tree
Showing 20 changed files with 353 additions and 0 deletions.
Binary file added .coverage
Binary file not shown.
13 changes: 13 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[flake8]
exclude =
# ignore init file
configen/__init__.py,
# No need to traverse our git directory
.git,
# There's no value in checking cache directories
__pycache__,
# set the max text length
max-line-length = 80
max-doc-length = 80
# set docs string convention
docstring-convention=numpy
34 changes: 34 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
---
version: 2
updates:
# - package-ecosystem: "pip"
# directory: "/"
# # Weekly update
# schedule:
# interval: "weekly"
# day: "sunday"
# # Include a list of updated dependencies
# # with a prefix determined by the dependency group
# commit-message:
# prefix: "pip prod"
# prefix-development: "pip dev"
# include: "scope"
# # ignore local package
# ignore:
# - dependency-name: "."
- package-ecosystem: "docker"
# Look for a `Dockerfile`
directory: "/"
# Check for weekly update
schedule:
interval: "weekly"
# Include a list of updated dependencies
# with a prefix determined by the dependency group
commit-message:
prefix: "docker prod"
prefix-development: "docker dev"
include: "scope"
36 changes: 36 additions & 0 deletions .github/workflows/docker-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# runs docker actions
---
name: Docker
on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
docker:

runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
driver-opts: network=host
- name: Build and push to local registry
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: localhost:5000/name/app:latest
- name: Inspect
run: |
docker buildx imagetools inspect localhost:5000/name/app:latest
50 changes: 50 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# builds the documentation
---
name: API documentation

# build the documentation whenever there are new commits on main
on:
push:
branches:
- main

# security: restrict permissions for CI jobs.
permissions:
contents: read

jobs:
# Build the documentation and upload the static HTML files as an artifact.
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3

# install requirements
- run: |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
# install package
- run: pip install -e .
# install and run pdoc
- run: pip install pdoc
- run: pdoc -o docs/

- uses: actions/upload-pages-artifact@v1
with:
path: docs/

# Deploy the artifact to GitHub pages.
# This is a separate job so that only actions/deploy-pages has the
# necessary permissions.
deploy:
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v1
41 changes: 41 additions & 0 deletions .github/workflows/project-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# runs check on package
---
name: package
on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9, 3.10]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version}}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: install package
run: |
pip install .
- name: Lint with flake8
run: |
# stop if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest and coverage
run: |
coverage run -m pytest
15 changes: 15 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# update releases programmatically
---
on:
push:
branches:
- main
name: release-please
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
with:
release-type: node
package-name: release-please-action
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# ignore system files
*/.DS_Store

# ignore notebook checkpoints
*/.ipynb_checkpoints/*

# ignore python cache
*/__pycache__/*

# ignore swap files
*/*.swp

# ignore data folder
data/
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM python:3.10

WORKDIR /docker_deployment

COPY . .

RUN pip install -r requirements.txt

CMD ["python", "configen/configen.py"]
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# configen

[![package](https://github.com/lingjie00/configen/actions/workflows/project-actions.yml/badge.svg)](https://github.com/lingjie00/configen/actions/workflows/project-actions.yml)
[![Docker](https://github.com/lingjie00/configen/actions/workflows/docker-actions.yml/badge.svg)](https://github.com/lingjie00/configen/actions/workflows/docker-actions.yml)

# Project overview

Manage Json and Yaml config using folder structure

# Folder structure

- [docs](/docs): includes the methodology and documentations
- [notebooks](/notebooks): includes sample codes in jupyter notebooks format
- [configen]: source codes

# Local development

install [miniconda](https://docs.conda.io/en/latest/miniconda.html)
and create new virtual environment

```bash
# create new environment, replace ```configen``` with the env name
conda create -n configen python==3.8

# activate the new environment
conda activate configen

# install essential packages and this repo package
pip install -r requirements.txt
```
5 changes: 5 additions & 0 deletions configen/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from importlib.metadata import version

__author__ = "Ling"
__email__ = "[email protected]"
__version__ = version("configen")
2 changes: 2 additions & 0 deletions configen/configen.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"""Entry point for program"""
print("Entry point")
9 changes: 9 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Methodology

This file (and others in the /docs folder) will
contain some explanation of the WHY (why you want
to work on this project), HOW (the methods and
models used) and WHAT (what is the final outcome
and insights) readers will gain from your project.

This is also the place to place API documentation.
4 changes: 4 additions & 0 deletions notebooks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Notebooks

Notebooks are used to demonstrate the usage of configen and
some visualisation results.
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[build-system]
requires = [
"setuptools>=42",
"wheel"
]
build-backend = "setuptools.build_meta"
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruamel.yaml
41 changes: 41 additions & 0 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# scientific operation
numpy
scipy

# data frame
pandas

# notebook
jupyter

# visualisation
matplotlib
seaborn

# testing
pytest
coverage

# linter and formatting
black
isort

# generate API documentation
pdoc

# a list of helpful flake8 and extensions
flake8
flake8-isort
flake8-black
dlint
flake8-requirements
flake8-quotes
flake8-functions-names
flake8-variables-names
flake8-comments
flake8-docstrings
flake8-import-order
flake8-import-style
flake8-annotations-coverage
flake8-annotations
flake8-type-checking
29 changes: 29 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""Setup."""
import setuptools

with open("README.md", "r", encoding="utf-8") as f:
long_desc = f.read()

setuptools.setup(
name="configen",
user_scm_version=True,
author="Ling",
author_email="[email protected]",
description="Manage Json and Yaml config using folder structure",
long_description=long_desc,
long_description_content_type="text/markdown",
url="https://github.com/lingjie00/configen",
project_urls={
"Bug Tracker": "https://github.com/lingjie00/configen/issues"
},
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
package_dir={"": "configen"},
packages=setuptools.find_packages(where="configen"),
python_requires=">=3.8",
setup_requires=["setuptools_scm"],
license="MIT"
)
3 changes: 3 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Tests

This folder contains all the unit tests for configen.
11 changes: 11 additions & 0 deletions tests/test_configen.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""sample unittest"""
import unittest

class Test(unittest.TestCase):

def test_dummy(self):
self.assertEqual(True, True)


if __name__ == "__main__":
unittest.main()

0 comments on commit 6846b17

Please sign in to comment.