Skip to content

Commit

Permalink
Merge pull request #165 from jdiegodcp/v0.2.1-dev
Browse files Browse the repository at this point in the history
Merging the updates from past dev branch with new small changes that allow us to work properly with most recent dependencies
  • Loading branch information
jdiegodcp authored Feb 22, 2024
2 parents 9f73b50 + 8cb637f commit ba21f1d
Show file tree
Hide file tree
Showing 233 changed files with 12,315 additions and 2,533 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
__pycache__/
*.py[cod]
*.so
.eggs/
.idea/
.Python
env/
bin/
Expand Down
7 changes: 4 additions & 3 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
Credits
-------

``ramlfications`` is maintained by `Juan De la Cruz <https://github.com/jdiegodcp>`_ and thanks to various
``ramlfications`` is written and maintained by `Juan De la Cruz <https://github.com/jdiegodcp>`_ and thanks various
contributors:

- `Lynn Root <https://github.com/econchick>`_
- `Ben Powell <https://github.com/bpowell65536>`_
- `Hynek Schlawack <https://github.com/hynek>`_
- `Matt Montag <https://github.com/mmontag>`_
- `Piët Delport <https://github.com/pjdelport>`_

- `Pierre Tardy <https://github.com/tardyp>`_
- `Pi Delport <https://github.com/PiDelport>`_
58 changes: 40 additions & 18 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
@@ -1,47 +1,69 @@
How To Contribute
=================

Every open source project lives from the generous help by contributors that sacrifice their time and ``ramlfications`` is no different.
Every open source project lives from the generous help by contributors
that sacrifice their time and ``ramlfications`` is no different.

To make participation as pleasant as possible, this project adheres to the `Code of Conduct`_ by the Python Software Foundation.
To make participation as pleasant as possible, this project adheres to
the `Code of Conduct`_ by the Python Software Foundation.

Here are a few hints and rules to get you started:

- Current status of the project (including issues & PRs) can be seen on our `waffle.io`_ page.
- Current status of the project (including issues & PRs) can be seen on
our `waffle.io`_ page.
- Meaning of GitHub labels:
- ``help wanted``: Feeling generous with your time? These issues are up for grabs. Ask any questions in the comments of the issue.
- ``in progress``: This issue is currently being worked on.
- ``ready``: Issue/bug has been confirmed, and is available for anyone to work on.
- ``feature``: Feature/idea to extend ``ramlfications``.
- ``bug``: A bug or issue within ``ramlfications``.
- ``no repro``: A filled bug that can not be reproduced (feel free to comment/reopen if you find you are seeing this bug).
- ``wontfix``: A filled issue deemed not relevant to the project in some way.
- ``duplicate``: Either duplicate issue or PR.
- ``help wanted``:
Feeling generous with your time? These issues are up for grabs.
Ask any questions in the comments of the issue.
- ``in progress``:
This issue is currently being worked on.
- ``ready``:
Issue/bug has been confirmed, and is available for anyone to work on.
- ``feature``:
Feature/idea to extend ``ramlfications``.
- ``bug``:
A bug or issue within ``ramlfications``.
- ``no repro``:
A filled bug that can not be reproduced (feel free to
comment/reopen if you find you are seeing this bug).
- ``wontfix``:
A filled issue deemed not relevant to the project in some way.
- ``duplicate``:
Either duplicate issue or PR.

- Take a look at the :doc:`wishlist` for inspiration.
- Any GitHub issue that is labeled ``ready`` is up for grabs.
- Add yourself to the AUTHORS.rst_ file in an alphabetical fashion.
Every contribution is valuable and shall be credited.
- If your change is noteworthy, add an entry to the changelog_.
- No contribution is too small; please submit as many fixes for typos and grammar bloopers as you can!
- No contribution is too small; please submit as many fixes for typos
and grammar bloopers as you can!
- *Always* add tests and docs for your code.
This is a hard rule; patches with missing tests or documentation won’t be merged – if a feature is not tested or documented, it doesn’t exist.
This is a hard rule; patches with missing tests or documentation won’t
be merged – if a feature is not tested or documented, it doesn’t
exist.
- Obey `PEP 8`_ and `PEP 257`_.
- Write `good commit messages`_.

