-
-
Notifications
You must be signed in to change notification settings - Fork 37
Support all IANA mime types #82
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Open
dkoston
wants to merge
2
commits into
manchenkoff:master
Choose a base branch
from
dkoston:support_all_mime_types
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,3 +131,6 @@ cython_debug/ | |
# VS Code | ||
.history | ||
.vscode | ||
|
||
#pyenv | ||
.python-version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,42 @@ | ||
.DEFAULT_GOAL := help | ||
.PHONY: help build test | ||
|
||
PYPI_TOKEN := $(shell echo ${PYPI_TOKEN}) | ||
PYPI_TEST_TOKEN := $(shell echo ${PYPI_TEST_TOKEN}) | ||
|
||
|
||
build: ## Build an application | ||
@pipenv run python -m build --no-isolation | ||
@poetry build | ||
|
||
configure_pypi_publishing: ## Configure publishing to PyPI | ||
@if [ -z "${PYPI_TOKEN}" ] ; then echo "you need to export PYPI_TOKEN before running this command" ; false ; fi | ||
@if [ -z "${PYPI_TOKEN}" ] ; then echo "you need to export PYPI_TEST_TOKEN before running this command" ; false ; fi | ||
@poetry config repositories.test-pypi https://test.pypi.org/legacy/ | ||
@poetry config pypi-token.test-pypi $(PYPI_TEST_TOKEN) | ||
@poetry config pypi-token.pypi $(PYPI_TOKEN) | ||
|
||
publish-test: ## Upload package to test PyPI | ||
@pipenv run twine upload --repository testpypi dist/* | ||
@poetry publish -r test-pypi | ||
|
||
publish: build ## Upload package to PyPI | ||
@pipenv run twine upload dist/* | ||
@poetry publish | ||
@make clean | ||
|
||
install: build ## Install application to Pip environment | ||
@pipenv run python -m pip install | ||
|
||
install-dev: ## Install application to Pip development environment | ||
@pipenv run python -m pip install -e | ||
@make clean | ||
install: build ## Install application to Poetry environment | ||
@poetry install | ||
|
||
clean: ## Remove build files | ||
@rm -Rf build/ dist/ *.egg-info .pytest_cache/ .mypy_cache/ .pytype/ .eggs/ src/*.egg-info | ||
@echo "Temporary files were clear" | ||
|
||
test: ## Run code tests | ||
@pipenv run python -m pytest -q | ||
|
||
sync: ## Sync with Pipfile packages list | ||
@pipenv sync | ||
@poetry run pytest -vv | ||
|
||
lint: ## Run code linters | ||
@echo "Run code linters..." | ||
@pipenv run mypy ./src | ||
@poetry run mypy ./src | ||
|
||
help: ## Show this message | ||
@echo "Application management" | ||
@echo | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# build-mime-types | ||
|
||
Builds a class file for ContentType enum from the IANA mime types list. | ||
|
||
Contents: | ||
|
||
|
||
- *.csv - Lists of media-types [from IANA](https://www.iana.org/assignments/media-types/media-types.xhtml) | ||
- [build_mime_types.py](build_mime_types.py) - Script to build class file (run automatically by poetry build) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like the approach with code-generation based on the standards, but since there is no automation to get the latest version of those csv files - it makes the module useful just for one-time execution. I think there is no need to include it into the repository since the process of extending will be identical (update csv of the actual python enum file)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where would the code live if it doesn't live in this repo?
since the process of extending will be identical (update csv of the actual python enum file)
Process:
If you delete
build_mime_types.py
you'll have to add thousands of enum lines by hand or do a manual diff. Maybe I'm missing something?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with this approach, but for now it's semi-automated. I meant that if we go with code generation, then we can exclude CSV files from the git and make them downloadable directly in the script to have all the latest versions w/o manual actions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case your suggestion with enum map for existing values would work fine as well, so it is up to you: update it now or leave PR as is and wait till the major version update w/o BC (but I have no time estimate on that for now)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the maps. There are some open api specific content-types not listed in IANA that I added / generated and some that this library names specifically so I added logic for those to keep everything backwards compatible.