Skip to content

Commit

Permalink
docs: replace rst with markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
siddhantgoel committed Jan 30, 2021
1 parent 8965f36 commit e0cec5d
Show file tree
Hide file tree
Showing 7 changed files with 195 additions and 239 deletions.
8 changes: 8 additions & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Authors

- Siddhant Goel [@siddhantgoel] (maintainer)
- Sergey Kolomenkin [@kolomenkin]


[@kolomenkin]: https://github.com/kolomenkin
[@siddhantgoel]: https://github.com/siddhantgoel
9 changes: 0 additions & 9 deletions AUTHORS.rst

This file was deleted.

113 changes: 113 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# CHANGELOG

## v1.8.0
- Build and publish binary wheels for Linux, macOS and Windows

## v1.7.1
- Fix build issues related to PEP 517

## v1.7.0
- Support Python 3.8
- Built using Cython 0.29.17

## v1.6.0
- Support registering multiple targets per same part
- Built using Cython 0.29.15

## v1.5.2
- Fix `pyproject.toml`

## v1.5.1
- Update README

## v1.5.0
- Make file `content_type` (from the `Content-Type` header) available as
`self.multipart_content_type` attribute in `Target` classes
- Build using Cython 0.29.14

## v1.4.0
- Built using Cython 0.29.6

## v1.3.0
- Built using Cython 0.29.1

## v1.2.0
- Built using Cython 0.28.5
- Use `keys()` to iterate over request headers

## v1.1.0
- Built using Cython 0.28.4
- Improve documentation

## v1.0.0
- Add exception handling in the `_Parser` class (move to the
`PS_ERROR` state when targets raise an exception)
- Support chunk-input validation in `Target` objects using `validator`
callables
- Add function hooks in `Target` classes which should be overridden instead of
the actual functions themselves (users should now define `on_data_received`
instead of overriding `data_received`)

## v0.6.1
- Include `streaming_form_data/_parser.pyx` file in the distribution to avoid
installation errors

## v0.6.0
- Major performance improvements; we're now able to parse ~1800MB per second,
from ~15MB per second in the previous version (thanks [@kolomenkin])

## v0.5.1
- Fix parser bug which could lead to spurious CR or CRLF being added to the end
of transferred form field value (thanks [@kolomenkin])

## v0.5.0
- Make `filename` (from the `Content-Disposition` header) available as
`self.multipart_filename` attribute in `Target` classes (thanks [@kolomenkin])
- Add example usage for `bottle` framework (thanks [@kolomenkin])
- Refactor tests to work with random bytes instead of increasing repository size
with test files (thanks [@kolomenkin])
- Make `Content-Type` header lookups truly case-insensitive (mixed cases also
allowed) (thanks [@kolomenkin])

## v0.4.5
- Make `Content-Type` header lookups case-insensitive

## v0.4.4
- Performance: mark `active`, `found`, and `inactive`
properties on `Finder` instances as `cpdef`-ed methods, decreasing
the Python-space operations for an increase in speed
- Performance: remove `_Failed` exception and replace it with error codes,
decreasing the Python-space operations for a speed increase
- Include `Cython`-generated annotation file to keep an eye on the
Python-interaction level

## v0.4.3
- Performance: `cdef` declare `long` variable responsible for
iterating over the buffer

## v0.4.2
- Performance: avoid repeated function calls to check the buffer length

## v0.4.1
- Add Sphinx documentation and make them available on
https://streaming-form-data.readthedocs.org

## v0.4.0
- Provide `parser.register` function for handling uploaded parts,
replacing the `expected_parts` argument
- Remove `Part` class from the user-facing API since it just makes the
API look messy and verbose
- Update documentation

## v0.3.2
- Include upload form in tornado usage example
- Call `unset_active_part` when a delimiter string is found

## v0.3.1
- Update README and tornado usage example
- Adjust import paths for the `Part` class

## v0.3.0
- Initial release

[@kolomenkin]: https://github.com/kolomenkin
147 changes: 0 additions & 147 deletions CHANGELOG.rst

This file was deleted.

72 changes: 72 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Streaming multipart/form-data parser

[![image](https://github.com/siddhantgoel/streaming-form-data/workflows/streaming-form-data/badge.svg)](https://github.com/siddhantgoel/streaming-form-data/workflows/streaming-form-data/badge.svg)

[![image](https://img.shields.io/pypi/v/streaming-form-data.svg)](https://pypi.python.org/pypi/streaming-form-data)

[![image](https://img.shields.io/pypi/pyversions/streaming-form-data.svg)](https://pypi.python.org/pypi/streaming-form-data)

[![image](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)


`streaming_form_data` provides a Python parser for parsing `multipart/form-data`
input chunks (the encoding used when submitting data over HTTP through HTML
forms).

## Installation

```bash
$ pip install streaming-form-data
```

In case you prefer cloning the Github repository and installing manually, please
note that `master` is the development branch, so `stable` is what you should be
working with.

## Usage

```python
>>> from streaming_form_data import StreamingFormDataParser
>>> from streaming_form_data.targets import ValueTarget, FileTarget, NullTarget
>>>
>>> headers = {'Content-Type': 'multipart/form-data; boundary=boundary'}
>>>
>>> parser = StreamingFormDataParser(headers=headers)
>>>
>>> parser.register('name', ValueTarget())
>>> parser.register('file', FileTarget('/tmp/file.txt'))
>>> parser.register('discard-me', NullTarget())
>>>
>>> for chunk in request.body:
... parser.data_received(chunk)
...
>>>
```

## Documentation

Up-to-date documentation is available on [Read the Docs].

## Development

Please make sure you have Python 3.6+ and [pip-tools] installed.

Since this package includes a C extension, please make sure you have a working C
compiler available. On Debian-based distros this usually means installing the
`build-essentials` package.

1. Git clone the repository -
`git clone https://github.com/siddhantgoel/streaming-form-data`

2. Install the packages required for development -
`pip install -r requirements-dev.txt`

3. That's basically it. You should now be able to run the test suite -
`make test`.

Please note that `tests/test_parser_stress.py` stress tests the parser with
large inputs, which can take a while. As an alternative, pass the filename as an
argument to `py.test` to run tests selectively.

[pip-tools]: https://pypi.org/project/pip-tools/
[Read the Docs]: https://streaming-form-data.readthedocs.io/

0 comments on commit e0cec5d

Please sign in to comment.