Skip to content

Commit

Permalink
Merge pull request #1 from TGSAI/main
Browse files Browse the repository at this point in the history
Update to TGSAI
  • Loading branch information
markspec authored Nov 7, 2023
2 parents ff7bc3d + 4cf2509 commit 2fa8069
Show file tree
Hide file tree
Showing 8 changed files with 269 additions and 4 deletions.
36 changes: 36 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
ARG PYTHON_VERSION=3.11
ARG LINUX_DISTRO=bookworm

FROM mcr.microsoft.com/devcontainers/python:1-${PYTHON_VERSION}-${LINUX_DISTRO}

# Install git for nox pre-commit
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
git \
&& rm -rf /var/lib/apt/lists/*

# Poetry
ARG POETRY_VERSION="1.6.1"
RUN if [ "${POETRY_VERSION}" != "none" ]; then bash -c "umask 0002 && pip3 install poetry==${POETRY_VERSION}"; fi

# Nox
ARG NOX_VERSION="2023.4.22"
RUN if [ "${NOX_VERSION}" != "none" ]; then bash -c "umask 0002 && pip3 install nox-poetry nox==${NOX_VERSION}"; fi

# Nox poetry
ARG NOX_POETRY_VERSION="1.0.3"
RUN if [ "${NOX_POETRY_VERSION}" != "none" ]; then bash -c "umask 0002 && pip3 install nox-poetry nox-poetry==${NOX_POETRY_VERSION}"; fi

# Extra python packages for dev
RUN bash -c "umask 0002 && pip3 install msgpack ipykernel"

# Create venv
RUN python -m venv /opt/venv
RUN poetry config virtualenvs.create false
ENV PATH="/opt/venv/bin:$PATH"

# Extra python packages for dev
RUN bash -c "umask 0002 && pip3 install msgpack ipykernel"

# Allow users to update venv
RUN chmod -R 777 /opt/venv
43 changes: 43 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https:/devcontainers/templates/tree/main/src/python
{
"build": {
"dockerfile": "Dockerfile",
"context": ".."
},
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": {
"post_create_script": "bash ./.devcontainer/post-install.sh"
},
// Forward 8787 to enable us to view dask dashboard
"forwardPorts": [8787],
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
"settings": {
"python.terminal.activateEnvInCurrentTerminal": true,
"python.defaultInterpreterPath": "/opt/venv/bin/python"
},
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
"ms-toolsai.jupyter",
"ms-toolsai.jupyter-keymap",
"ms-toolsai.jupyter-renderers",
"vscode-icons-team.vscode-icons",
"wayou.vscode-todo-highlight",
"streetsidesoftware.code-spell-checker"
]
}
},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root",
"updateRemoteUserUID": true,
"mounts": [
// Re-use local Git configuration
"source=${localEnv:HOME}/.gitconfig,target=/home/vscode/.gitconfig_tmp,type=bind,consistency=cached",
"source=${localEnv:HOME}/.gitconfig,target=/root/.gitconfig_tmp,type=bind,consistency=cached",
"source=${localEnv:SCRATCH_DIR}/${localEnv:USER},target=/scratch/,type=bind,consistency=cached"
]
}
13 changes: 13 additions & 0 deletions .devcontainer/post-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cp -f /root/.gitconfig_tmp /root/.gitconfig
cp -f /home/vscode/.gitconfig_tmp /home/vscode/.gitconfig
chmod 777 /home/vscode/.gitconfig
git config --global --add safe.directory `pwd`

# Enable ssh with github for git push
ssh-keygen -f "/root/.ssh/known_hosts" -R "github.com"

# Setup venv
source /opt/venv/bin/activate

# Poetry cmds
poetry config virtualenvs.create false
151 changes: 151 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
# 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/
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/
cover/

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

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .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/
debugging/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# ruff
.ruff_cache/

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# IDE settings
.vscode/
.idea/

# tests
mdio1/*
*/mdio1/*
pytest-of-*
4 changes: 2 additions & 2 deletions .github/workflows/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pip==23.2.1
pip==23.3.1
nox==2023.4.22
nox-poetry==1.0.3
virtualenv==20.24.5
virtualenv==20.24.6
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
repository_url: https://test.pypi.org/legacy/

- name: Publish the release notes
uses: release-drafter/release-drafter@v5.24.0
uses: release-drafter/release-drafter@v5.25.0
with:
publish: ${{ steps.check-version.outputs.tag != '' }}
tag: ${{ steps.check-version.outputs.tag }}
Expand Down
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ instance/

# Sphinx documentation
docs/_build/
docs/jupyter_execute/

# PyBuilder
.pybuilder/
Expand Down Expand Up @@ -112,6 +113,7 @@ venv/
ENV/
env.bak/
venv.bak/
venv*/

# Spyder project settings
.spyderproject
Expand Down Expand Up @@ -143,3 +145,9 @@ cython_debug/
# IDE settings
.vscode/
.idea/

# tests
mdio1/*
*/mdio1/*
pytest-of-*
tmp/
16 changes: 15 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,24 @@ Request features on the [Issue Tracker].

## How to set up your development environment

You need Python 3.7+ and the following tools:
You need Python 3.9+ and the following tools:

- [Poetry]
- [Nox]
- [nox-poetry]

Another alternative is to use a [Development Container] has been setup to provide
an environment with the required dependencies. This facilitates development on
different systems.

This should seamlessly enable development for users of [VS Code] on systems with docker installed.

### Known Issues:

- `git config --global --add safe.directory $(pwd)` might be needed inside the container.

## How to Install and Run MDIO

Install the package with development requirements:

```console
Expand All @@ -60,6 +72,8 @@ $ poetry run mdio
[poetry]: https://python-poetry.org/
[nox]: https://nox.thea.codes/
[nox-poetry]: https://nox-poetry.readthedocs.io/
[development container]: https://containers.dev/
[vs code]: https://code.visualstudio.com/docs/devcontainers/containers/

## How to test the project

Expand Down

0 comments on commit 2fa8069

Please sign in to comment.