Skip to content

Commit

Permalink
chore: Initial project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
ntlhui committed Nov 11, 2024
1 parent 38bcd47 commit a232ed4
Show file tree
Hide file tree
Showing 11 changed files with 2,472 additions and 282 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.12"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
python -m pip install --upgrade pip poetry
poetry config virtualenvs.create false
poetry install
- name: Analysing the code with pylint
run: |
pylint $(git ls-files '*.py')
24 changes: 10 additions & 14 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,25 @@ on: [push, workflow_dispatch]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest coverage
pip install .
python -m pip install --upgrade pip poetry
poetry config virtualenvs.create false
poetry install
- name: Test
run: |
coverage run -m pytest tests/
coverage run -m pytest tests
- name: Generate Report
run: |
coverage html
- name: Upload report
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: |
htmlcov/*
path: htmlcov/*
8 changes: 7 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
name: Semantic Release

on:
push:
workflow_run:
workflows:
- Pylint
- PyTest
branches:
- main
types:
- completed

jobs:
release:
Expand All @@ -21,4 +26,5 @@ jobs:
- name: Python Semantic Release
uses: python-semantic-release/python-semantic-release@master
with:
# This might need to be changed to the E4E Releaser PAT
github_token: ${{ secrets.GITHUB_TOKEN }}
43 changes: 12 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,10 @@
# python-repo-example
Example Python Package Repository. This repository serves as an example of how to set up a Python repository for UCSD Engineers for Exploration.
# Label Studio Slack Reporter
This bot reports on the labeling progress on slack on a daily basis

## .vscode
This folder should contain at least a `launch.json` file that provides entry points into the package. This could be entry points to example programs, typical debug entry points, etc. Ideally, this will also contain a `settings.json` with folder specific VS Code settings.

## Python Packages
Almost all code should be organized into packages. This facilitates easy code reuse. See https://packaging.python.org/en/latest/ for more information on how to use packages in Python.

## tests
Tests should ideally be kept in an isolated folder. This example uses `pytest`, see https://docs.pytest.org/en/7.0.x/ for information on how to use `pytest`.

## .gitignore
This is an important file to put into your `git` repositories. This helps prevent `git` from including unnecessary files into the version control system, such as generated files, environment files, or log files.

## Jupyter Notebooks
Jupyter Notebooks are a great way to add interactive reports or documentation. There is an example here.

## *.code-workspace
This is created by going to `File`->`Save Workspace As` in VS Code. This allows us to easily open the same development environment across computers and operating systems. Use this as the root of your development environment.

You'll also notice here that there are some recommended extensions. This allows everyone on your team to have a consistent toolchain for how to interact with your code. See https://code.visualstudio.com/docs/editor/extension-marketplace#_workspace-recommended-extensions for instructions for how to configure these.

## README.md
This is a critical file to include. This should be an introduction to your repository. It should be a birds-eye view of what your repo is and how to use it, with links to the appropriate lower-level documentation.

## setup.py
This is the original way to package Python projects, which we probably still prefer. However, in general, if you can, you should probably start using the newer packaging tools (`pyproject.toml`)

See https://packaging.python.org/en/latest/tutorials/packaging-projects/ and https://docs.python.org/3/distutils/setupscript.html for more information about each tool.
## Getting Started
```
pip install git+https://github.com/UCSD-E4E/label-studio-slack-reporter.git
```

## Installing for developers
Developers should do the following:
Expand All @@ -40,6 +17,10 @@ python -m venv .venv
.venv/Scripts/activate.bat # for Windows Command Prompt
source .venv/bin/activate # for bash
# Install in developer mode
python -m pip install -e .[dev]
# Update dependencies
python -m pip install --upgrade pip poetry
# Install package
poetry install
```

164 changes: 0 additions & 164 deletions example.ipynb

This file was deleted.

38 changes: 0 additions & 38 deletions example_package/example_module.py

This file was deleted.

3 changes: 3 additions & 0 deletions label_studio_slack_reporter/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'''Label Studio Slack Reporter
'''
__version__ = '0.1.0'
10 changes: 10 additions & 0 deletions label_studio_slack_reporter/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
'''Label Studio Slack Reporter
'''

def main() -> None:
"""Main Entry Point
"""


if __name__ == "__main__":
main()
Loading

0 comments on commit a232ed4

Please sign in to comment.