Skip to content

chore(setup): rewrite packaging #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Jul 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a70220e
chore(setup): rewrite packaging
XuehaiPan Jul 7, 2022
0a1ccb8
chore: fix file modes
XuehaiPan Jul 7, 2022
01df51e
docs(README): update README
XuehaiPan Jul 7, 2022
c5d6b80
style: format code with yapf
XuehaiPan Jul 7, 2022
fbe3b12
style: reindent license
XuehaiPan Jul 7, 2022
fdf5077
chore(workflow): install CUDA Toolkit in GitHub Action
XuehaiPan Jul 7, 2022
857338a
feat(workflow): build PyPI wheels for Python 3.7 / 3.8 / 3.9 / 3.10
XuehaiPan Jul 7, 2022
b9f9ebe
refactor(setup): use pybind11 PyPI package rather than git submodule
XuehaiPan Jul 7, 2022
ca92f9f
chore(setup): add dependency `typing-extensions`
XuehaiPan Jul 7, 2022
294f7ed
chore(workflow): update workflow trigger
XuehaiPan Jul 7, 2022
bf14292
docs: use HTTPS URL for git clone
XuehaiPan Jul 7, 2022
2e80b67
fix(tests): update requirements.txt
XuehaiPan Jul 7, 2022
4ab4efa
chore(setup): remove deprecated dependency `distutils`
XuehaiPan Jul 7, 2022
9580a96
test: disable CUDA tests if no GPU available
XuehaiPan Jul 8, 2022
8640b81
chore(workflow): use Python 3.7 in tests
XuehaiPan Jul 8, 2022
9730748
refactor(Makefile): update Makefile
XuehaiPan Jul 8, 2022
3dcd29c
style: format CXX code
XuehaiPan Jul 8, 2022
2f4e44f
chore(tests): test with CUDA Toolkit 11.3
XuehaiPan Jul 8, 2022
ad069a4
feat(CMakeLists.txt): auto detect nvcc arch flags
XuehaiPan Jul 8, 2022
bce754b
chore(workflow): set timeout
XuehaiPan Jul 8, 2022
2dba710
docs: update sphinx docs
XuehaiPan Jul 8, 2022
de1bb87
chore: use CamelCased URL paths
XuehaiPan Jul 9, 2022
5597da7
chore: add conda recipe
XuehaiPan Jul 9, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ insert_final_newline = true
indent_size = 4
src_paths=torchopt,tests,examples

[*.{yaml,yml}]
indent_size = 2

[*.md]
indent_size = 2
x-soft-wrap-text = true
Expand All @@ -25,11 +28,5 @@ x-soft-wrap-text = true
[Makefile]
indent_style = tab

[*.cpp]
indent_size = 2

[*.h]
indent_size = 2

[*.cuh?]
[*.{cpp,h,cu,cuh}]
indent_size = 2
98 changes: 66 additions & 32 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,78 @@
name: Lint

on: [push, pull_request]
on:
push:
pull_request:

permissions:
contents: read

jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Cancel previous run
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
- name: Install requirements
run: |
python -m pip install -r requirements.txt
- name: Install dependencies
run: |
python -m pip install -e .
- name: flake8
run: |
make flake8
- name: isort and yapf
run: |
make py-format
- name: addlicense
run: |
make addlicense
- name: mypy
run: |
make mypy
- name: Cancel previous run
uses: styfle/cancel-workflow-action@0.10.0
with:
access_token: ${{ github.token }}

- name: Checkout
uses: actions/checkout@v3
with:
submodules: "recursive"
fetch-depth: 1

- name: Set up Python 3.7 # the lowest version we support
uses: actions/setup-python@v4
with:
python-version: "3.7"
update-environment: true

- name: Setup CUDA Toolkit
uses: Jimver/cuda-toolkit@v0.2.7
id: cuda-toolkit
with:
cuda: "11.3.1"
method: network
sub-packages: '["nvcc"]'
- run: |
echo "Installed CUDA version is: ${{steps.cuda-toolkit.outputs.cuda}}"
echo "CUDA install location: ${{steps.cuda-toolkit.outputs.CUDA_PATH}}"
nvcc -V

- name: Upgrade pip
run: |
python -m pip install --upgrade pip setuptools

- name: Install dependencies
run: |
python -m pip install -r tests/requirements.txt

- name: Install TorchOpt
run: |
python -m pip install -e .

- name: flake8
run: |
make flake8

- name: isort and yapf
run: |
make py-format

- name: addlicense
run: |
make addlicense

- name: mypy
run: |
make mypy

# - name: docstyle
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you got time, maybe add the docstyle? (docsting is a mess right now I think)

Copy link
Member Author

@XuehaiPan XuehaiPan Jul 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may open a separate PR for this.

# run: |
# make docstyle

