Skip to content
Merged
97 changes: 5 additions & 92 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,95 +1,8 @@
from sio3pack.graph import GraphOperation

# SIO3Pack

## Prerequisites
```
- Python 3.9 or higher
- pip
- Linux or macOS operating system
- Django 4.2.x (for Django support)
```

## Instalation
```
pip install sio3pack
```
## Example usage (in python)

### In OIOIOI

```python
# Package unpacking
import sio3pack, sio3workers
from django.conf import settings

package = sio3pack.from_file(path_to_package, django_settings=settings)
graph_op: GraphOperation = package.get_unpack_operation()
results = sioworkers.run(graph_op)
graph_op.return_results(results)
package.save_to_db(problem_id=1)
```

### Locally (for example `sinol-make`)

```python
import sio3pack, sio3workers.local

package = sio3pack.from_file(path_to_package)
graph_op: GraphOperation = package.get_unpack_operation()
results = sio3workers.local.run(graph_op)
graph_op.return_results(results)
```

---

## Development

### Test without django support

Install the package in editable mode and make sure that `django` and
`pytest-django` are not installed.

```bash
pip install -e ".[tests]"
pip uninstall django pytest-django
```

Then follow the instructions in
[General testing information](#general-testing-information).


### Test with django support

Install the package in editable mode along with Django dependencies:

```bash
pip install -e ".[django,tests,django_tests]"
```

Then follow the instructions in
[General testing information](#general-testing-information).


### General testing information

Run the tests with `pytest` in the root directory of
the repository.

```bash
pytest -v
```

To run tests in parallel, use the following command.

```bash
pytest -v -n auto
```

To run coverage tests, use the following command.

```bash
pytest -v --cov=sio3pack --cov-report=html
```
SIO3Pack is a Python package designed to facilitate the creation and manipulation
of packages supported by the SIO2 system. It provides a set of classes and functions
to handle various operations related to package interaction, including workflow
management and creation.

The coverage report will be generated in the file `htmlcov/index.html`.
Full documentation is available at [SIO3Pack Documentation](https://sio2project.github.io/SIO3Pack/).
11 changes: 11 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

import sio3pack
import django
import sys
import os


sys.path.append(os.path.abspath('../tests/test_django'))
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'test_django.settings')
django.setup()


project = 'SIO3Pack'
copyright = '2025, Tomasz Kwiatkowski, Mateusz Masiarz, Jakub Rożek, Stanisław Struzik'
Expand All @@ -21,6 +30,7 @@
'sphinx.ext.autodoc', # Also required by AutoAPI.
'sphinx.ext.viewcode',
'sphinx.ext.intersphinx',
'sphinx.ext.coverage',
]

templates_path = ['_templates']
Expand All @@ -38,6 +48,7 @@
autoapi_include = [
"sio3pack.django.common.handler.DjangoHandler",
"sio3pack.django.sinolpack.handler.SinolpackDjangoHandler",
"sio3pack.files.remote_file.RemoteFile",
]
autodoc_typehints = 'description'

Expand Down
64 changes: 64 additions & 0 deletions docs/development.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
Development
===========

This section is intended for developers who want to contribute to the project or understand its inner workings.
It provides guidelines on how to set up the development environment, run tests, and contribute code.

Setting Up the Development Environment
--------------------------------------

If you want to develop or run tests without Django support, you can use the following command:

.. code-block:: bash

pip install -e .[tests]
pip uninstall django pytest-django

This will install the package in editable mode, without Django support. Uninstall Django and pytest-django to make sure
that the tests run without Django support.

If you want to run tests with Django support, you can use the following command:

.. code-block:: bash

pip install -e .[django,tests,django_tests]

This will install the package in editable mode with Django support, along with the necessary testing dependencies.

Running Tests
-------------

To run the tests, you can use the following command:

.. code-block:: bash

pytest -v

The tests can also be run in parallel using the `pytest-xdist` plugin. To do this, you can use the following command:

.. code-block:: bash

pytest -v -n auto

You can also run coverage reports to see how much of the code is covered by tests. To do this, you can use the following
command:

.. code-block:: bash

pytest --cov=src --cov-report=html --cov-report=html

The coverage report will be generated in the `htmlcov` directory, and you can open the `index.html` file in your web browser
to view the report.

Contributing Code
-----------------

If you want to contribute code to the project, please follow these guidelines:
1. Fork the repository and create a new branch for your feature or bug fix.
2. Write tests for your code and make sure they pass.
3. Make sure your code follows the project's coding style and conventions.
4. Submit a pull request with a clear description of your changes and why they are needed.
5. Be open to feedback and willing to make changes based on code reviews.
6. Ensure that your code is well-documented, including docstrings for functions and classes.
7. Update the documentation if your changes affect the usage or functionality of the package.
8. Keep your pull request focused on a single feature or bug fix to make it easier to review.
3 changes: 3 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ SIO3Pack documentation
:maxdepth: 2
:caption: Contents:

usage
workflows
sinolpack
development
Loading