Skip to content

Commit

Permalink
kickstart rdock-utils package (#57)
Browse files Browse the repository at this point in the history
* kickstart rdock-utils package
  • Loading branch information
ggutierrez-sunbright authored Dec 22, 2023
1 parent 8e64e71 commit 7f88b9f
Show file tree
Hide file tree
Showing 17 changed files with 334 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/build_generic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:

- name: Build rDock
run: docker run --rm -v $PWD:/rdock -w /rdock rdock-${{ inputs.distribution }}:base make CXX=${{ inputs.compiler }} -j 2

- name: Test rDock
run: docker run --rm -v $PWD:/rdock -w /rdock rdock-${{ inputs.distribution }}:base make CXX=${{ inputs.compiler }} test

Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/rdock-utils.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: "[rdock-utils] Lint and Test"

on:
pull_request:
branches:
- main

push:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build rdock-utils dev image
uses: docker/build-push-action@v5
with:
context: ./rdock-utils
tags: ghcr.io/cbdd/rdock-utils:dev
file: ./rdock-utils/Dockerfile
target: development
cache-from: type=gha,scope=rdock-utils
cache-to: type=gha,mode=max,scope=rdock-utils
load: true

- name: flake8
run: docker run --rm -v $PWD/rdock-utils:/rdock-utils -w /rdock-utils ghcr.io/cbdd/rdock-utils:dev flake8 .

- name: black
run: docker run --rm -v $PWD/rdock-utils:/rdock-utils -w /rdock-utils ghcr.io/cbdd/rdock-utils:dev black --check .

- name: isort
run: docker run --rm -v $PWD/rdock-utils:/rdock-utils -w /rdock-utils ghcr.io/cbdd/rdock-utils:dev isort --check .

- name: mypy
run: docker run --rm -v $PWD/rdock-utils:/rdock-utils -w /rdock-utils ghcr.io/cbdd/rdock-utils:dev mypy .
47 changes: 47 additions & 0 deletions rdock-utils/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "rdock-utils",
"build": {
"dockerfile": "../Dockerfile",
"context": "..",
"target": "development"
},
"customizations": {
"vscode": {
"settings": {
"python.languageServer": "Pylance",
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"python.formatting.provider": "black",
"python.linting.mypyEnabled": false,
"isort.check": true,
"python.testing.pytestEnabled": true,
"python.testing.pytestArgs": [
"tests"
],
"python.formatting.blackArgs": [
"--line-length",
"119"
],
"isort.args": [
"--profile",
"black"
],
"[python]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
},
"editor.formatOnSave": true,
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 1000
},
"extensions": [
"ms-python.python",
"littlefoxteam.vscode-python-test-adapter",
"ms-vsliveshare.vsliveshare",
"mhutchie.git-graph",
"ms-toolsai.jupyter"
]
}
}
}
129 changes: 129 additions & 0 deletions rdock-utils/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# 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/
10 changes: 10 additions & 0 deletions rdock-utils/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM python:3.12 AS base

COPY requirements.txt requirements.txt
RUN python -m pip install --upgrade pip
RUN python -m pip install -r requirements.txt

FROM base AS development

COPY requirements-dev.txt requirements-dev.txt
RUN python -m pip install -r requirements-dev.txt
3 changes: 3 additions & 0 deletions rdock-utils/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# rdock-utils python package

coming soon
13 changes: 13 additions & 0 deletions rdock-utils/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[tool.black]
line-length = 119
target-version = ['py312']

[tool.isort]
profile = "black"
line_length = 119
combine_as_imports = true

import_heading_stdlib = "Standard Library"
import_heading_thirdparty = "Dependencies"
import_heading_firstparty = "From apps"
import_heading_localfolder = "Local imports"
Empty file.
2 changes: 2 additions & 0 deletions rdock-utils/rdock_utils/sdnothing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def main() -> None:
print("to be removed when we start having code migrated over here")
5 changes: 5 additions & 0 deletions rdock-utils/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
black
flake8
isort
mypy
pytest
Empty file added rdock-utils/requirements.txt
Empty file.
12 changes: 12 additions & 0 deletions rdock-utils/scripts/sdnothing
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env python3

# remove this script when the first script is migrated here
# actual code for the scripts should be in rdock_utils.<dedicated_script_name_module>
# for example,
# from rdock_utils.sdsort import main

# From apps
from rdock_utils.sdnothing import main

if __name__ == "__main__":
main()
36 changes: 36 additions & 0 deletions rdock-utils/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[flake8]
max-line-length = 119
exclude = .git,__pycache__
ignore = E231,E501,E203,W503


[mypy]
python_version = 3.12
pretty = True
show_error_context = True
show_error_codes = True

follow_imports = silent
ignore_missing_imports = True

disallow_incomplete_defs = True
disallow_any_generics = True
disallow_subclassing_any = False
disallow_untyped_calls = True
disallow_untyped_defs = True
disallow_untyped_decorators = True

warn_unused_configs = True
warn_unreachable = True
warn_redundant_casts = True
warn_unused_ignores = True
warn_return_any = True

check_untyped_defs = True

no_implicit_optional = True
no_implicit_reexport = False

strict_equality = True

exclude = (^setup\.py$)
20 changes: 20 additions & 0 deletions rdock-utils/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env python

# Dependencies
from setuptools import setup

raise Exception("Please make sure you have modified all necessary attributes before pip installing the package")

setup(
name="rdock-utils",
version="0.01",
description="",
author="",
author_email="",
url="",
packages=[],
# inlcude_package_data=True,
# package_data={'package.module':[folder/with/data/*]}
# scripts=[],
install_requires=[],
)
Empty file added rdock-utils/tests/__init__.py
Empty file.
Empty file added rdock-utils/tests/conftest.py
Empty file.
6 changes: 6 additions & 0 deletions rdock-utils/tests/test_all_ok.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# An empty test, to be able to run something with pytest : )
# Remove me when you have something in place


def test_all_ok() -> None:
assert True

0 comments on commit 7f88b9f

Please sign in to comment.