Skip to content

Commit

Permalink
First release
Browse files Browse the repository at this point in the history
  • Loading branch information
fmauch committed May 15, 2024
0 parents commit ed4095a
Show file tree
Hide file tree
Showing 62 changed files with 5,735 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[report]
include = src/*
omit = test/*
show_missing = true
41 changes: 41 additions & 0 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Coverage
on:
workflow_dispatch:
pull_request:
push:
branches:
- main

jobs:
test:
name: run tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-22.04
ros_distribution: humble

steps:
- uses: actions/checkout@v3
- name: Setup ROS
uses: ros-tooling/[email protected]
with:
required-ros-distributions: ${{ matrix.ros_distribution }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest-cov codecov
python setup.py develop
- name: Test with pytest
run: |
source bin/rob_folders_source.sh
python3 -m pytest . -rA --cov=robot_folders --cov-report term --cov-report xml:coverage.xml
#- name: Upload coverage to Codecov
#uses: codecov/codecov-action@v4
#with:
#file: ./coverage.xml
#flags: unittests
#name: codecov-umbrella
#fail_ci_if_error: true
#token: ${{ secrets.CODECOV_TOKEN }}
37 changes: 37 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
##
## Copyright (c) 2024 FZI Forschungszentrum Informatik
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (the "Software"), to deal
## in the Software without restriction, including without limitation the rights
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
## copies of the Software, and to permit persons to whom the Software is
## furnished to do so, subject to the following conditions:
##
## The above copyright notice and this permission notice shall be included in
## all copies or substantial portions of the Software.
##
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
## THE SOFTWARE.
##
name: "Build documentation"
on:
workflow_dispatch:
pull_request:
push:
branches:
- main

jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ammaraskar/sphinx-action@master
with:
docs-folder: "docs/"
32 changes: 32 additions & 0 deletions .github/workflows/package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Package
on:
workflow_dispatch:
pull_request:
push:
branches:
- main

jobs:
package:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- '3.10'
- '3.11'
name: Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Build package
run: |
python -m pip install build twine check-wheel-contents
python -m build --sdist --wheel .
ls -l dist
check-wheel-contents dist/*.whl
- name: "Check long_description"
run: "python -m twine check dist/*"
21 changes: 21 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: pre-commit
on:
workflow_dispatch:
pull_request:
push:
branches:
- main

jobs:
pre-commit:
name: pre-commit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- uses: pre-commit/[email protected]
with:
extra_args: --all-files --hook-stage manual
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*~
config/userconfig.yaml
checkout
*.pyc
robot_folders.egg-info
src/robot_folders/build/
build/
dist/
18 changes: 18 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-xml
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- id: fix-byte-order-marker # Forbid UTF-8 byte-order markers
- repo: https://github.com/psf/black
rev: 24.3.0
hooks:
- id: black
23 changes: 23 additions & 0 deletions Docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM ros:iron

RUN apt-get update && apt-get install -y --no-install-recommends \
python3-pip \
zsh \
stow \
git \
golang-go \
curl \
wget \
tmux \
python3-argcomplete \
ros-humble-ros-base \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

WORKDIR /root

COPY ./entrypoint.sh /
COPY ./source_global.sh /root

ENTRYPOINT ["/entrypoint.sh"]
24 changes: 24 additions & 0 deletions Docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# robot_folders development container

This dockerfile is mainly used for testing on clean systems. It is not by any means cleanly
maintained or wants to be documented for end users.

We usually use it for development as such (all run from this project's root directory)

1. Build the container

```bash
docker build -t robot_folders Docker
```

2. Run the container
```bash
docker run -it -v .:/robot_folders --rm robot_folders /usr/bin/zsh # replace with /bin/bash to test
# You can also mount a checkout folder to be persistent with that between runs
docker run -it -v .:/robot_folders ~/checkout_playground:/root/checkout --rm robot_folders /usr/bin/zsh
```

3. Inside the container source robot_folders
```bash
source source_global.sh
```
5 changes: 5 additions & 0 deletions Docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/zsh

pip3 install -e /robot_folders

exec "$@"
1 change: 1 addition & 0 deletions Docker/source_global.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
source /usr/local/bin/rob_folders_source.sh
17 changes: 17 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
71 changes: 71 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
Robot Folders
=============

Welcome to ``robot_folders``! ``robot_folders`` is a collection of utility scripts designed to
streamline and facilitate the management of workspaces used for (ROS) development. It is designed
to enhance efficiency in handling different environments, consisting of multiple workspaces like a
``catkin_workspace`` and ``colcon_workspace`` or a plain CMake workspace.

It focuses on optimizing the management of various subworkspaces, contributing
to a seamless development experience.


Quick start
------------

It is recommended to install robot_folders using ``pipx`` (You can install ``pipx`` using ``sudo apt
install pipx``). Please note: With pipx versions < 1.0 you'll have to provide the `--spec` flag

.. code:: bash
# pipx >= 1.0 (from ubuntu 22.04 on)
pipx install git+https://github.com/fzi-forschungszentrum-informatik/robot_folders.git
# pipx < 1.0 (ubuntu 20.04)
pipx install --spec git+https://github.com/fzi-forschungszentrum-informatik/robot_folders.git robot-folders
Upgrade
-------

To upgrade robot_folders using ``pipx`` do

.. code:: bash
# pipx >= 1.0 (from ubuntu 22.04 on)
pipx upgrade robot-folders
# pipx < 1.0 (ubuntu 20.04)
pipx upgrade --spec git+https://github.com/fzi-forschungszentrum-informatik/robot_folders.git robot-folders
Shell setup
-----------

In order to use ``robot_folders`` you'll have to call its source file. How to do this depends on
the way you installed ``robot_folders`` and on the version of the installation tool.

In case you have installed
``robot_folders`` using ``pipx`` as described above (and given you use the bash shell), do:

.. code:: bash
# pipx < 1.3.0 or if ${HOME}/.local/pipx already existed
echo "source ${HOME}/.local/pipx/venvs/robot-folders/bin/rob_folders_source.sh" >> ~/.bashrc
# pipx >= 1.3.0
echo "source ${HOME}/.local/share/pipx/venvs/robot-folders/bin/rob_folders_source.sh" >> ~/.bashrc
In case you manually installed ``robot_folders`` using a python virtualenv the path is similarly

.. code:: bash
echo "source <your-vurtualenv-path>/bin/rob_folders_source.sh" >> ~/.bashrc
Basic usage
-----------

After installation open up a new terminal to use robot_folders. The main
command for using robot_folders is ``fzirob``. Type

.. code:: bash
fzirob --help
to get an overview over all available commands.
53 changes: 53 additions & 0 deletions bin/rob_folders-complete.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
##
## Copyright (c) 2024 FZI Forschungszentrum Informatik
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (the "Software"), to deal
## in the Software without restriction, including without limitation the rights
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
## copies of the Software, and to permit persons to whom the Software is
## furnished to do so, subject to the following conditions:
##
## The above copyright notice and this permission notice shall be included in
## all copies or substantial portions of the Software.
##
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
## THE SOFTWARE.
##

if [ -n "${ZSH_VERSION+1}" ];
then
compdef _rob_folders_completion fzirob
fi
if [ -n "${BASH_VERSION+1}" ];
then
_fzirob_completion() {
# replace 'fzirob' with 'rob_folders' for completion
_rob_folders_completion rob_folders ${@:2}
return 0
}
complete -F _fzirob_completion -o default fzirob
fi
#complete -F _rob_folders_completion -o default rob_folders;

# ce completion in zsh works through the alias definition. For bash we have to declare it.
if [ -n "${BASH_VERSION+1}" ];
then
_ce_completion() {
checkout_dir=$(rob_folders get_checkout_base_dir)
#_envs=$(ls ${checkout_dir})
_envs=$(ce --help | sed -e '1,/Commands:/d' )
local cur prev
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
COMPREPLY=( $(compgen -W "${_envs}" -- ${cur}) )
return 0
}

complete -F _ce_completion -o default ce;
fi
Loading

0 comments on commit ed4095a

Please sign in to comment.