Skip to content

Commit b065c3a

Browse files
committed
refactor: rename pkg to pyBiocFileCache, use markdown for documentation
1 parent 239c492 commit b065c3a

28 files changed

+177
-193
lines changed

.coveragerc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# .coveragerc to control coverage.py
22
[run]
33
branch = True
4-
source = pybioccache
4+
source = pybiocfilecache
55
# omit = bad_file.py
66

77
[paths]

AUTHORS.rst renamed to AUTHORS.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
============
2-
Contributors
3-
============
1+
# Contributors
42

53
* jkanche <jayaram.kancherla@gmail.com>

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
## Version 0.1 (development)
4+
5+
- Initial release

CHANGELOG.rst

-10
This file was deleted.

CONTRIBUTING.rst

+11-11
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
Contributing
2828
============
2929

30-
Welcome to ``pyBiocCache`` contributor's guide.
30+
Welcome to ``pyBiocFileCache`` contributor's guide.
3131

3232
This document focuses on getting any potential contributor familiarized
3333
with the development processes, but `other kinds of contributions`_ are also
@@ -46,7 +46,7 @@ guidelines.
4646
Issue Reports
4747
=============
4848

49-
If you experience bugs or general issues with ``pyBiocCache``, please have a look
49+
If you experience bugs or general issues with ``pyBiocFileCache``, please have a look
5050
on the `issue tracker`_. If you don't see anything useful there, please feel
5151
free to fire an issue report.
5252

@@ -65,10 +65,10 @@ you help us to identify the root cause of the issue.
6565
Documentation Improvements
6666
==========================
6767

68-
You can help improve ``pyBiocCache`` docs by making them more readable and coherent, or
68+
You can help improve ``pyBiocFileCache`` docs by making them more readable and coherent, or
6969
by adding missing information and correcting mistakes.
7070

71-
``pyBiocCache`` documentation uses Sphinx_ as its main documentation compiler.
71+
``pyBiocFileCache`` documentation uses Sphinx_ as its main documentation compiler.
7272
This means that the docs are kept in the same repository as the project code, and
7373
that any documentation update is done in the same way was a code contribution.
7474

@@ -80,7 +80,7 @@ that any documentation update is done in the same way was a code contribution.
8080

8181
.. tip::
8282
Please notice that the `GitHub web interface`_ provides a quick way of
83-
propose changes in ``pyBiocCache``'s files. While this mechanism can
83+
propose changes in ``pyBiocFileCache``'s files. While this mechanism can
8484
be tricky for normal code contributions, it works perfectly fine for
8585
contributing to the docs, and can be quite handy.
8686

@@ -142,8 +142,8 @@ Clone the repository
142142
page. This creates a copy of the code under your account on |the repository service|.
143143
#. Clone this copy to your local disk::
144144

145-
git clone git@github.com:YourLogin/pyBiocCache.git
146-
cd pyBiocCache
145+
git clone git@github.com:YourLogin/pyBiocFileCache.git
146+
cd pyBiocFileCache
147147

148148
#. You should run::
149149

@@ -158,7 +158,7 @@ Clone the repository
158158
pip install pre-commit
159159
pre-commit install
160160

161-
``pyBiocCache`` comes with a lot of hooks configured to automatically help the
161+
``pyBiocFileCache`` comes with a lot of hooks configured to automatically help the
162162
developer to check the code being written.
163163

164164
Implement your changes
@@ -285,7 +285,7 @@ Releases
285285

286286
If you are part of the group of maintainers and have correct user permissions
287287
on PyPI_, the following steps can be used to release a new version for
288-
``pyBiocCache``:
288+
``pyBiocFileCache``:
289289

290290
#. Make sure all unit tests are successful.
291291
#. Tag the current commit on the main branch with a release tag, e.g., ``v1.2.3``.
@@ -314,8 +314,8 @@ on PyPI_, the following steps can be used to release a new version for
314314
.. |the repository service| replace:: GitHub
315315
.. |contribute button| replace:: "Create pull request"
316316

317-
.. _repository: https://github.com/<USERNAME>/pyBiocCache
318-
.. _issue tracker: https://github.com/<USERNAME>/pyBiocCache/issues
317+
.. _repository: https://github.com/<USERNAME>/pyBiocFileCache
318+
.. _issue tracker: https://github.com/<USERNAME>/pyBiocFileCache/issues
319319
.. <-- end -->
320320
321321