.. note::
If you have something great but aren’t sure whether it adheres -- or even can adhere -- to the rules above: **please submit a pull request anyway**!
If you have something great but aren’t sure whether it adheres -- or
even can adhere -- to the rules above: **please submit a pull request
anyway**!

In the best case, we can mold it into something, in the worst case the pull request gets politely closed.
In the best case, we can mold it into something, in the worst case
the pull request gets politely closed.
There’s absolutely nothing to fear.

Thank you for considering to contribute to ``ramlfications``!


.. _`PEP 8`: http://www.python.org/dev/peps/pep-0008/
.. _`PEP 257`: http://www.python.org/dev/peps/pep-0257/
.. _`good commit messages`: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
.. _`good commit messages`:
http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
.. _`Code of Conduct`: https://www.python.org/psf/codeofconduct/
.. _changelog: https://github.com/spotify/ramlfications/blob/master/docs/changelog.rst
.. _AUTHORS.rst: https://github.com/spotify/ramlfications/blob/master/AUTHORS.rst
.. _changelog:
https://github.com/spotify/ramlfications/blob/master/docs/changelog.rst
.. _AUTHORS.rst:
https://github.com/spotify/ramlfications/blob/master/AUTHORS.rst
.. _`waffle.io`: https://waffle.io/spotify/ramlfications
22 changes: 15 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The latest stable version can be found on PyPI_, and you can install via pip_::

$ pip install ramlfications

``ramlfications`` runs on Python 2.6, 2.7, and 3.3+, and PyPy. Both Linux and OS X are supported. Currently, only RAML 0.8 is supported, but there are plans_ to support 1.0.
``ramlfications`` runs on Python 3.10+, and PyPy. Linux , OS X and Windows are supported. Currently, only RAML 0.8 is supported, but there are plans_ to support 1.0.

Continue onto `usage`_ to get started on using ``ramlfications``.

Expand All @@ -55,12 +55,12 @@ System requirements:

- C Compiler (gcc/clang/etc.)
- If on Linux - you'll need to install Python headers (e.g. ``apt-get install python-dev``)
- Python 2.6, 2.7, 3.3+, or PyPy
- Python 3.10+, or PyPy
- virtualenv_

Here's how to set your machine up::

$ git clone [email protected]:spotify/ramlfications
$ git clone [email protected]:jdiegodcp/ramlfications
$ cd ramlfications
$ virtualenv env
$ source env/bin/activate
Expand All @@ -77,10 +77,10 @@ To run all tests::

(env) $ tox

