Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change to tab layout for pyproject.toml vs setup.cfg #1155

Merged
merged 2 commits into from
Jun 20, 2022
Merged
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
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The ASDF Standard is at v1.6.0

- Overhaul of the ASDF documentation to make it more consistent and readable. [#1142, #1152]
- Update deprecated instances of `abstractproperty` to `abstractmethod` [#1148]
- Move build configuration into `pyproject.toml` [#1149]
- Move build configuration into `pyproject.toml` [#1149, #1155]

2.12.0 (2022-06-06)
-------------------
Expand Down
20 changes: 11 additions & 9 deletions docs/asdf/extending/extensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -253,18 +253,20 @@ We'll assume that method is located in the module ``asdf_foo_extension.integrati
Next, in the package's ``pyproject.toml``, define a ``[project.entry-points]`` section (or ``[options.entry_points]`` in
``setup.cfg``) that identifies the method as an ``asdf.extensions`` entry point:

.. code-block:: toml
.. tab:: pyproject.toml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


# pyproject.toml
[project.entry-points]
'asdf.extensions' = { asdf_foo_extension = 'asdf_foo_extension.integration:get_extensions' }
.. code-block:: toml

.. code-block:: ini
[project.entry-points]
'asdf.extensions' = { asdf_foo_extension = 'asdf_foo_extension.integration:get_extensions' }
zacharyburnett marked this conversation as resolved.
Show resolved Hide resolved

# setup.cfg
[options.entry_points]
asdf.extensions =
asdf_foo_extension = asdf_foo_extension.integration:get_extensions
.. tab:: setup.cfg

.. code-block:: ini

[options.entry_points]
asdf.extensions =
asdf_foo_extension = asdf_foo_extension.integration:get_extensions

After installing the package, the extension should be automatically available in any
new Python session.
Expand Down
18 changes: 10 additions & 8 deletions docs/asdf/extending/legacy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -881,17 +881,19 @@ containing your schema files to the pytest section of your project's build confi
(``pyproject.toml`` or ``setup.cfg``). If you do not already have such a file, creating
one with the following should be sufficient:

.. code:: toml
.. tab:: pyproject.toml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


# pyproject.toml
[tool.pytest.ini_options]
asdf_schema_root = 'path/to/schemas another/path/to/schemas'
.. code-block:: toml

.. code:: ini
[tool.pytest.ini_options]
asdf_schema_root = 'path/to/schemas another/path/to/schemas'

# setup.cfg
[tool:pytest]
asdf_schema_root = path/to/schemas another/path/to/schemas
.. tab:: setup.cfg

.. code-block:: ini

[tool:pytest]
asdf_schema_root = path/to/schemas another/path/to/schemas

The schema directory paths should be paths that are relative to the top of the
package directory **when it is installed**. If this is different from the path
Expand Down
36 changes: 20 additions & 16 deletions docs/asdf/extending/resources.rst
Original file line number Diff line number Diff line change
Expand Up @@ -193,17 +193,19 @@ instance:
Then in ``pyproject.toml``, define an ``[project.entry-points]`` section (or ``[options.entry_points]`` in ``setup.cfg``)
that identifies the method as an ``asdf.resource_mappings`` entry point:

.. code-block:: toml
.. tab:: pyproject.toml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


# pyproject.toml
[project.entry-points]
'asdf.resource_mappings' = { asdf_foo_schemas = 'asdf_foo_schemas.integration:get_resource_mappings' }
.. code-block:: toml

.. code-block:: ini
[project.entry-points]
'asdf.resource_mappings' = { asdf_foo_schemas = 'asdf_foo_schemas.integration:get_resource_mappings' }

# setup.cfg
[options.package_data]
* = *.yaml
.. tab:: setup.cfg

.. code-block:: ini

[options.package_data]
* = *.yaml

After installing the package, it should be possible to load one of our schemas
in a new session without any additional setup:
Expand All @@ -221,17 +223,19 @@ YAML files. There are multiple ways to accomplish this, but one easy option
is to add a ``[tool.setuptools.package-data]`` section to ``pyproject.toml`` (or ``[options.package_data]`` in
``setup.cfg``) requesting that all files with a ``.yaml`` extension be installed:

.. code-block:: toml
.. tab:: pyproject.toml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


.. code-block:: toml

[tool.setuptools.package-data]
'*' = ['*.yaml']

# pyproject.toml
[tool.setuptools.package-data]
'*' = ['*.yaml']
.. tab:: setup.cfg

.. code-block:: ini
.. code-block:: ini

# setup.cfg
[options.package_data]
* = *.yaml
[options.package_data]
* = *.yaml

Entry point performance considerations
--------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
man_pages = [("index", project.lower(), project + " Documentation", [author], 1)]

sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname("__file__")), "sphinxext"))
extensions += ["example", "sphinx_asdf"]
extensions += ["example", "sphinx_asdf", "sphinx_inline_tabs"]


def setup(app):
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ docs = [
'sphinx-asdf',
'sphinx-astropy',
'sphinx-rtd-theme',
'sphinx-inline-tabs',
'toml',
]
tests = [
Expand Down