README.md

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# pyBiocFileCache
2+
3+
An attempt at the Python implementation of
4+
the [BiocFileCache R package](https://github.com/Bioconductor/BiocFileCache)
5+
6+
Note: Package is in development. Use with caution!!
7+
8+
9+
10+
11+
## Description
12+
13+
#### Create a cache directory
14+
15+
```
16+
from pyBiocCache import BiocFileCache
17+
import os
18+
19+
bfc = BiocFileCache(cache_dir = os.getcwd() + "/cache")
20+
```
21+
22+
Once the cache directory is created, the library allows
23+
- Create a resource - `add`
24+
- Get a resource from cache - `get`
25+
- Remove a resource - `remove`
26+
- update a resource - `update`
27+
- purge the entire cache - `purge`
28+
29+
#### Add a resource to cache
30+
31+
(for testing use the temp files in the `tests/data` directory)
32+
33+
```
34+
rec = bfc.add("test1", os.getcwd() + "/test1.txt")
35+
print(rec)
36+
```
37+
38+
#### Get resource from cache
39+
40+
```
41+
rec = bfc.get("test1")
42+
print(rec)
43+
```
44+
45+
#### Remove resource from cache
46+
47+
```
48+
rec = bfc.remove("test1")
49+
print(rec)
50+
```
51+
52+
#### Update resource in cache
53+
54+
```
55+
rec = bfc.get("test1"m os.getcwd() + "test2.txt")
56+
print(rec)
57+
```
58+
59+
#### purge the cache
60+
61+
```
62+
bfc.purge()
63+
```
64+
65+
66+
<!-- pyscaffold-notes -->
67+
68+
## Note
69+
70+
This project has been set up using PyScaffold 4.1. For details and usage
71+
information on PyScaffold see https://pyscaffold.org/.

README.rst

-70
This file was deleted.

docs/authors.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../AUTHORS.md

docs/authors.rst

-2
This file was deleted.

docs/changelog.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../CHANGELOG.md

docs/changelog.rst

-2
This file was deleted.

docs/conf.py

+28-7
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from sphinx import apidoc
3535

3636
output_dir = os.path.join(__location__, "api")
37-
module_dir = os.path.join(__location__, "../src/pybioccache")
37+
module_dir = os.path.join(__location__, "../src/pybiocfilecache")
3838
try:
3939
shutil.rmtree(output_dir)
4040
except FileNotFoundError:
@@ -77,8 +77,29 @@
7777
# Add any paths that contain templates here, relative to this directory.
7878
templates_path = ["_templates"]
7979

80+
81+
# Configure AutoStructify
82+
# https://recommonmark.readthedocs.io/en/latest/auto_structify.html
83+
def setup(app):
84+
from recommonmark.transform import AutoStructify
85+
86+
params = {
87+
"enable_auto_toc_tree": True,
88+
"auto_toc_tree_section": "Contents",
89+
"auto_toc_maxdepth": 2,
90+
"enable_eval_rst": True,
91+
"enable_math": True,
92+
"enable_inline_math": True,
93+
}
94+
app.add_config_value("recommonmark_config", params, True)
95+
app.add_transform(AutoStructify)
96+
97+
98+
# Enable markdown
99+
extensions.append("recommonmark")
100+
80101
# The suffix of source filenames.
81-
source_suffix = ".rst"
102+
source_suffix = [".rst", ".md"]
82103

83104
# The encoding of source files.
84105
# source_encoding = 'utf-8-sig'
@@ -87,7 +108,7 @@
87108
master_doc = "index"
88109

89110
# General information about the project.
90-
project = "pyBiocCache"
111+
project = "pyBiocFileCache"
91112
copyright = "2021, jkanche"
92113

93114
# The version info for the project you're documenting, acts as replacement for
@@ -99,7 +120,7 @@
99120
# If you don’t need the separation provided between version and release,
100121
# just set them both to the same value.
101122
try:
102-
from pybioccache import __version__ as version
123+
from pybiocfilecache import __version__ as version
103124
except ImportError:
104125
version = ""
105126

@@ -229,7 +250,7 @@
229250
# html_file_suffix = None
230251

231252
# Output file base name for HTML help builder.
232-
htmlhelp_basename = "pyBiocCache-doc"
253+
htmlhelp_basename = "pyBiocFileCache-doc"
233254

234255

235256
# -- Options for LaTeX output ------------------------------------------------
@@ -246,7 +267,7 @@
246267
# Grouping the document tree into LaTeX files. List of tuples
247268
# (source start file, target name, title, author, documentclass [howto/manual]).
248269
latex_documents = [
249-
("index", "user_guide.tex", "pyBiocCache Documentation", "jkanche", "manual")
270+
("index", "user_guide.tex", "pyBiocFileCache Documentation", "jkanche", "manual")
250271
]
251272

252273
# The name of an image file (relative to this directory) to place at the top of
@@ -283,4 +304,4 @@
283304
"pyscaffold": ("https://pyscaffold.org/en/stable", None),
284305
}
285306

286-
print(f"loading configurations for {project} {version} ...", file=sys.stderr)
307+
print(f"loading configurations for {project} {version} ...", file=sys.stderr)

docs/index.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# pyBiocFileCache
2+
3+
Add a short description here!
4+
5+
6+
## Note
7+
8+
> This is the main page of your project's [Sphinx] documentation. It is
9+
> formatted in [Markdown]. Add additional pages by creating md-files in
10+
> `docs` or rst-files (formated in [reStructuredText]) and adding links to
11+
> them in the `Contents` section below.
12+
>
13+
> Please check [Sphinx], [recommonmark] and [autostructify] for more information
14+
> about how to document your project and how to configure your preferences.
15+
16+
17+
## Contents
18+
19+
* [Overview](readme)
20+
* [License](license)
21+
* [Authors](authors)
22+
* [Changelog](changelog)
23+
* [Module Reference](api/modules)
24+
25+
26+
## Indices and tables
27+
28+
```eval_rst
29+
* :ref:`genindex`
30+
* :ref:`modindex`
31+
* :ref:`search`
32+
```
33+
34+
[Sphinx]: http://www.sphinx-doc.org/
35+
[Markdown]: https://daringfireball.net/projects/markdown/
36+
[reStructuredText]: http://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html
37+
[recommonmark]: https://recommonmark.readthedocs.io/en/latest
38+
[autostructify]: https://recommonmark.readthedocs.io/en/latest/auto_structify.html

0 commit comments

Comments
 (0)