[PYTHON] PyPi debut I tried to pip install a library to check Japanese holidays

By the time it was completed, cookies baked 20 million copies.

Overview and features

Find out if today is a holiday using the Google Calendar v3 API. The feature is that the API query result is stored in the class cache, so even if it is called 10,000 times, it will respond within 1 second. https://pypi.python.org/pypi/japan_holiday

install

pip install japan_holiday

How to use

#Determine if today is a holiday(today is holiday)
from japan_holiday import JapanHoliday
JapanHoliday(google_api_token).today()
>>>False

#Determine if today is a holiday or weekend(today is holiday or weekend)
JapanHoliday(google_api_token).today(weekend=True)
>>>True

#Determine if the designated date is a holiday or weekend(the chosen day is holiday or weekend)
from datetime import datetime
now = datetime(2016, 1, 8, 00, 00, 00)
JapanHoliday(google_api_token).check(now=now, weekend=True)
>>>True

# list
JapanHoliday(google_api_token).get_holiday_calender(2015)
>>>[New Year's Day:2015/1/1,Coming of age day:2015/1/12,Foundation Day:2015/2/11,Vernal Equinox Day:2015/3/21,Showa Day:2015/4/29,Constitution Memorial Day:2015/5/3,Greenery day:2015/5/4,Children's day:2015/5/5,Constitution Memorial Day 振替休日:2015/5/6,Marine day:2015/7/20,Respect for the aged day:2015/9/21,National holiday:2015/9/22,Autumnal Equinox Day:2015/9/23,Health and sports day:2015/10/12,Culture Day:2015/11/3,Labor Thanksgiving Day:2015/11/23,The emperor's birthday:2015/12/23]

Try making PyPi for the first time

I already knew that a similar library would exist, but I needed a Google API token to use it. Find out how tokens aren't needed [XML feeds](https://www.google.com/calendar/feeds/japanese__ja%40holiday.calendar.google.com/public/basic?start-min=2015-10 -01 & start-max = 2015-12-31 & alt = json) It seems that it is not necessary. Development has started in earnest.

[XML feed](https://www.google.com/calendar/feeds/japanese__ja%40holiday.calendar.google.com/public/basic?start-min=2015-10-01&start-max=" when it is almost completed If you take a closer look at 2015-12-31 & alt = json) ... スクリーンショット 2015-10-16 19.25.35.png

I decided to change direction and use tokens to hit the API. With this, it is not possible to differentiate from the existing library, but the typical syndrome that cannot be cut off is developed. Since there is no help for it, I tried to make it different by focusing on the three points of writing the document properly, making the direction simpler and faster.

I'm straying because it's quite useless. Design and verification are important.

PyPi is pretty fucking

The mechanism of pip is very convenient and wonderful, but from the registrant's point of view, it was quite shit. If you think that you can easily register because the procedure is scattered on the WEB, [Save the registration ID and password in plain text on the PC](http://stackoverflow.com/questions/1569315/setup-py-upload- is-failing-with-upload-failed-401-you-must-be-identified-t), or the standard way of writing setup.py is not maintained. However, since it is a convenient mechanism that blows away such a trivial disadvantage, it seems that it will be used for a long time (pip becomes the standard installer from Python 3.4 !?). Hey.

PyPi can be enjoyed if you pay attention to this

There are various ways to write setup.py, so I was very confused at first. If you get lost, you can enjoy it by referring to requests and redis.

Finally, when registering for PyPi, I would like to conclude by introducing what I thought was the one who did this.

1. Failure

The module name has failed. You will write this when importing.

from japan_holiday import JapanHoliday

Underscore is unpleasant, so I'd like to be careful next time.

2. Take SEO measures

You can write everything in English, but especially with a domestic library like this one, the countries where it is expected to be used are limited, so try entering Japanese keywords so that you can get caught when searching in Japanese. It was. Maybe this story has its pros and cons.

3. Centrally manage the README on PyPi and GitHub

README.Centrally manage rst on PyPi and GitHub



import os
f = open(os.path.join(os.path.dirname(__file__), 'README.rst'))
long_description = f.read()
f.close()

setup(
    long_description=long_description,
...

Reference: https://github.com/andymccurdy/redis-py/blob/master/setup.py#L30

4. Centrally manage Version with PyPi and module

Centrally manage version with PyPi and module


# 1. init.To py__version__ = '0.0.5'Write
# 2. setup.Call with py
from redis import __version__
...
setup(
    name='redis',
    version=__version__,
...

Reference: https://github.com/andymccurdy/redis-py/blob/master/setup.py#L5

5. If you are unsure of what to write in the README.rst ..

English is spicy. If you don't know what to write, you can write it by referring to requests. requests GitHub requests PyPi

PyPi version upgrade command

python setup.py sdist upload

Recommended Posts

PyPi debut I tried to pip install a library to check Japanese holidays
I made a library to separate Japanese sentences nicely
I stumbled when I tried to install Basemap, so a memorandum
I tried to create a linebot (implementation)
I tried to create a linebot (preparation)
I was addicted to pip install mysqlclient
I want to pip install with PythonAnywhere
I tried to make a Web API
I made a tool to estimate the execution time of cron (+ PyPI debut)
I tried to build a super-resolution method / ESPCN
I tried to publish my own module so that I can pip install it
I tried to build a super-resolution method / SRCNN ①
[Python] Deep Learning: I tried to implement deep learning (DBN, SDA) without using a library.
I failed to install django with pip, so a reminder of the solution
I tried to touch Python's GUI library "PySimple GUI"
I applied SIF Rank to a Japanese document and tried to extract key phrases
I tried to generate a random character string
I tried to build a super-resolution method / SRCNN ③
I tried to build a super-resolution method / SRCNN ②
I tried to make a ○ ✕ game using TensorFlow
Steps to install your own library with pip
I tried to make a "fucking big literary converter"
I tried to create a table only with Django
I tried to draw a route map with Python
I tried to implement a pseudo pachislot in Python
I tried to implement a recommendation system (content-based filtering)
I want to find a popular package on PyPi
I got a UnicodeDecodeError when pip install on ubuntu
[Go + Gin] I tried to build a Docker environment
I want to install a package of Php Redis
I tried to automatically generate a password with Python3
I made a python library to do rolling rank
I tried Kaokore, a Japanese classic dataset, on EfficientNet.
Publish / upload a library created in Python to PyPI
I tried to install scrapy on Anaconda and couldn't
I tried to draw a configuration diagram using Diagrams
How to install pip
I tried to debug.
I tried to paste
When I tried to install PIL and matplotlib in a virtualenv environment, I was addicted to it.
I tried to implement a volume moving average with Quantx
I tried to implement a one-dimensional cellular automaton in Python
I tried to automatically create a report with Markov chain
[Markov chain] I tried to read a quote into Python.
Steps to install a Git cloned package locally with pip
I made a function to check the model of DCGAN
I published my own Python baseball library to Packaging & PyPI
I tried to solve a combination optimization problem with Qiskit
I tried "How to get a method decorated in Python"
I tried to get started with Hy ・ Define a class
I want to install a package from requirements.txt with poetry
I tried to automate [a certain task] using Raspberry Pi
I tried to sort a random FizzBuzz column with bubble sort.
I tried to create a bot for PES event notification
I tried to make a stopwatch using tkinter in python
I tried to translate English subtitles into Japanese with Udemy
I tried to divide with a deep learning language model
I tried to make a simple text editor using PyQt
I tried to learn PredNet
I tried to organize SVM.
I tried to implement PCANet