Skip to content

Commit 45c7657

Browse files
authored
small documentation update (#77)
* set up dev environment stuff --------- Signed-off-by: Alexander Piskun <[email protected]>
1 parent 4a9f778 commit 45c7657

File tree

13 files changed

+79
-19
lines changed

13 files changed

+79
-19
lines changed

.github/CONTRIBUTING.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,15 @@ Please send a pull request to the `main` branch. Feel free to ask questions [vi
99

1010
- Fork the nc_py_api repository.
1111
- Create a new branch from `main`.
12-
- Install dev requirements with `pip install ".[dev]"`
13-
- Develop bug fixes, features, tests, etc.
14-
- Most of the tests are designed to run from under the GitHub actions. If you want to run them locally, see this [guide](to-do)
15-
- Install `pylint` locally, it will run during `pre-commit`.
16-
- Install `pre-commit` hooks by `pre-commit install` command.
12+
- Set up development environment as described in a [Setting up dev environment](https://cloud-py-api.github.io/nc_py_api/DevSetup.html)
1713
- Create a pull request to pull the changes from your branch to the nc_py_api `main`.
1814

1915
### Guidelines
2016

2117
- Separate code commits from reformatting commits.
2218
- Where possible, provide tests for any newly added code.
2319
- Follow PEP 8.
24-
- Update CHANGELOG.md as needed or appropriate with your bug fixes, feature additions and tests.
20+
- Update CHANGELOG.md as needed or appropriate with your bug fixes, feature additions, and tests.
2521

2622
## Security vulnerabilities
2723

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
All notable changes to this project will be documented in this file.
44

5-
## [0.0.29 - 2023-08-14]
5+
## [0.0.29 - 2023-08-13]
66

77
### Added
88

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@ In a very close near future we will publish examples
5151
- [Contribute](https://github.com/cloud-py-api/nc_py_api/blob/main/.github/CONTRIBUTING.md)
5252
- [Discussions](https://github.com/cloud-py-api/nc_py_api/discussions)
5353
- [Issues](https://github.com/cloud-py-api/nc_py_api/issues)
54-
- [Setting up dev environment](to-do)
54+
- [Setting up dev environment](https://cloud-py-api.github.io/nc_py_api/DevSetup.html)
5555
- [Changelog](https://github.com/cloud-py-api/nc_py_api/blob/main/CHANGELOG.md)

docs/DevSetup.rst

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
Setting up dev environment
2+
==========================
3+
4+
We highly recommend to use `Julius Haertl docker setup <https://github.com/juliushaertl/nextcloud-docker-dev>`_ for Nextcloud dev setup.
5+
6+
Development of `nc-py-api` can be done on any OS as it is a **pure** Python package.
7+
8+
Suggested IDE: **PyCharm**, but of course you can use any IDE you like for this like **VS Code** or **Vim**.
9+
10+
Steps to setup up the development environment:
11+
12+
#. Setup Nextcloud locally or remotely.
13+
#. Install `AppEcosystem <https://github.com/cloud-py-api/app_ecosystem_v2>`_, follow it's steps to register ``deploy daemon`` if needed.
14+
#. Clone the `nc_py_api <https://github.com/cloud-py-api/nc_py_api>`_ with :command:`shell`::
15+
16+
git clone https://github.com/cloud-py-api/nc_py_api.git
17+
18+
#. Set current working dir to the root folder of cloned **nc_py_api** with :command:`shell`::
19+
20+
cd nc_py_api
21+
22+
#. Create and activate Virtual Environment with :command:`shell`::
23+
24+
python3 -m venv env
25+
26+
#. Activate Python Virtual Environment with :command:`shell`::
27+
28+
source ./env/bin/activate
29+
30+
#. Update ``pip`` to the last version with :command:`pip`::
31+
32+
python3 -m pip install --upgrade pip
33+
34+
#. Install dev-dependencies with :command:`pip`::
35+
36+
pip install ".[dev]"
37+
38+
#. Install `pre-commit` hooks with :command:`shell`::
39+
40+
pre-commit install
41+
42+
#. If ``deploy daemon`` is registered for AppEcosystem, register **nc_py_api** as an application with :command:`shell`::
43+
44+
make register28
45+
46+
#. In ``tests/gfixture.py`` edit ``NC_AUTH_USER`` and ``NC_AUTH_PASS``, if they are different in your setup.
47+
#. Run tests to check that everything works with :command:`shell`::
48+
49+
python3 -m pytest
50+
51+
#. Install documentation dependencies if needed with :command:`pip`::
52+
53+
pip install ".[docs]"
54+
55+
#. You can easy build documentation with :command:`shell`::
56+
57+
make docs
58+
59+
#. **Your setup is ready for the developing nc_py_api and Applications based on it. Best of Luck!**

docs/FirstSteps.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Getting list of files of User
4343

4444
This is a hard way to get list of all files recursively:
4545

46-
.. literalinclude:: ../examples/as_client/files_listing.py
46+
.. literalinclude:: ../examples/as_client/files/listing.py
4747

4848
This code do the same in one DAV call, but prints **directories** in addition to files:
4949

@@ -73,7 +73,7 @@ Uploading a single file
7373
It is always better to use ``upload_stream`` instead of ``upload`` as it works
7474
with chunks and ``in future`` will support **multi threaded** upload.
7575

76-
.. literalinclude:: ../examples/as_client/files_upload.py
76+
.. literalinclude:: ../examples/as_client/files/upload.py
7777

7878
Downloading a single file
7979
"""""""""""""""""""""""""
@@ -82,4 +82,4 @@ A very simple example of downloading an image as one piece of data to memory and
8282

8383
.. note:: For big files, it is always better to use ``download2stream`` method, as it uses chunks.
8484

85-
.. literalinclude:: ../examples/as_client/files_download.py
85+
.. literalinclude:: ../examples/as_client/files/download.py

docs/Installation.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,23 @@ Installation
33

44
First it is always a good idea to update ``pip`` to the latest version with :command:`pip`::
55

6-
python3 -m pip install --upgrade pip
6+
python -m pip install --upgrade pip
77

88
To use it as a simple Nextcloud client install it without any additional dependencies with :command:`pip`::
99

10-
python3 -m pip install --upgrade nc_py_api
10+
python -m pip install --upgrade nc_py_api
1111

1212
To use in the Nextcloud Application mode install it with additional ``app`` dependencies with :command:`pip`::
1313

14-
python3 -m pip install --upgrade "nc_py_api[app]"
14+
python -m pip install --upgrade "nc_py_api[app]"
1515

1616
To join the development of **nc_py_api** api install development dependencies with :command:`pip`::
1717

18-
python3 -m pip install --upgrade "nc_py_api[dev]"
18+
python -m pip install --upgrade "nc_py_api[dev]"
19+
20+
Or install last dev-version from GitHub with :command:`pip`::
21+
22+
python -m pip install --upgrade "nc_py_api[dev] @ git+https://github.com/cloud-py-api/nc_py_api"
1923

2024
Congratulations, the next chapter :ref:`first-steps` awaits.
2125

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Have a great time with Python and Nextcloud!
3131
FirstSteps
3232
Options
3333
reference/index.rst
34+
DevSetup
3435
benchmarks/AppEcosystem.rst
3536

3637
Indices and tables

docs/reference/Files/Files.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ File System
22
===========
33

44
The Files API is universal for both modes and provides all the necessary methods for working with the Nextcloud file system.
5-
Refer to the **fs examples** to see how to use them nicely.
5+
Refer to the `Files examples <https://github.com/cloud-py-api/nc_py_api/tree/main/examples/as_client/files>`_ to see how to use them nicely.
66

77
All File APIs are designed to work relative to the current user.
88

docs/reference/Files/Shares.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ File Sharing
22
============
33

44
The Shares API is universal for both modes and provides all the necessary methods for working with the Nextcloud Shares system.
5-
Refer to the **share examples** to see how to use them nicely.
5+
Refer to the `Sharing examples <https://github.com/cloud-py-api/nc_py_api/tree/main/examples/as_client/sharing>`_ to see how to use them nicely.
66

77
.. autoclass:: nc_py_api.files.sharing._FilesSharingAPI
88
:members:

examples/as_app/to_gif/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ def enabled_handler(enabled: bool, nc: NextcloudApp) -> str:
8585
print(f"enabled={enabled}")
8686
try:
8787
if enabled:
88-
nc.gui.files_dropdown_menu.register("to_gif", "TO GIF", "/video_to_gif", mime="video")
88+
nc.ui.files_dropdown_menu.register("to_gif", "TO GIF", "/video_to_gif", mime="video")
8989
else:
90-
nc.gui.files_dropdown_menu.unregister("to_gif")
90+
nc.ui.files_dropdown_menu.unregister("to_gif")
9191
except Exception as e:
9292
return str(e)
9393
return ""

0 commit comments

Comments
 (0)