Skip to content
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

maint: migrate to src-layout #74

Merged
merged 7 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 0 additions & 4 deletions setup.cfg → .flake8
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[metadata]
long_description = file: README.md
long_description_content_type = text/markdown

[flake8]
doctests = True
exclude =
Expand Down
43 changes: 18 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
steps:

- name: get repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4

- name: install dependencies
run: |
Expand All @@ -26,41 +26,32 @@ jobs:

- name: lint with black
run: |
black --check -v .
black --check .

type-check:

needs: lint

runs-on: ubuntu-latest

strategy:
fail-fast: false

matrix:
qt: [PySide6, PyQt6]

steps:

- name: get repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: set up Python
uses: actions/setup-python@v2

- name: install qt
run: |
pip install ${{ matrix.qt }}
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: install package
run: |
pip install mypy .[test]
pip install -r requirements.txt
pip install mypy

- name: run mypy check
run: |
mypy araviq6
mypy doc/source --exclude doc/source/examples
mypy doc/source/examples/${{ matrix.qt }}
mypy src


unit-test:
Expand All @@ -75,7 +66,6 @@ jobs:

strategy:
fail-fast: false

matrix:
os : [ubuntu-latest, windows-latest, macos-latest]
python: ["3.7", "3.8", "3.9", "3.10", "3.11"]
Expand All @@ -84,10 +74,10 @@ jobs:
steps:

- name: get repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

Expand All @@ -109,7 +99,8 @@ jobs:

- name: install package
run: |
pip install .[test-headless]
pip install pytest-xvfb
pip install .[test]

- run: pytest

Expand All @@ -122,10 +113,12 @@ jobs:
steps:

