diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 82f1468..37acbb7 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
- python-version: ['3.7', '3.8', '3.9']
+ python-version: ['3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v2
@@ -23,16 +23,13 @@ jobs:
- name: Install dependencies
run: |
- pip3 install codecov pytest-cov || pip3 install --user codecov pytest-cov;
+ pip3 install pytest-cov || pip3 install --user pytest-cov;
- name: Run tests
run: |
- pip3 install .
- coverage run --source=rdata/ --omit=rdata/tests/ setup.py test;
-
- - name: Generate coverage XML
- run: |
- coverage xml
+ pip3 debug --verbose .
+ pip3 install ".[test]"
+ pytest --cov=rdata/ --cov-report=xml
- name: Upload coverage to Codecov
- uses: codecov/codecov-action@v2
+ uses: codecov/codecov-action@v3
diff --git a/MANIFEST.in b/MANIFEST.in
index 4e06f8e..b2a9ec4 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,5 +1,4 @@
include MANIFEST.in
-include rdata/VERSION
include LICENSE
include rdata/py.typed
include *.txt
\ No newline at end of file
diff --git a/README.rst b/README.rst
index 1dd572e..23fa83a 100644
--- a/README.rst
+++ b/README.rst
@@ -1,14 +1,35 @@
rdata
=====
-|build-status| |docs| |coverage| |landscape| |pypi| |zenodo|
+|build-status| |docs| |coverage| |pypi| |zenodo|
Read R datasets from Python.
..
Github does not support include in README for dubious security reasons, so
we copy-paste instead. Also Github does not understand Sphinx directives.
+ .. include:: docs/index.rst
.. include:: docs/simpleusage.rst
+
+The package rdata offers a lightweight way to import R datasets/objects stored
+in the ".rda" and ".rds" formats into Python.
+Its main advantages are:
+
+- It is a pure Python implementation, with no dependencies on the R language or
+ related libraries.
+ Thus, it can be used anywhere where Python is supported, including the web
+ using `Pyodide `_.
+- It attempt to support all R objects that can be meaningfully translated.
+ As opposed to other solutions, you are no limited to import dataframes or
+ data with a particular structure.
+- It allows users to easily customize the conversion of R classes to Python
+ ones.
+ Does your data use custom R classes?
+ Worry no longer, as it is possible to define custom conversions to the Python
+ classes of your choosing.
+- It has a permissive license (MIT). As opposed to other packages that depend
+ on R libraries and thus need to adhere to the GPL license, you can use rdata
+ as a dependency on MIT, BSD or even closed source projects.
Installation
============
@@ -123,10 +144,6 @@ Pandas `Categorical` objects:
:scale: 100%
:target: https://codecov.io/gh/vnmabus/rdata/branch/develop
-.. |landscape| image:: https://landscape.io/github/vnmabus/rdata/develop/landscape.svg?style=flat
- :target: https://landscape.io/github/vnmabus/rdata/develop
- :alt: Code Health
-
.. |pypi| image:: https://badge.fury.io/py/rdata.svg
:alt: Pypi version
:scale: 100%
diff --git a/conftest.py b/conftest.py
index 98c75b2..e69de29 100644
--- a/conftest.py
+++ b/conftest.py
@@ -1 +0,0 @@
-collect_ignore = ['setup.py']
diff --git a/docs/.gitignore b/docs/.gitignore
index c8f9082..d215bb7 100644
--- a/docs/.gitignore
+++ b/docs/.gitignore
@@ -1,2 +1,4 @@
/functions/
/modules/
+/auto_examples/
+/jupyterlite_contents/
diff --git a/docs/__init__.py b/docs/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/docs/_static/switcher.json b/docs/_static/switcher.json
new file mode 100644
index 0000000..c25ebb2
--- /dev/null
+++ b/docs/_static/switcher.json
@@ -0,0 +1,13 @@
+[
+ {
+ "name": "dev",
+ "version": "dev",
+ "url": "https://rdata.readthedocs.io/en/latest/"
+ },
+ {
+ "name": "0.9 (stable)",
+ "version": "stable",
+ "url": "https://rdata.readthedocs.io/en/stable/",
+ "preferred": true
+ }
+]
\ No newline at end of file
diff --git a/docs/_templates/autosummary/class.rst b/docs/_templates/autosummary/class.rst
index ad62005..92c62e1 100644
--- a/docs/_templates/autosummary/class.rst
+++ b/docs/_templates/autosummary/class.rst
@@ -1,29 +1,25 @@
{{ objname | escape | underline}}
+
.. currentmodule:: {{ module }}
.. autoclass:: {{ objname }}
{% block methods %}
{% if methods %}
- .. rubric:: Methods
+ .. rubric:: {{ _('Methods') }}
.. autosummary::
{% for item in methods %}
- ~{{ name }}.{{ item }}
+ {% if item != "__init__" %}
+ ~{{ name }}.{{ item }}
+ {% endif %}
{%- endfor %}
{% endif %}
- .. automethod:: __init__
- {% endblock %}
-
- {% block attributes %}
- {% if attributes %}
- .. rubric:: Attributes
-
- .. autosummary::
- {% for item in attributes %}
- ~{{ name }}.{{ item }}
+ {% for item in methods %}
+ {% if item != "__init__" %}
+ .. automethod:: {{ item }}
+ {% endif %}
{%- endfor %}
- {% endif %}
{% endblock %}
\ No newline at end of file
diff --git a/docs/_templates/autosummary/module.rst b/docs/_templates/autosummary/module.rst
deleted file mode 100644
index 069e85f..0000000
--- a/docs/_templates/autosummary/module.rst
+++ /dev/null
@@ -1,64 +0,0 @@
-{{ objname | escape | underline}}
-
-.. automodule:: {{ fullname }}
-
- {% block attributes %}
- {% if attributes %}
- .. rubric:: {{ _('Module Attributes') }}
-
- .. autosummary::
- :toctree:
- {% for item in attributes %}
- {{ item }}
- {%- endfor %}
- {% endif %}
- {% endblock %}
-
- {% block functions %}
- {% if functions %}
- .. rubric:: {{ _('Functions') }}
-
- .. autosummary::
- :toctree:
- {% for item in functions %}
- {{ item }}
- {%- endfor %}
- {% endif %}
- {% endblock %}
-
- {% block classes %}
- {% if classes %}
- .. rubric:: {{ _('Classes') }}
-
- .. autosummary::
- :toctree:
- {% for item in classes %}
- {{ item }}
- {%- endfor %}
- {% endif %}
- {% endblock %}
-
- {% block exceptions %}
- {% if exceptions %}
- .. rubric:: {{ _('Exceptions') }}
-
- .. autosummary::
- :toctree:
- {% for item in exceptions %}
- {{ item }}
- {%- endfor %}
- {% endif %}
- {% endblock %}
-
-{% block modules %}
-{% if modules %}
-.. rubric:: Modules
-
-.. autosummary::
- :toctree:
- :recursive:
-{% for item in modules %}
- {{ item }}
-{%- endfor %}
-{% endif %}
-{% endblock %}
\ No newline at end of file
diff --git a/docs/conf.py b/docs/conf.py
index 04d31bb..71a9c2a 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
-# dcor documentation build configuration file, created by
+# rdata documentation build configuration file, created by
# sphinx-quickstart on Tue Aug 7 12:49:32 2018.
#
# This file is execfile()d with the current directory set to its
@@ -17,25 +17,44 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
-# import os
-# import sys
-# sys.path.insert(0, '/home/carlos/git/rdata/rdata')
-
+import os
import sys
+import warnings
import pkg_resources
+import rdata
+import textwrap
+
+# General information about the project.
+project = "rdata"
+author = "Carlos Ramos Carreño"
+copyright = "2018, Carlos Ramos Carreño"
+github_url = "https://github.com/vnmabus/rdata"
+rtd_version = os.environ.get("READTHEDOCS_VERSION")
+rtd_version_type = os.environ.get("READTHEDOCS_VERSION_TYPE")
+
+switcher_version = rtd_version
+if switcher_version == "latest":
+ switcher_version = "dev"
+elif rtd_version_type not in {"branch", "tag"}:
+ switcher_version = rdata.__version__
+
+rtd_branch = os.environ.get(" READTHEDOCS_GIT_IDENTIFIER", "develop")
+language = "en"
try:
- release = pkg_resources.get_distribution('rdata').version
+ release = pkg_resources.get_distribution("rdata").version
except pkg_resources.DistributionNotFound:
- print('To build the documentation, The distribution information of rdata\n'
- 'Has to be available. Either install the package into your\n'
- 'development environment or run "setup.py develop" to setup the\n'
- 'metadata. A virtualenv is recommended!\n')
+ print(
+ f"To build the documentation, The distribution information of\n"
+ f"{project} has to be available. Either install the package\n"
+ f"into your development environment or run 'setup.py develop'\n"
+ f"to setup the metadata. A virtualenv is recommended!\n",
+ )
sys.exit(1)
del pkg_resources
-version = '.'.join(release.split('.')[:2])
+version = ".".join(release.split(".")[:2])
# -- General configuration ------------------------------------------------
@@ -46,126 +65,101 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
-extensions = ['sphinx.ext.autodoc',
- 'sphinx.ext.autosummary',
- 'sphinx.ext.todo',
- 'sphinx.ext.viewcode',
- 'sphinx.ext.napoleon',
- 'sphinx.ext.mathjax',
- 'sphinx.ext.intersphinx']
+extensions = [
+ "sphinx.ext.autodoc",
+ "sphinx.ext.autosummary",
+ "sphinx.ext.intersphinx",
+ "sphinx.ext.mathjax",
+ "sphinx.ext.napoleon",
+ "sphinx.ext.todo",
+ "sphinx.ext.viewcode",
+ "sphinx_gallery.gen_gallery",
+ "jupyterlite_sphinx", # Move after sphinx gallery
+]
# Add any paths that contain templates here, relative to this directory.
-templates_path = ['_templates']
+templates_path = ["_templates"]
# The suffix(es) of source filenames.
-# You can specify multiple suffix as a list of string:
-#
-# source_suffix = ['.rst', '.md']
-source_suffix = '.rst'
+source_suffix = ".rst"
# The master toctree document.
-master_doc = 'index'
-
-# General information about the project.
-project = 'rdata'
-copyright = '2018, Carlos Ramos Carreño'
-author = 'Carlos Ramos Carreño'
-
-# The version info for the project you're documenting, acts as replacement for
-# |version| and |release|, also used in various other places throughout the
-# built documents.
-#
-# The short X.Y version.
-# version = ''
-# The full version, including alpha/beta/rc tags.
-# release = ''
-
-# The language for content autogenerated by Sphinx. Refer to documentation
-# for a list of supported languages.
-#
-# This is also used if you do content translation via gettext catalogs.
-# Usually you set "language" from the command line for these cases.
-language = 'en'
+master_doc = "index"
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
-exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
+exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
# The name of the Pygments (syntax highlighting) style to use.
-pygments_style = 'sphinx'
+pygments_style = "sphinx"
-# If true, `todo` and `todoList` produce output, else they produce nothing.
-todo_include_todos = True
add_module_names = False
-autosummary_generate = True
-
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
-html_theme = 'sphinx_rtd_theme'
+html_theme = "pydata_sphinx_theme"
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
-# html_theme_options = {}
+html_theme_options = {
+ "use_edit_page_button": True,
+ "github_url": github_url,
+ "switcher": {
+ "json_url": (
+ "https://rdata.readthedocs.io/en/latest/_static/switcher.json"
+ ),
+ "version_match": switcher_version,
+ },
+ "show_version_warning_banner": True,
+ "navbar_start": ["navbar-logo", "version-switcher"],
+ "icon_links": [
+ {
+ "name": "PyPI",
+ "url": "https://pypi.org/project/rdata",
+ "icon": "https://avatars.githubusercontent.com/u/2964877",
+ "type": "url",
+ },
+ {
+ "name": "Anaconda",
+ "url": "https://anaconda.org/conda-forge/rdata",
+ "icon": "https://avatars.githubusercontent.com/u/3571983",
+ "type": "url",
+ },
+ ],
+ "logo": {
+ "text": "🗃 rdata",
+ },
+}
+
+html_context = {
+ "github_user": "vnmabus",
+ "github_repo": "rdata",
+ "github_version": "develop",
+ "doc_path": "docs",
+}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
-html_static_path = ['_static']
-
-# Custom sidebar templates, must be a dictionary that maps document names
-# to template names.
-#
-# This is required for the alabaster theme
-# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
-html_sidebars = {
- '**': [
- 'about.html',
- 'navigation.html',
- 'relations.html', # needs 'show_related': True theme option to display
- 'searchbox.html',
- 'donate.html',
- ]
-}
-
-# -- Options for HTMLHelp output ------------------------------------------
-
-# Output file base name for HTML help builder.
-htmlhelp_basename = 'rdatadoc'
+html_static_path = ["_static"]
# -- Options for LaTeX output ---------------------------------------------
-latex_elements = {
- # The paper size ('letterpaper' or 'a4paper').
- #
- # 'papersize': 'letterpaper',
-
- # The font size ('10pt', '11pt' or '12pt').
- #
- # 'pointsize': '10pt',
-
- # Additional stuff for the LaTeX preamble.
- #
- # 'preamble': '',
-
- # Latex figure (float) alignment
- #
- # 'figure_align': 'htbp',
-}
+latex_engine = "lualatex"
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
- (master_doc, 'rdata.tex', 'rdata Documentation',
- 'Carlos Ramos Carreño', 'manual'),
+ (master_doc, "rdata.tex",
+ "rdata Documentation", author, "manual"),
]
# -- Options for manual page output ---------------------------------------
@@ -173,8 +167,7 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
- (master_doc, 'rdata', 'rdata Documentation',
- [author], 1)
+ (master_doc, "rdata", "rdata Documentation", [author], 1)
]
# -- Options for Texinfo output -------------------------------------------
@@ -183,9 +176,15 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
- (master_doc, 'rdata', 'rdata Documentation',
- author, 'rdata', 'One line description of project.',
- 'Miscellaneous'),
+ (
+ master_doc,
+ "rdata",
+ "rdata documentation",
+ author,
+ "rdata",
+ "Read R datasets from Python.",
+ "Miscellaneous",
+ ),
]
# -- Options for Epub output ----------------------------------------------
@@ -206,10 +205,48 @@
# epub_uid = ''
# A list of files that should not be packed into the epub file.
-epub_exclude_files = ['search.html']
+epub_exclude_files = ["search.html"]
-intersphinx_mapping = {'python': ('https://docs.python.org/3', None),
- 'pandas': ('http://pandas.pydata.org/pandas-docs/dev', None)}
+# -- Options for "sphinx.ext.autodoc.typehints" --
autodoc_preserve_defaults = True
autodoc_typehints = "description"
+
+# -- Options for "sphinx.ext.autosummary" --
+
+autosummary_generate = True
+
+# -- Options for "sphinx.ext.intersphinx" --
+
+intersphinx_mapping = {
+ "matplotlib": ("https://matplotlib.org/stable", None),
+ "numpy": ("https://numpy.org/doc/stable", None),
+ "pandas": ("https://pandas.pydata.org/pandas-docs/stable", None),
+ "python": (f"https://docs.python.org/{sys.version_info.major}", None),
+ "scipy": ("https://docs.scipy.org/doc/scipy", None),
+ "sklearn": ("https://scikit-learn.org/stable", None),
+}
+
+# -- Options for "sphinx.ext.todo" --
+
+todo_include_todos = True
+
+
+# -- Options for "sphinx_gallery.gen_gallery" --
+
+sphinx_gallery_conf = {
+ "examples_dirs": ["../examples"],
+ "gallery_dirs": ["auto_examples"],
+ "reference_url": {
+ "rdata": None,
+ },
+ "doc_module": "rdata",
+ "jupyterlite": {
+ "use_jupyter_lab": True,
+ },
+ "first_notebook_cell": textwrap.dedent("""\
+ %pip install lzma
+ %pip install rdata
+ %pip install ipywidgets
+ """),
+}
diff --git a/docs/index.rst b/docs/index.rst
index 7ae2fb3..a1d17be 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1,33 +1,46 @@
rdata version |version|
=======================
-|build-status| |docs| |coverage| |landscape| |pypi|
-
-Open :code:`.rda` R data files containing datasets and convert them to the appropiate Python objects.
+|build-status| |docs| |coverage| |pypi| |zenodo|
+
+The package rdata offers a lightweight way to import R datasets/objects stored
+in the ".rda" and ".rds" formats into Python.
+Its main advantages are:
+
+- It is a pure Python implementation, with no dependencies on the R language or
+ related libraries.
+ Thus, it can be used anywhere where Python is supported, including the web
+ using `Pyodide `_.
+- It attempt to support all R objects that can be meaningfully translated.
+ As opposed to other solutions, you are no limited to import dataframes or
+ data with a particular structure.
+- It allows users to easily customize the conversion of R classes to Python
+ ones.
+ Does your data use custom R classes?
+ Worry no longer, as it is possible to define custom conversions to the Python
+ classes of your choosing.
+- It has a permissive license (MIT). As opposed to other packages that depend
+ on R libraries and thus need to adhere to the GPL license, you can use rdata
+ as a dependency on MIT, BSD or even closed source projects.
.. toctree::
:maxdepth: 4
+ :hidden:
:caption: Contents:
installation
simpleusage
apilist
- internalapi
-
-rdata is developed `on Github `_. Please
-report `issues `_ there as well.
-
-Indices and tables
-==================
+ Try online!
-* :ref:`genindex`
-* :ref:`modindex`
-* :ref:`search`
+The package rdata is developed `on Github `_.
+Please report `issues `_ there
+as well.
-.. |build-status| image:: https://api.travis-ci.org/vnmabus/rdata.svg?branch=master
+.. |build-status| image:: https://github.com/vnmabus/rdata/actions/workflows/main.yml/badge.svg?branch=master
:alt: build status
:scale: 100%
- :target: https://travis-ci.org/vnmabus/rdata
+ :target: https://github.com/vnmabus/rdata/actions/workflows/main.yml
.. |docs| image:: https://readthedocs.org/projects/rdata/badge/?version=latest
:alt: Documentation Status
@@ -39,11 +52,12 @@ Indices and tables
:scale: 100%
:target: https://codecov.io/gh/vnmabus/rdata/branch/develop
-.. |landscape| image:: https://landscape.io/github/vnmabus/rdata/develop/landscape.svg?style=flat
- :target: https://landscape.io/github/vnmabus/rdata/develop
- :alt: Code Health
-
.. |pypi| image:: https://badge.fury.io/py/rdata.svg
:alt: Pypi version
:scale: 100%
:target: https://pypi.python.org/pypi/rdata/
+
+.. |zenodo| image:: https://zenodo.org/badge/DOI/10.5281/zenodo.6382237.svg
+ :alt: Zenodo DOI
+ :scale: 100%
+ :target: https://doi.org/10.5281/zenodo.6382237
diff --git a/docs/internalapi.rst b/docs/internalapi.rst
deleted file mode 100644
index aa7ad7d..0000000
--- a/docs/internalapi.rst
+++ /dev/null
@@ -1,11 +0,0 @@
-Internal documentation
-======================
-
-List of modules
----------------
-.. autosummary::
- :toctree: modules
- :recursive:
-
- rdata.parser._parser
- rdata.conversion._conversion
\ No newline at end of file
diff --git a/docs/simpleusage.rst b/docs/simpleusage.rst
index 968cc25..898f484 100644
--- a/docs/simpleusage.rst
+++ b/docs/simpleusage.rst
@@ -32,7 +32,7 @@ Convert custom R classes
The basic :func:`~rdata.conversion.convert` routine only constructs a
:class:`~rdata.conversion.SimpleConverter` objects and calls its
-:func:`~rdata.conversion.SimpleConverter.convert` method. All arguments of
+:meth:`~rdata.conversion.SimpleConverter.convert` method. All arguments of
:func:`~rdata.conversion.convert` are directly passed to the
:class:`~rdata.conversion.SimpleConverter` initialization method.
@@ -55,18 +55,21 @@ Pandas :class:`~pandas.Categorical` objects:
>>> import rdata
>>> def factor_constructor(obj, attrs):
-... values = [bytes(attrs['levels'][i - 1], 'utf8')
-... if i >= 0 else None for i in obj]
+... values = [
+... bytes(attrs['levels'][i - 1], 'utf8')
+... if i >= 0 else None for i in obj
+... ]
...
... return values
>>> new_dict = {
-... **rdata.conversion.DEFAULT_CLASS_MAP,
-... "factor": factor_constructor
-... }
+... **rdata.conversion.DEFAULT_CLASS_MAP,
+... "factor": factor_constructor
+... }
->>> parsed = rdata.parser.parse_file(rdata.TESTDATA_PATH
-... / "test_dataframe.rda")
+>>> parsed = rdata.parser.parse_file(
+... rdata.TESTDATA_PATH / "test_dataframe.rda"
+... )
>>> converted = rdata.conversion.convert(parsed, new_dict)
>>> converted
{'test_dataframe': class value
diff --git a/examples/README.txt b/examples/README.txt
new file mode 100644
index 0000000..8a8b9a8
--- /dev/null
+++ b/examples/README.txt
@@ -0,0 +1,4 @@
+Examples
+========
+
+Examples of the package functionality.
diff --git a/examples/plot_example.py b/examples/plot_example.py
new file mode 100644
index 0000000..ae2761f
--- /dev/null
+++ b/examples/plot_example.py
@@ -0,0 +1,18 @@
+# fmt: off
+"""
+R data loading
+==============
+
+Use the file uploader to convert files to Python.
+"""
+import rdata
+from ipywidgets import FileUpload, interact
+
+@interact(files=FileUpload(accept="*.rd*", multiple=True))
+def convert_from_file(files):
+ for f in files:
+ parsed = rdata.parser.parse_data(f.content)
+ converted = rdata.conversion.convert(parsed)
+ for key, value in converted.items():
+ print(f"{key}:")
+ print(value)
diff --git a/pyproject.toml b/pyproject.toml
index b7e2a57..b0ad2ca 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,3 +1,67 @@
+[project]
+name = "rdata"
+description = "Read R datasets from Python."
+readme = "README.rst"
+requires-python = ">=3.9"
+license = {file = "LICENSE"}
+keywords = [
+ "rdata",
+ "r",
+ "dataset",
+]
+maintainers = [
+ {name = "Carlos Ramos Carreño", email = "vnmabus@gmail.com"},
+]
+classifiers = [
+ "Development Status :: 4 - Beta",
+ "Intended Audience :: Developers",
+ "Intended Audience :: Science/Research",
+ "License :: OSI Approved :: MIT License",
+ "Natural Language :: English",
+ "Operating System :: OS Independent",
+ "Programming Language :: Python :: 3",
+ "Programming Language :: Python :: 3.9",
+ "Topic :: File Formats",
+ "Topic :: Scientific/Engineering :: Mathematics",
+ "Topic :: Software Development :: Libraries :: Python Modules",
+ "Typing :: Typed",
+]
+
+dynamic = ["version"]
+
+dependencies = [
+ "numpy",
+ "xarray",
+ "pandas",
+]
+
+[project.optional-dependencies]
+docs = [
+ "ipywidgets",
+ "jupyterlite-sphinx",
+ "jupyterlite-pyodide-kernel",
+ "matplotlib",
+ "pydata-sphinx-theme",
+ "sphinx>=3.1",
+ "sphinx-gallery",
+]
+test = [
+ "pytest",
+ "pytest-cov",
+ "numpy>=1.14",
+]
+
+[project.urls]
+homepage = "https://github.com/vnmabus/rdata"
+documentation = "https://rdata.readthedocs.io"
+repository = "https://github.com/vnmabus/rdata"
+
[build-system]
-# Minimum requirements for the build system to execute.
-requires = ["setuptools"]
\ No newline at end of file
+requires = ["setuptools>=61.0"]
+build-backend = "setuptools.build_meta"
+
+[tool.setuptools.packages.find]
+include = ["rdata*"]
+
+[tool.setuptools.dynamic]
+version = {attr = "rdata.__version__"}
\ No newline at end of file
diff --git a/rdata/VERSION b/rdata/VERSION
deleted file mode 100644
index 9a7d84f..0000000
--- a/rdata/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-0.9
\ No newline at end of file
diff --git a/rdata/__init__.py b/rdata/__init__.py
index c83f931..d47a733 100644
--- a/rdata/__init__.py
+++ b/rdata/__init__.py
@@ -1,5 +1,4 @@
"""rdata: Read R datasets from Python."""
-import errno as _errno
import os as _os
import pathlib as _pathlib
@@ -16,14 +15,4 @@ def _get_test_data_path() -> _pathlib.Path:
"""
-try:
- with open(
- _pathlib.Path(_os.path.dirname(__file__)) / 'VERSION',
- 'r',
- ) as version_file:
- __version__ = version_file.read().strip()
-except IOError as e:
- if e.errno != _errno.ENOENT:
- raise
-
- __version__ = "0.0"
+__version__ = "0.9.1"
diff --git a/readthedocs-requirements.txt b/readthedocs-requirements.txt
deleted file mode 100644
index fbf879c..0000000
--- a/readthedocs-requirements.txt
+++ /dev/null
@@ -1,3 +0,0 @@
--r requirements.txt
-Sphinx>=3.1
-sphinx_rtd_theme
\ No newline at end of file
diff --git a/readthedocs.yml b/readthedocs.yml
new file mode 100644
index 0000000..46689c3
--- /dev/null
+++ b/readthedocs.yml
@@ -0,0 +1,30 @@
+# .readthedocs.yml
+# Read the Docs configuration file
+# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
+
+# Required
+version: 2
+
+build:
+ os: ubuntu-22.04
+ tools:
+ python: "3.9"
+
+# Build documentation in the docs/ directory with Sphinx
+sphinx:
+ builder: html
+ configuration: docs/conf.py
+
+# Build documentation with MkDocs
+#mkdocs:
+# configuration: mkdocs.yml
+
+# Optionally build your docs in additional formats such as PDF
+
+# Optionally set the version of Python and requirements required to build your docs
+python:
+ install:
+ - method: pip
+ path: .
+ extra_requirements:
+ - docs
\ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
deleted file mode 100644
index 59f3601..0000000
--- a/requirements.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-numpy
-xarray
-pandas
-setuptools
\ No newline at end of file
diff --git a/setup.cfg b/setup.cfg
index a53dbc5..546144f 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -4,12 +4,14 @@ test=pytest
[tool:pytest]
addopts = --doctest-modules --doctest-glob="*.rst"
doctest_optionflags = NORMALIZE_WHITESPACE ELLIPSIS
+norecursedirs = .* build dist *.egg venv .svn _build docs/auto_examples examples
[isort]
multi_line_output = 3
include_trailing_comma = true
use_parentheses = true
combine_as_imports = 1
+skip_glob = **/plot_*.py plot_*.py
[flake8]
ignore =
diff --git a/setup.py b/setup.py
deleted file mode 100644
index 2e8bfe4..0000000
--- a/setup.py
+++ /dev/null
@@ -1,67 +0,0 @@
-# encoding: utf-8
-
-"""
-Read R datasets from Python.
-
-This package parses .rda datasets used in R. It does not depend on the R
-language or its libraries, and thus it is released under a MIT license.
-"""
-import os
-import pathlib
-import sys
-
-from setuptools import find_packages, setup
-
-needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv)
-pytest_runner = ['pytest-runner'] if needs_pytest else []
-
-DOCLINES = (__doc__ or '').split("\n")
-
-with open(
- pathlib.Path(os.path.dirname(__file__)) / 'rdata' / 'VERSION',
- 'r',
-) as version_file:
- version = version_file.read().strip()
-
-setup(
- name='rdata',
- version=version,
- description=DOCLINES[1],
- long_description="\n".join(DOCLINES[3:]),
- url='https://github.com/vnmabus/rdata',
- author='Carlos Ramos Carreño',
- author_email='vnmabus@gmail.com',
- include_package_data=True,
- platforms=['any'],
- license='MIT',
- packages=find_packages(),
- python_requires='>=3.7, <4',
- classifiers=[
- 'Development Status :: 4 - Beta',
- 'Intended Audience :: Developers',
- 'Intended Audience :: Science/Research',
- 'License :: OSI Approved :: MIT License',
- 'Natural Language :: English',
- 'Operating System :: OS Independent',
- 'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.6',
- 'Programming Language :: Python :: 3.7',
- 'Programming Language :: Python :: 3.8',
- 'Topic :: Scientific/Engineering :: Mathematics',
- 'Topic :: Software Development :: Libraries :: Python Modules',
- 'Typing :: Typed',
- ],
- keywords=['rdata', 'r', 'dataset'],
- install_requires=[
- 'numpy',
- 'xarray',
- 'pandas',
- ],
- setup_requires=pytest_runner,
- tests_require=[
- 'pytest-cov',
- 'numpy>=1.14', # The printing format for numpy changes
- ],
- test_suite='rdata.tests',
- zip_safe=False,
-)