Skip to content

Commit

Permalink
Merge branch 'dev' into dev2
Browse files Browse the repository at this point in the history
  • Loading branch information
Labbeti committed Feb 26, 2024
2 parents 589f21b + 522d721 commit b632b85
Show file tree
Hide file tree
Showing 126 changed files with 10,437 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[flake8]
max-line-length = 88
extend-ignore = W191,E203,E501,E402
show_source = True
exclude =
# No need to traverse our git directory
.git,
# There's no value in checking cache directories
__pycache__,
# The conf file is mostly autogenerated, ignore it
docs/source/conf.py,
# The old directory contains Flake8 2.0
old,
# This contains our built documentation
build,
# This contains builds of flake8 that we don't want to check
dist,
# Ignore notebook checkpoints
.ipynb_checkpoints,
# Ignore submodule caption-evaluation-tools
tests/caption-evaluation-tools
# Ignore submodule fense
tests/fense
per-file-ignores =
# imported but unused
__init__.py: F401
94 changes: 94 additions & 0 deletions .github/workflows/python-package-pip.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Template: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package using Pip

on:
push:
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]

env:
CACHE_NUMBER: 0 # increase to reset cache manually
AAC_METRICS_TMP_PATH: '/tmp'

# Cancel workflow if a new push occurs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest,windows-latest,macos-latest]
python-version: ["3.9"]
java-version: ["11"]

steps:
# --- INSTALLATIONS ---
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: recursive

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Set up Java ${{ matrix.java-version }}
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: ${{ matrix.java-version }}
java-package: jre

- name: Install package
shell: bash
# note: ${GITHUB_REF##*/} gives the branch name
# note 2: dev is NOT the branch here, but the dev dependencies
run: |
python -m pip install "aac-metrics[dev] @ git+https://github.com/Labbeti/aac-metrics@${GITHUB_REF##*/}"
- name: Load cache of external code and data
uses: actions/cache@master
id: cache_external
with:
path: /home/runner/.cache/aac-metrics/*
key: ${{ runner.os }}-${{ hashFiles('src/aac_metrics/download.py') }}
restore-keys: |
${{ runner.os }}-
# --- TESTS ---
- name: Compile python files
run: |
python -m compileall src
- name: Lint with flake8
run: |
python -m flake8 --config .flake8 --exit-zero --show-source --statistics src
- name: Check format with Black
run: |
python -m black --check --diff src
- name: Print install info
run: |
aac-metrics-info
- name: Print Java version
run: |
java -version
- name: Install external code if needed
if: steps.cache_external.outputs.cache-hit != 'true'
run: |
aac-metrics-download
- name: Test with pytest
run: |
python -m pytest -v
140 changes: 140 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# 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/
pip-wheel-metadata/
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/

# 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
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.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/

# VSCode dir
.vscode/

tests/caption-evaluation-tools
tests/fense
tmp/
tmp*/
*.mdb
core-python*
core-srun*
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[submodule "caption-evaluation-tools"]
path = tests/caption-evaluation-tools
url = https://github.com/audio-captioning/caption-evaluation-tools
ignore = dirty
branch = master

[submodule "fense"]
path = tests/fense
url = https://github.com/blmoistawinde/fense
36 changes: 36 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# exclude: ""

repos:
# Format Code
- repo: https://github.com/ambv/black
rev: 22.8.0
hooks:
- id: black

# Sort imports
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
args: ["--profile", "black"]

# Formatting, Whitespace, etc
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3
hooks:
- id: trailing-whitespace
- id: check-added-large-files
args: ['--maxkb=1000']
- id: check-ast
- id: check-json
- id: check-merge-conflict
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: requirements-txt-fixer
- id: mixed-line-ending
args: ['--fix=no']
- id: flake8
# args: ['--ignore=E203,E501,F811,E712,W503']
args: ['--config=.flake8']
25 changes: 25 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-20.04
tools:
python: "3.9"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# If using Sphinx, optionally build your docs in additional formats such as PDF
# formats:
# - pdf
python:
install:
- method: pip
path: .
- requirements: docs/requirements.txt
Loading

0 comments on commit b632b85

Please sign in to comment.