Skip to content

Commit

Permalink
Merge pull request #20 from microsoft/dciborow/pyproject
Browse files Browse the repository at this point in the history
Create pyproject.toml
  • Loading branch information
dciborow authored May 2, 2022
2 parents b19380f + 03e4901 commit 83f5dfd
Show file tree
Hide file tree
Showing 42 changed files with 713 additions and 655 deletions.
18 changes: 8 additions & 10 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then umask 0002 && /opt/conda/bi
&& rm -rf /tmp/conda-tmp

RUN conda install -y python=3.8 \
&& python3.8 -m pip install --upgrade pip tox

COPY requirements.test.txt /tmp/
RUN python3.8 -m pip install -r /tmp/requirements.test.txt
&& python3.8 -m pip install --upgrade pip \
&& python3.8 -m pip install \
pytest \
pytest-cov \
flit \
pre-commit

COPY requirements.txt /tmp/
RUN python3.8 -m pip install -r /tmp/requirements.txt

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>
COPY .pre-commit-config.yaml .
RUN git init . && pre-commit install-hooks
16 changes: 8 additions & 8 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@
// https://github.com/microsoft/vscode-dev-containers/tree/v0.222.0/containers/python-3-miniconda
{
"name": "Miniconda (Python 3)",
"build": {
"build": {
"context": "..",
"dockerfile": "Dockerfile",
"args": {
"NODE_VERSION": "none"
}
},

// Set *default* container specific settings.json values on container create.
"settings": {
"settings": {
"python.defaultInterpreterPath": "/opt/conda/bin/python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
Expand All @@ -25,19 +24,20 @@
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint"
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance"
"ms-python.vscode-pylance",
"ms-python.pylint",
"ms-python.black-formatter",
"ms-vsliveshare.vsliveshare",
"ryanluker.vscode-coverage-gutters",
"bungcip.better-toml"
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "python --version",

// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",
"features": {
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/noop.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
This file is copied into the container along with environment.yml* from the
parent folder. This is done to prevent the Dockerfile COPY instruction from
parent folder. This is done to prevent the Dockerfile COPY instruction from
failing if no environment.yml is found.
16 changes: 16 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[flake8]
max-line-length = 120
select = "F,E,W,B,B901,B902,B903"
exclude = [
".eggs",
".git",
".tox",
"nssm",
"obj",
"out",
"packages",
"pywin32",
"tests",
"swagger_client"
]
ignore = "E722,B001,W503,E203"
31 changes: 31 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Python CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types: [created]
workflow_dispatch:

jobs:
tooling:
runs-on: ubuntu-latest
strategy:
matrix:
tools: ['black', 'bandit', 'pylint', 'pyright', 'flake8']
include:
- tools: pytest
args: -m not integration and not gpu
- tools: pytest
args: -m integration
steps:
- uses: actions/checkout@v2
- name: ${{ matrix.tools }}
uses: dciborow/pyaction@0.0.28
with:
${{ matrix.tools }}: true
args: ${{ matrix.args }}

publish:
uses: ./.github/workflows/publish.yml
31 changes: 0 additions & 31 deletions .github/workflows/black.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .github/workflows/main.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/mypy.yml

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Python Publish Workflow
on:
workflow_call:

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- if: ${{ github.event_name == 'release' && secrets.PYPI_PASSWORD != '' }}
name: Publish Release to PyPi
uses: dciborow/pyaction@0.0.28
with:
pypi_publish: true
pypi_password: ${{ secrets.PYPI_PASSWORD }}

- if: ${{ github.event_name == 'push' && secrets.PYPI_PASSWORD != '' }}
name: Publish RC to PyPi
uses: dciborow/pyaction@0.0.28
with:
pypi_publish: true
pypi_password: ${{ secrets.PYPI_PASSWORD }}
version_suffix: -rc${{ github.run_number }}-post${{ github.run_attempt }}

- if: ${{ github.event_name == 'pull_request' && secrets.TEST_PYPI_PASSWORD != '' }}
name: Publish Snapshot to TestPyPi
uses: dciborow/pyaction@0.0.28
with:
pypi_publish: true
pypi_password: ${{ secrets.TEST_PYPI_PASSWORD }}
pypi_repo: testpypi
version_suffix: -post${{ github.run_number }}-dev${{ github.run_attempt }}
26 changes: 0 additions & 26 deletions .github/workflows/pylint.yml

This file was deleted.

30 changes: 0 additions & 30 deletions .github/workflows/pypi-publish.yml

This file was deleted.

30 changes: 0 additions & 30 deletions .github/workflows/pypi-test-publish.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/pyright.yml

This file was deleted.

32 changes: 0 additions & 32 deletions .github/workflows/pytest.yml

This file was deleted.

Loading

0 comments on commit 83f5dfd

Please sign in to comment.