Skip to content
Open
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
3 changes: 3 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ jobs:

steps:
- uses: actions/checkout@v7
with:
# setuptools-scm uses release tags to version the installed package.
fetch-depth: 0

- uses: actions/setup-python@v7
with:
Expand Down
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
For release notes, see https://github.com/iterative/PyDrive2/releases.

v1.0.0, Aug 16, 2013 -- Initial release.
18 changes: 8 additions & 10 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
Contributing guidelines
=======================

How to become a contributor and submit your own code
----------------------------------------------------

TODO

Contributing code
~~~~~~~~~~~~~~~~~
-----------------

If you have improvements to PyDrive2, send us your pull requests! For those
just getting started, Github has a `howto`_.
Submit changes in a pull request. GitHub's `pull request guide`_ describes
how to propose and review changes.

Install the development tools with
``python -m pip install -e '.[tests,fsspec,typing]'``. Run ``ruff check .`` to
lint Python files and ``ruff format .`` to format them. Run ``python -m mypy``
to type-check the package for Python 3.11.

.. _howto: https://help.github.com/articles/using-pull-requests/
See the `test guide <pydrive2/test/README.rst>`_ for offline and live suites
and the `documentation guide <docs/README.md>`_ to preview the site.

.. _pull request guide: https://docs.github.com/en/pull-requests

Live Drive tests for external pull requests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-------------------------------------------

Fork and Dependabot PRs run offline tests automatically. A repository
maintainer or admin can comment ``/test-drive`` to request live tests.
Expand Down
36 changes: 14 additions & 22 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,19 @@
This document outlines how to rebuild the documentation.
# Building the PyDrive2 documentation

## Setup
From the repository root, install the package with fsspec support and the
documentation dependencies. Sphinx imports the installed package to generate
the API reference.

- Install Sphinx: `pip install sphinx` or `apt-get install python-sphinx`
- Install theme: `pip install furo`
- Build site: `sphinx-build docs dist/site -b dirhtml -a`

Updating GitHub Pages:

```bash
cd dist/site
git init
git add .
git commit -m "update pages"
git branch -M gh-pages
git push -f git@github.com:iterative/PyDrive2 gh-pages
```sh
python -m pip install -e '.[fsspec]' -r docs/requirements.txt
python -m sphinx -W --keep-going -b dirhtml docs dist/site
python -m http.server --directory dist/site 8000
```

## Contributing

If code files were added, the easiest way to reflect code changes in the
documentation by referencing the file from within `pydrive.rst`.
Open <http://localhost:8000/> to preview the site. To check external links,
run `python -m sphinx -b linkcheck docs dist/linkcheck`.

If a non-code related file was added (it has to have the `.rst` ending),
then add the file name to the list of names under "Table of Contents"
in `index.rst`. Make sure to add the file name excluding the `.rst` file ending.
Add new guides to the table of contents in `docs/index.rst`. Public modules
and classes are documented in `docs/pydrive2.rst`. The **Build docs**
workflow builds pull requests and publishes successful builds from `main`
to GitHub Pages.
13 changes: 5 additions & 8 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import os
import sys
from importlib.metadata import version as package_version

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand All @@ -22,9 +23,6 @@
exclude_dirnames = ["test"]
# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
needs_sphinx = "1.8"

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
Expand Down Expand Up @@ -56,10 +54,9 @@
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = "1.19.0"
# The full version, including alpha/beta/rc tags.
release = "1.19.0"
release = package_version("PyDrive2")
version = ".".join(release.split(".")[:2])
html_title = f"{project} documentation"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down Expand Up @@ -279,7 +276,7 @@
"PyDrive2 Documentation",
author,
"PyDrive2",
"One line description of project.",
"Python client and fsspec filesystem for Google Drive.",
"Miscellaneous",
)
]
Expand Down
9 changes: 5 additions & 4 deletions docs/filelist.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ File listing made easy
PyDrive2 handles pagination and returns
:class:`~pydrive2.files.GoogleDriveFile` instances.

Get all files which matches the query
-------------------------------------
.. _get-all-files-which-matches-the-query:

List matching files
-------------------

Pass the `files.list query parameters`_ to
:meth:`~pydrive2.drive.GoogleDrive.ListFile` as a dictionary. It returns a
Expand Down Expand Up @@ -44,8 +46,7 @@ contains up to ten files.

.. code-block:: python

# Paginate file lists by specifying number of max results
for file_list in drive.ListFile({'q': 'trashed=true', 'pageSize': 10}):
for file_list in drive.ListFile({'q': 'trashed=false', 'pageSize': 10}):
print('Received %s files from Files.list()' % len(file_list)) # <= 10
for file1 in file_list:
print('name: %s, id: %s' % (file1['name'], file1['id']))
Expand Down
Loading
Loading