- name: get repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: install package
run: |
Expand Down
3 changes: 1 addition & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
include araviq6/py.typed
include araviq6/samples/*
include src/araviq6/data/*
Empty file removed araviq6/tests/__init__.py
Empty file.
42 changes: 0 additions & 42 deletions araviq6/util/testing.py

This file was deleted.

Empty file removed araviq6/util/tests/__init__.py
Empty file.
4 changes: 2 additions & 2 deletions doc/source/examples/PyQt6/array.player.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ def closeEvent(self, event):


if __name__ == "__main__":
from araviq6 import get_samples_path
from araviq6 import get_data_path
from PyQt6.QtWidgets import QApplication
import sys

app = QApplication(sys.argv)
widget = CannyVideoPlayerWidget()
url = QUrl.fromLocalFile(get_samples_path("hello.mp4"))
url = QUrl.fromLocalFile(get_data_path("hello.mp4"))
widget.setSource(url)
widget.show()
app.exec()
Expand Down
4 changes: 2 additions & 2 deletions doc/source/examples/PyQt6/frame.player.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ def closeEvent(self, event):


if __name__ == "__main__":
from araviq6 import get_samples_path
from araviq6 import get_data_path
from PyQt6.QtWidgets import QApplication
import sys

app = QApplication(sys.argv)
window = Window()
url = QUrl.fromLocalFile(get_samples_path("hello.mp4"))
url = QUrl.fromLocalFile(get_data_path("hello.mp4"))
window.setSource(url)
window.show()
app.exec()
Expand Down
4 changes: 2 additions & 2 deletions doc/source/examples/PySide6/array.player.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ def closeEvent(self, event):


if __name__ == "__main__":
from araviq6 import get_samples_path
from araviq6 import get_data_path
from PySide6.QtWidgets import QApplication
import sys

app = QApplication(sys.argv)
widget = CannyVideoPlayerWidget()
url = QUrl.fromLocalFile(get_samples_path("hello.mp4"))
url = QUrl.fromLocalFile(get_data_path("hello.mp4"))
widget.setSource(url)
widget.show()
app.exec()
Expand Down
4 changes: 2 additions & 2 deletions doc/source/examples/PySide6/frame.player.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ def closeEvent(self, event):


if __name__ == "__main__":
from araviq6 import get_samples_path
from araviq6 import get_data_path
from PySide6.QtWidgets import QApplication
import sys

app = QApplication(sys.argv)
window = Window()
url = QUrl.fromLocalFile(get_samples_path("hello.mp4"))
url = QUrl.fromLocalFile(get_data_path("hello.mp4"))
window.setSource(url)
window.show()
app.exec()
Expand Down
61 changes: 27 additions & 34 deletions doc/source/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,27 @@ Installation

This document explains how to install AraViQ6.

Making virtual environment
==========================

It is recommended to make a dedicated virtual environment to avoid any possible collision with external libraries using different Qt dependencies.
The easiest way is to use `Anaconda <https://www.anaconda.com/>`_:
If you just want quick installation, run the following command and forget about the rest of this document.

.. code-block:: bash

$ conda create -n my-env pip
$ conda activate my-env
$ pip install araviq6

This will install ``araviq6`` package in your environment.

You are now in a new environment "my-env", with only `pip <https://pip.pypa.io/en/stable/>`_ package installed.
Ready to go!
Developers are encouraged to :ref:`download the source <download-source>` and :ref:`install from the source <install-from-source>`.

Downloading the source (Optional)
=================================

You can download full source code of AraViQ6 project without installing it by git.
.. _download-source:

You can download full source code of AraViQ6 project from its repository.

.. code-block:: bash

$ git clone [email protected]:JSS95/araviq6.git

Note that you can download the source with ``pip`` command, but it will install the package at the same time.
It will be explaned in the next section.

Installing
==========

Expand All @@ -39,31 +34,27 @@ The package can be installed by

$ pip install [-e] <PyPI name/url/path>[dependency options]

For example, the following code installs the latest release from PyPI.
.. rubric:: Install options

.. code-block:: bash

$ pip install araviq6
.. _install-options:

.. rubric:: install options

There are two types of install options for developers.
There are two noticeable install options for developers.

* Install with editable option (``-e``)
* Install with dependency specification (``[...]``)
* Install with optional dependencies (``[...]``)

Editable option installs the package as link to the original location.
Change to the source directly applies as you import the package.
The editable option allows changes made to the source code to be immediately reflected in the installed package.
For more information, refer to `pip documentation <https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs>`_.

Dependency specification installs additional modules which are required to access extra features of the package.
You may add them in brackets right after the package argument.
Optional dependencies can be specified by adding them into brackets right after the package url/path.
When specified, additional module are installed to help accessing extra features of the package.

Available specifications for AraViQ6 are:
In AraViQ6, all optional dependencies are for package development.
Available specifications are:

* ``test``: installs modules to run tests
* ``test-headless``: installs modules to run tests in headless environment.
* ``doc``: installs modules to build documentations
* ``full``: installs every additional dependency
* ``test``: installs modules to run tests.
* ``doc``: installs modules to build documentations.
* ``dev``: installs every additional dependency for developers.

With commas without trailing whitespaces, i.e. ``[A,B]``, you can pass multiple specifications.

Expand All @@ -77,25 +68,27 @@ By passing the vcs url, ``pip`` command automatically clones the source code and
$ pip install git+ssh://[email protected]/JSS95/araviq6.git

If you want to pass install options, you need to specify the package name by ``#egg=``.
For example, the following code installs the package with every additional dependency.
For example, the following code installs the package with development dependencies.

.. code-block:: bash

$ pip install git+ssh://[email protected]/JSS95/araviq6.git#egg=araviq6[full]

.. note::

If you pass ``-e`` option, full source code of the project will be downloaded under ``src/`` directory in your current location.
If you pass ``-e`` option, source code of the project will be downloaded in your current location.

Installing from source
----------------------

.. _install-from-source:

If you have already downloaded the source, you can install it by passing its path to ``pip install``.
For example, in the path where ``setup.py`` is located the following command installs the package in editable mode, with full dependencies.
For example, in the path where ``pyproject.toml`` is located, the following command installs the package in editable mode, with full dependencies for developers.

.. code-block:: bash

$ pip install -e .[full]
$ pip install -e .[dev]

Installing Qt binding
=====================
Expand Down
8 changes: 4 additions & 4 deletions doc/source/user-guide/array-pipeline.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Here is the complete code:
NDArrayVideoPlayer,
NDArrayLabel,
MediaController,
get_samples_path,
get_data_path,
)

class BlurWorker(ArrayWorker):
Expand Down Expand Up @@ -81,7 +81,7 @@ Here is the complete code:

app = QApplication(sys.argv)
w = BlurWidget()
w.videoPlayer.setSource(QUrl.fromLocalFile(get_samples_path('hello.mp4')))
w.videoPlayer.setSource(QUrl.fromLocalFile(get_data_path('hello.mp4')))
w.show()
app.exec()
app.quit()
Expand All @@ -99,7 +99,7 @@ Here is the complete code:
NDArrayVideoPlayer,
NDArrayLabel,
MediaController,
get_samples_path,
get_data_path,
)

class BlurWorker(ArrayWorker):
Expand Down Expand Up @@ -134,7 +134,7 @@ Here is the complete code:

app = QApplication(sys.argv)
w = BlurWidget()
w.videoPlayer.setSource(QUrl.fromLocalFile(get_samples_path('hello.mp4')))
w.videoPlayer.setSource(QUrl.fromLocalFile(get_data_path('hello.mp4')))
w.show()
app.exec()
app.quit()
Expand Down
Loading
Loading