diff --git a/.github/workflows/lint-code.yml b/.github/workflows/lint-code.yml new file mode 100644 index 00000000..1dad5e52 --- /dev/null +++ b/.github/workflows/lint-code.yml @@ -0,0 +1,38 @@ +name: Lint code +on: [push, pull_request] + +jobs: + # Use ruff to check for code style violations + ruff-check: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.12" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install ruff + - name: ruff --> Check for style violations + # Configured in pyproject.toml + run: ruff check . + + # Use ruff to check code formatting + ruff-format: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.12" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install ruff + - name: ruff --> Check code formatting + run: ruff format --check . diff --git a/.gitignore b/.gitignore index 62cdbed4..f206da9d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,17 +1,20 @@ -d3/ -jquery/ +__pycache__/ +.DS_Store +.ruff_cache/ +.vscode/ +*.orig *.pyc +*.swp *~ build/ +d3/ dist/ -status.egg-info/ -run_dir/settings.yaml -tests/test_items.yaml -.DS_Store -run_dir/qc_reports/ +jquery/ Pipfile Pipfile.lock -run_dir/settings/ -*.swp -*.orig run_dir/genosqlrc.yaml +run_dir/qc_reports/ +run_dir/settings.yaml +run_dir/settings/ +status.egg-info/ +tests/test_items.yaml diff --git a/conda_requirements.yml b/conda_requirements.yml index d4b14013..6fd2603c 100644 --- a/conda_requirements.yml +++ b/conda_requirements.yml @@ -1,9 +1,13 @@ +channels: + - conda-forge dependencies: - python=3.12 - - 'conda-forge::pango>=1.42.0' - - 'conda-forge::pandas>=1.3.2' - - conda-forge::psycopg2 - - conda-forge::open-fonts - - conda-forge::xorg-libxrender - - conda-forge::xorg-libxext - - conda-forge::xorg-libxau + - pango>=1.42.0 + - pandas>=1.3.2 + - psycopg2 + - open-fonts + - xorg-libxrender + - xorg-libxext + - xorg-libxau + - pip: + - '-r requirements.txt' diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..4f14b00c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,21 @@ +# === LINTING ================================================================ + +[tool.ruff.lint] +select = [ + # Ruff default rules + # ------------------------------ + "E4", # pycodestyle Imports + "E7", # pycodestyle Statements + "E9", # pycodestyle Runtime + "F", # Pyflakes + + # Additional Comment + # ------------------------------------------------------ + "I", # isort Best-practice sorting of imports + "UP", # pyupgrade Make sure syntax is up-to-date +] +ignore = [ + "E402", # Module level import not at top of file + "E722", # Do not use bare 'except' + "E741", # Ambiguous variable name +] diff --git a/requirements.txt b/requirements.txt index 3203012a..d56ea4b6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,24 +1,26 @@ +atlassian-python-api backports.ssl-match-hostname>=3.5.0.1 +cffi CouchDB==1.1 ecdsa>=0.13 genologics @ git+https://github.com/SciLifeLab/genologics.git genologics_sql @ git+https://github.com/SciLifeLab/genologics_sql.git httplib2>=0.10.3 ibmcloudant>=0.9.1 -cffi -matplotlib>=2.0.0 markdown +matplotlib>=2.0.0 nest_asyncio numpy>=1.12.1 oauth2>=1.9.0.post1 openpyxl -atlassian-python-api pycryptodome>=3.6.1 pyparsing>=2.2.0 python-dateutil>=2.7.5 pytz>=2018.9 PyYAML requests>=2.14.2 +selenium +setuptools simplejson>=3.10.0 six>=1.10.0 slack_sdk diff --git a/requirements_dev.txt b/requirements_dev.txt index 7cb6656b..92c89dee 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1 +1,3 @@ +ipdb +ruff selenium