# - name: spelling
# run: |
# make spelling
# make spelling
111 changes: 87 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,91 @@ on:
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Check consistency between the package version and release tag
run: |
RELEASE_VER=${GITHUB_REF#refs/*/}
PACKAGE_VER="v`python setup.py --version`"
if [ $RELEASE_VER != $PACKAGE_VER ]
then
echo "package ver. ($PACKAGE_VER) != release ver. ($RELEASE_VER)"; exit 1
fi
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
- name: Checkout
uses: actions/checkout@v3
with:
submodules: "recursive"
fetch-depth: 1

- name: Set up Python 3.7
id: py37
uses: actions/setup-python@v4
with:
python-version: "3.7"
update-environment: false

- name: Set up Python 3.8
id: py38
uses: actions/setup-python@v4
with:
python-version: "3.8"
update-environment: false

- name: Set up Python 3.9
id: py39
uses: actions/setup-python@v4
with:
python-version: "3.9"
update-environment: false

- name: Set up Python 3.10
id: py310
uses: actions/setup-python@v4
with:
python-version: "3.10"
update-environment: false

- name: Set up Python executable paths
run: |
DEFAULT_PYTHON="${{ steps.py37.outputs.python-path }}"
echo "DEFAULT_PYTHON='${DEFAULT_PYTHON}'" >> "${GITHUB_ENV}"

PYTHON_EXECUTABLES="${{ steps.py37.outputs.python-path }}"
PYTHON_EXECUTABLES="${PYTHON_EXECUTABLES}:${{ steps.py38.outputs.python-path }}"
PYTHON_EXECUTABLES="${PYTHON_EXECUTABLES}:${{ steps.py39.outputs.python-path }}"
PYTHON_EXECUTABLES="${PYTHON_EXECUTABLES}:${{ steps.py310.outputs.python-path }}"
echo "PYTHON_EXECUTABLES='${PYTHON_EXECUTABLES}'" >> "${GITHUB_ENV}"

- name: Check consistency between the package version and release tag
run: |
RELEASE_VER="${GITHUB_REF#refs/*/}"
PACKAGE_VER="v$(python setup.py --version)"
if [[ "${RELEASE_VER}" != "${PACKAGE_VER}" ]]; then
echo "package ver. (${PACKAGE_VER}) != release ver. (${RELEASE_VER})"
exit 1
fi

- name: Setup CUDA Toolkit
uses: Jimver/cuda-toolkit@v0.2.7
id: cuda-toolkit
with:
cuda: "11.3.1"
method: network
sub-packages: '["nvcc"]'
- run: |
echo "Installed CUDA version is: ${{steps.cuda-toolkit.outputs.cuda}}"
echo "CUDA install location: ${{steps.cuda-toolkit.outputs.CUDA_PATH}}"
nvcc -V

- name: Build sdist and wheels
run: |
while IFS='' read -rd':' PYTHON || [[ -n "${PYTHON}" ]]; do
[[ -z "${PYTHON}" ]] && continue
echo "Building wheel with Python: ${PYTHON} ($("${PYTHON}" --version))"
"${PYTHON}" -m pip install --upgrade pip setuptools wheel build
if [[ "${PYTHON}" == "${DEFAULT_PYTHON}" ]]; then
"${PYTHON}" -m build
else
"${PYTHON}" -m build --wheel
fi
done <<< "${PYTHON_EXECUTABLES}"

- name: Publish to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
"${DEFAULT_PYTHON}" -m pip install --upgrade twine
"${DEFAULT_PYTHON}" -m twine upload dist/*
31 changes: 0 additions & 31 deletions .github/workflows/test.yml

This file was deleted.

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

on:
push:
branches:
- main
pull_request:

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Cancel previous run
uses: styfle/cancel-workflow-action@0.10.0
with:
access_token: ${{ github.token }}

- name: Checkout
uses: actions/checkout@v3
with:
submodules: "recursive"
fetch-depth: 1

- name: Set up Python 3.7 # the lowest version we support
uses: actions/setup-python@v4
with:
python-version: "3.7"
update-environment: true

- name: Setup CUDA Toolkit
uses: Jimver/cuda-toolkit@v0.2.7
id: cuda-toolkit
with:
cuda: "11.3.1"
method: network
sub-packages: '["nvcc"]'
- run: |
echo "Installed CUDA version is: ${{steps.cuda-toolkit.outputs.cuda}}"
echo "CUDA install location: ${{steps.cuda-toolkit.outputs.CUDA_PATH}}"
nvcc -V

- name: Upgrade pip
run: |
python -m pip install --upgrade pip setuptools

- name: Install dependencies
run: |
python -m pip install -r tests/requirements.txt

- name: Install TorchOpt
run: |
python -m pip install -e .

- name: Test with pytest
run: |
make pytest
4 changes: 0 additions & 4 deletions .gitmodules

This file was deleted.

2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ authors:
version: 0.4.1
date-released: "2022-04-09"
license: Apache-2.0
repository-code: "https://github.com/metaopt/torchopt"
repository-code: "https://github.com/metaopt/TorchOpt"
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy