[PYTHON] A memorandum to register the library written in Hy in PyPI

This is a memorandum of trial and error when I made this. ** Only the parts of setup.py and the file structure that are different from normal Python are described. ** **

When only intended for use from Hy

File structure


.
├── hoge
│   ├── __init__.hy
│   ├── fuga
│   │   ├── __init__.hy
│   │   └── fugafuga.hy
│   └── hogehoge.hy
└── setup.py

1 directories, 5 files

setup.py


#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup

config = {
    'install_requires': ['hy'],
    'packages': ['fuga', 'fuga.hoge'],
    # __init__.find because there is no py_packages are useless

    'package_data': {
        'fuga': ['*.hy'],
        'fuga.hoge': ['*.hy'],
    },
    #Normally.Because it only contains py files.I'll specify that hy is included
}

if __name__ == '__main__':
    setup(**config)

If you want to use it from Python as well

Click here to set the entry point with setup.py

File structure


.
├── hoge
│   ├── __init__.py #Top level only.not hy.To py
│   ├── fuga
│   │   ├── __init__.hy
│   │   └── fugafuga.hy
│   └── hogehoge.hy
└── setup.py # setup.py is the same and OK

1 directories, 5 files

hoge/__init__.py


import hy as _hy
#Of course import hy is fine
#Import hy with import hook.You will be able to import hy

Other

Upload to PyPI

Obviously, it's exactly the same as in Python. By the way, use twine instead of python setup.py register. The method of using setup.py is active in TestPyPI, but is currently used in Production PyPI. can not.

When mixing Python and Hy

Of course you need __init__.py wherever you have the Python source. By the way, __init__.py is also required when using the extension written in C together.

Recommended Posts

A memorandum to register the library written in Hy in PyPI
[For beginners] How to register a library created in Python in PyPI
Publish / upload a library created in Python to PyPI
Attempt to extend a function in the library (add copy function to pathlib)
[V11 ~] A memorandum to put in Misskey
Added a function to register desired shifts in the Django shift table
How to use the C library in Python
A memorandum about the Python tesseract wrapper library
A memorandum of how to execute the! Sudo magic command in Jupyter Notebook
Parse a JSON string written to a file in Python
A quick introduction to the neural machine translation library
Register a task in cron for the first time
A memorandum on how to use keras.preprocessing.image in Keras
A memorandum to run a python script in a bat file
Try to make a blackjack strategy by reinforcement learning (② Register the environment in gym)
Define a task to set the fabric env in YAML
How to debug the Python standard library in Visual Studio
How to use the __call__ method in a Python class
Change the standard output destination to a file in Python
Get the package version to register with PyPI from Git
Developed a library to get Kindle collection list in Python
How to register on pypi
Put the lists together in pandas to make a DataFrame
How to generate a query using the IN operator in Django
How to get the last (last) value in a list in Python
How to register a package on PyPI (as of September 2017)
To write a test in Go, first design the interface
Notes on how to use marshmallow in the schema library
[Python] Create a program to delete line breaks in the clipboard + Register as a shortcut with windows
Output the key list included in S3 Bucket to a file
[sh] How to store the command execution result in a variable
How to determine the existence of a selenium element in Python
How to get all the possible values in a regular expression
I created a Python library to call the LINE WORKS API
How to check the memory size of a variable in Python
[Introduction to Python] How to use the in operator in a for statement?
How to check the memory size of a dictionary in Python
I tried to register a station on the IoT platform "Rimotte"
How to get the vertex coordinates of a feature in ArcPy
Create a function to get the contents of the database in Go
I made a command to display a colorful calendar in the terminal
[Beginner memo] How to specify the library reading path in Python
Programming to fight in the world ~ 5-1
Programming to fight in the world ~ 5-5,5-6
Squid Lisp written in Python: Hy
Programming to fight in the world 5-3
A memorandum to change to Manjaro Linux
Programming to fight in the world-Chapter 4
In the python command python points to python3.8
[Python] How to import the library
Cython to try in the shortest
Register as a package on PyPI
Programming to fight in the world ~ 5-2
I made a POST script to create an issue on Github and register it in the Project
I tried to make a system to automatically acquire the program guide → register it in the calendar in one day
I want to load the pytest fixture as a library somewhere else (pytest may not exist in the environment)
A story about trying to improve the testing process of a system written in C language for 20 years
Memorandum (Add name only to people with the same surname in the list)
PyPi debut I tried to pip install a library to check Japanese holidays
How to specify a .ui file in the dialog / widget GUI in PySide
[Linux] Command to get a list of commands executed in the past