Skip to content

Commit

Permalink
Update and standardise tooling
Browse files Browse the repository at this point in the history
  • Loading branch information
adamltyson committed Dec 15, 2023
1 parent 40164fb commit 28be8d9
Show file tree
Hide file tree
Showing 38 changed files with 473 additions and 440 deletions.
5 changes: 0 additions & 5 deletions .coveragerc

This file was deleted.

29 changes: 0 additions & 29 deletions .github/workflows/build_and_publish.yml

This file was deleted.

29 changes: 0 additions & 29 deletions .github/workflows/run-tests.yml

This file was deleted.

66 changes: 66 additions & 0 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: tests

on:
push:
branches:
- '*'
tags:
- '*'
pull_request:

jobs:
linting:
runs-on: ubuntu-latest
steps:
- uses: neuroinformatics-unit/actions/lint@v2

manifest:
name: Check Manifest
runs-on: ubuntu-latest
steps:
- uses: neuroinformatics-unit/actions/check_manifest@v2

test:
needs: [linting, manifest]
name: ${{ matrix.os }} py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Run all supported Python versions on linux
python-version: ["3.9", "3.10", "3.11"]
os: [ubuntu-latest]
# Include one windows and macos run
include:
- os: macos-latest
python-version: "3.10"
- os: windows-latest
python-version: "3.10"

steps:
# Run tests
- uses: neuroinformatics-unit/actions/test@v2
with:
python-version: ${{ matrix.python-version }}

build_sdist_wheels:
name: Build source distribution
needs: [test]
if: github.event_name == 'push' && github.ref_type == 'tag'
runs-on: ubuntu-latest
steps:
- uses: neuroinformatics-unit/actions/build_sdist_wheels@v2


upload_all:
name: Publish build distributions
needs: [build_sdist_wheels]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@v1.5.0
with:
user: __token__
password: ${{ secrets.TWINE_API_KEY }}
105 changes: 17 additions & 88 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,45 +1,3 @@
# Ignored file types
*.ckpt
*.vscode
*.json
*.xml
*.idea
*.pyc
*.vtk
*.obj
*.stl
*.nrrd
*.svg
*.tdms

# These file formats are tracked
# *.avi
# *.png
# *.mp4
# *.jpg


# User folder where they can save stuff without it being tracked by git
User/*

# Visual studio stuff
*/tempCodeRunnerFile.py
*/.ipynb_checkpoints
.ipynb_checkpoints
*/__pycache__
__pycache__
.DS_Store
Users/

# Test scripts and hidden files
workspace.py
workspace.ipynb
playground.py
secrets

# Custom config files
*.conf.custom

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand All @@ -50,6 +8,7 @@ __pycache__/

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
Expand All @@ -61,11 +20,9 @@ lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
Expand All @@ -85,9 +42,8 @@ htmlcov/
.cache
nosetests.xml
coverage.xml
*.cover
*,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
Expand All @@ -96,59 +52,32 @@ coverage.xml
# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
# Flask instance folder
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
doc/build/
docs/_build/

# pydocmd
_build/
mkdocs.yml
# MkDocs documentation
/site/

# PyBuilder
target/

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
# Pycharm and VSCode
.idea/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site
.vscode/

# mypy
.mypy_cache/
# IPython Notebook
.ipynb_checkpoints

.idea/
# pyenv
.python-version

*.~lock.*
# OS
.DS_Store

# Test reports
reports
# written by setuptools_scm
**/_version.py
51 changes: 38 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,42 @@


# Configuring https://pre-commit.ci/
ci:
autoupdate_schedule: monthly

repos:
- repo: https://github.com/psf/black
rev: 23.11.0
hooks:
- id: black
pass_filenames: true
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
pass_filenames: true
# this seems to need to be here in addition to setup.cfg
exclude: __init__.py
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-toml
- id: end-of-file-fixer
- id: mixed-line-ending
args: [--fix=lf]
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.272
hooks:
- id: ruff
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.3.0
hooks:
- id: mypy
additional_dependencies:
- types-setuptools
- types-requests
- types-PyYAML
- types-retry
- repo: https://github.com/mgedmin/check-manifest
rev: "0.49"
hooks:
- id: check-manifest
args: [--no-build-isolation]
additional_dependencies: [setuptools-scm]
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 BrancoLab
Copyright (c) 2023 University College London

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
9 changes: 9 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
include LICENSE
include README.md
exclude .pre-commit-config.yaml

recursive-exclude * __pycache__
recursive-exclude * *.py[co]
recursive-exclude docs *
recursive-exclude tests *
recursive-exclude examples *
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Overview
Morphapi is a lightweight python package for downloading neurons
morphological reconstructions from publicly available datasets.
morphological reconstructions from publicly available datasets.

Please see the [documentation](https://brainglobe.info/documentation/morphapi/index.html)

Expand Down
2 changes: 1 addition & 1 deletion examples/download/allen_morphology_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Download some neurons
neurons = am.download_neurons(neurons[:5].id.values)

# ------------------------------- Visualisation ------------------------------ #
# ----------------------- Visualisation --------------------- #
print("creating meshes")
neurons = [neuron.create_mesh()[1] for neuron in neurons]

Expand Down
Loading

0 comments on commit 28be8d9

Please sign in to comment.