pyenv install 3.7.3
(или что надо из списка pyenv install --list
)pyenv virtualenv 3.7.3 venv37
pyenv local venv37
class Item(models.Model):
name = models.CharField(max_length=255)
price = models.DecimalField(max_digits=16, decimal_places=2)
class ConvertedPrice(models.Model):
item = models.ForeignKey(Item, on_delete=models.CASCADE)
currency = models.CharField(max_length=3)
value = models.DecimalField(max_digits=16, decimal_places=2)
ordered_items = Item.objects.annotate(converted=Subquery(
ConvertedPrice.objects.filter(item=OuterRef('id'), currency='USD').values('value')
)).order_by('converted')
SELECT
"app_item"."id",
"app_item"."name",
"app_item"."price",
(
SELECT U0."value"
FROM "app_convertedprice" U0
WHERE (U0."currency" = USD AND U0."item_id" = ("app_item"."id"))
) AS "converted"
FROM "app_item"
ORDER BY "converted" ASC;
from setuptools import setup
from my_pkg import constants
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md')) as f:
long_description = f.read()
setup(
name='my_pkg',
version=constants.MY_PKG_VERSION,
description='Pkg description',
author='Your Name',
author_email='your@ema.il',
url='http://github.com/some/user',
packages=[
'my_pkg',
'my_pkg.abstractions',
'my_pkg.exceptions',
],
long_description=long_description,
long_description_content_type='text/markdown',
include_package_data=True,
install_requires=[],
python_requires='>=3.4',
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Natural Language :: English",
"Operating System :: OS Independent",
"Development Status :: 1 - Planning",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Topic :: Software Development :: Libraries"],
package_data={
'': ['*.md', '*.txt', '*.json']
},
keywords='my_pkg',
license='MIT',
)
entry_points={
'console_scripts': ['your_command=my_pkg.cli.command_line:main'],
},
pip3 install fuzzywuzzy[speedup]
from fuzzywuzzy import fuzz
x = "0 .. трубок использовали для прожигания стальковша.Замена воронки 18м 8сл. Разлита полностью."
y = "трубок использооали для прожигания"
fuzz.partial_ratio(x, y)
в нём есть некоторый шаблон, подставляются значения из самой базы
settings
├── dev.py
├── __init__.py
├── settings.py
└── test.py