To run a specific test setup (options include: ``py26``, ``py27``, ``py33``, ``py34``, ``py35``, ``pypy``,
To run a specific test setup (options include: ``py310``, ``py311``, ``py312``, ``pypy``,
``flake8``, ``verbose``, ``manifest``, ``docs``, ``setup``, ``setupcov``)::

(env) $ tox -e py26
(env) $ tox -e py310

To run tests without tox::

Expand All @@ -107,10 +107,18 @@ Then within ``ramlfications/docs/_build`` you can open the index.html page in yo

Project History
^^^^^^^^^^^^^^^

Ramlfications was originally created by Spotify engineer github.com/econchick, but is currently not in use at Spotify. The project was discontinued
in April 2022 and transferred to an external maintainer.


Still have issues?
^^^^^^^^^^^^^^^^^^

Feel free to drop by ``#ramlfications`` on Freenode (`webchat`_) or ping via `X`_.
"jdiegodcp" is the maintainer, a.k.a `jdiegodcp`_ on GitHub.


.. _pip: https://pip.pypa.io/en/latest/installing.html#install-pip
.. _PyPI: https://pypi.python.org/project/ramlfications/
.. _virtualenv: https://virtualenv.pypa.io/en/latest/
Expand All @@ -121,7 +129,7 @@ in April 2022 and transferred to an external maintainer.
.. _`usage`: https://ramlfications.readthedocs.io/en/latest/usage.html
.. _`How to Contribute`: https://ramlfications.readthedocs.io/en/latest/contributing.html
.. _`webchat`: http://webchat.freenode.net?channels=%23ramlfications&uio=ND10cnVlJjk9dHJ1ZQb4
.. _`econchick`: https://github.com/econchick
.. _`Twitter`: https://twitter.com/roguelynn
.. _`jdiegodcp`: https://github.com/jdiegodcp
.. _`Twitter`: https://twitter.com/jdiegodcp
.. _`project management`: https://waffle.io/spotify/ramlfications
.. _plans: https://github.com/spotify/ramlfications/issues/54
21 changes: 10 additions & 11 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
-r requirements.txt
Sphinx==1.2.3
check-manifest==0.21
coverage==3.7.1
flake8==2.2.3
sphinx-rtd-theme==0.1.6
tox==1.9.0
pytest==2.6.4
pytest-cov==1.8.1
mock==1.0.1
pytest-mock==0.4.3
pytest-localserver==0.3.4
Sphinx==7.2.6
check-manifest==0.46
coverage==7.4.1
flake8==7.0.0
tox==4.12.1
pytest==8.0.0
pytest-cov==4.1.0
mock==5.1.0
pytest-mock==3.12.0
pytest-localserver==0.8.1
32 changes: 18 additions & 14 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,24 @@ parser

.. autofunction:: ramlfications.parser.parse_raml

.. autofunction:: ramlfications.parser.create_root
.. autofunction:: ramlfications.parser.parser.RAMLParser

.. autofunction:: ramlfications.parser.create_traits
.. autofunction:: ramlfications.parser.parser.RootParser

.. autofunction:: ramlfications.parser.create_resource_types
.. autofunction:: ramlfications.parser.parser.SecuritySchemeParser

.. autofunction:: ramlfications.parser.create_resources
.. autofunction:: ramlfications.parser.parser.TraitParser

.. autofunction:: ramlfications.parser.parser.ResourceTypeParser

.. autofunction:: ramlfications.parser.parser.ResourceParser

.. autofunction:: ramlfications.parser.create_node


raml
^^^^

.. py:class:: ramlfications.raml.RootNode
.. py:class:: ramlfications.raml.RootNodeAPI08
API Root Node

Expand All @@ -64,18 +67,18 @@ raml
``list`` of base :py:class:`.URIParameter` s for the base URI, or
``None``. The order of ``base_uri_params`` will follow the order \
defined in the :py:obj:`.RootNode.base_uri`.
defined in the :py:obj:`.RootNodeAPI08.base_uri`.

.. py:attribute:: uri_params
``list`` of :py:class:`.URIParameter` s that can apply to all
resources, or ``None``. The order of ``uri_params`` will follow the \
order defined in the :py:obj:`.RootNode.base_uri`.
order defined in the :py:obj:`.RootNodeAPI08.base_uri`.

.. py:attribute:: protocols
``list`` of ``str`` s of API-supported protocols. If not defined, is
inferred by protocol from :py:obj:`.RootNode.base_uri`.
inferred by protocol from :py:obj:`.RootNodeAPI08.base_uri`.

.. py:attribute:: title
Expand Down Expand Up @@ -131,7 +134,7 @@ raml

.. py:attribute:: root
Back reference to the ``Node``’s API :py:class:`.RootNode` object.
Back reference to the ``Node``’s API :py:class:`.RootNodeAPI08` object.

.. py:attribute:: headers
Expand Down Expand Up @@ -168,7 +171,7 @@ raml
.. py:attribute:: media_type
``str`` of supported request MIME media type. Defaults to \
:py:class:`.RootNode`’s ``media_type``.
:py:class:`.RootNodeAPI08`’s ``media_type``.

.. py:attribute:: description
Expand All @@ -177,7 +180,7 @@ raml
.. py:attribute:: protocols
``list`` of ``str`` s of supported protocols. Defaults to \
:py:obj:`.RootNode.protocols`.
:py:obj:`.RootNodeAPI08.protocols`.


.. py:class:: ramlfications.raml.TraitNode
Expand Down Expand Up @@ -268,7 +271,7 @@ raml
.. py:attribute:: absolute_uri
``str`` concatenation of absolute URI of resource:
:py:obj:`.RootNode.base_uri` + :py:attr:`path`.
:py:obj:`.RootNodeAPI08.base_uri` + :py:attr:`path`.

.. py:attribute:: is_
Expand Down Expand Up @@ -545,7 +548,7 @@ Parameters
``dict`` of security schema-specific information


.. autoclass:: ramlfications.parameters.Content
.. autoclass:: ramlfications.models.base.BaseContent
:members:


Expand All @@ -563,6 +566,7 @@ Validate
Functions are used when instantiating the classes from ``ramlfications.raml``.

.. automodule:: ramlfications.validate
:noindex:
:members:

Tree
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def find_latest_release_date():
date_match = date_regex.findall(changelog)[0]
if date_match:
release_date = datetime.datetime.strptime(date_match, "%Y-%m-%d")
fmt_release_date = release_date.strftime("%b %-d, %Y")
fmt_release_date = release_date.strftime("%b %e, %Y")
return fmt_release_date
raise RuntimeError("Unable to find latest release date in changelog.rst")

Expand Down
2 changes: 1 addition & 1 deletion docs/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ RAML Versions

| **Config variable**: ``raml_versions``
| **Config type**: list of strings
| **Supported**: ``0.8``
| **Supported**: ``0.8``, ``1.0``
|

Expand Down
23 changes: 21 additions & 2 deletions docs/extendedusage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ The Basics
>>>
>>> api.version
v2
>>> api.raml_version
"0.8"
>>> api.base_uri
'https://{domainName}.foo.com/v2'
>>> api.base_uri_parameters
Expand Down Expand Up @@ -87,7 +89,7 @@ With ``ramlfications``, documentation content and descriptions can either be vie
u'<p>Welcome to the <em>Foo API</em> specification. For more information about\nhow to use the API, check out <a href="https://developer.foo.com">developer site</a>.</p>\n'
Check out :doc:`api` for full definition of ``RootNode`` and its associated attributes and objects.
Check out :doc:`api` for full definition of ``RootNodeAPI08`` and its associated attributes and objects.


Security Schemes
Expand Down Expand Up @@ -198,6 +200,23 @@ Traits
'The index of the first track to return'
RAML1.0 Types
~~~~~~~~~~~~~~

.. code-block:: python
>>> api.types
{'Person': ObjectType(name='Person', properties={'name': Property(type='string')})}
>>> person = api.types['Person']
>>> person.type
'object'
>>> person.description
'a Person is a type describing human beings'
>>> person.properties
{'name': Property(type='string')})
>>> person.validate({'foo': 'bar'})
ValidationError: 'foo' is not in the set of allowed properties ('name'). Missing required property 'name'
Mapping of Properties and Elements from Traits & Resource Types to Resources
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -585,7 +604,7 @@ would be ``/foo/bar/{id}``, and the absolute URI path would be
.. note::

The ``uri_params`` and ``base_uri_params`` on the ``api`` object (``RootNode``) and a resource object (``ResourceNode``) will **always** preserve order according to the absolute URI.
The ``uri_params`` and ``base_uri_params`` on the ``api`` object (``RootNodeAPI08``) and a resource object (``ResourceNode``) will **always** preserve order according to the absolute URI.


Check out :doc:`api` for full definition of what is available for a ``resource`` object, and its associated attributes and objects.
Expand Down
2 changes: 1 addition & 1 deletion docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ To parse a RAML file, include ramlfications in your project and call the parse f
>>> RAML_FILE = "/path/to/my-api.raml"
>>> api = ramlfications.parse(RAML_FILE)
>>> api
RootNode(title='Example Web API')
RootNodeAPI08(title='Example Web API')
>>> api.title
'My Foo API'
>>> api.version
Expand Down
Loading

0 comments on commit ba21f1d

Please sign in to comment.