diff --git a/Makefile b/Makefile index b438e1d..63917bd 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ ENV = env BIN = $(ENV)/bin PYTHON = $(BIN)/python -CODE_LOCATIONS = djlsp setup.py tests +CODE_LOCATIONS = djlsp tests clean: rm -rf $(ENV) @@ -31,11 +31,11 @@ test: lint $(BIN)/tox run install-ci: $(ENV) - $(PYTHON) -m pip install --upgrade pip setuptools wheel twine . + $(PYTHON) -m pip install --upgrade pip setuptools wheel twine build . .PHONY: build build: - $(PYTHON) setup.py sdist bdist_wheel + $(PYTHON) -m build $(BIN)/twine check dist/* upload: diff --git a/djlsp/__init__.py b/djlsp/__init__.py index f8c6ac7..3ed6a43 100644 --- a/djlsp/__init__.py +++ b/djlsp/__init__.py @@ -1 +1,3 @@ -__version__ = "0.9.5" +from importlib.metadata import version + +__version__ = version("django-template-lsp") diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..c83d18c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,60 @@ +[project] +name = "django-template-lsp" +version = "0.9.5" +description = "Django template LSP" +readme = "README.md" +authors = [{name = "Four Digits", email = "info@fourdigits.nl" }] +license = { file = "LICENSE" } +classifiers = [ + "Environment :: Web Environment", + "Framework :: Django", + "Intended Audience :: Developers", + "License :: OSI Approved :: GPL3 License", + "Programming Language :: Python", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12" +] +keywords = ["django", "template", "lsp", "python"] +dependencies = [ + "pygls", + "jedi" +] +requires-python = ">=3.9" + +[project.scripts] +djlsp = "djlsp.cli:main" +django-template-lsp = "djlsp.cli:main" + +[project.optional-dependencies] +dev = [ + "tox", + "black", + "isort", + "flake8", + "pytest", + "pytest-check", + "pytest-cov", +] + +[project.urls] +Homepage = "https://github.com/fourdigits/django-template-lsp" + +[build-system] +requires = ["setuptools", "wheel", "build"] +build-backend = "setuptools.build_meta" + +[tool.setuptools] +include-package-data = false + +[tool.setuptools.packages.find] +include = ["djlsp*"] + +[tool.isort] +profile = "black" +known_first_party = "djlsp" + +[tool.flake8] +max-line-length = 88 +extend-ignore = "W503" \ No newline at end of file diff --git a/releasing.md b/releasing.md index 79aa1cf..1e0ec9c 100644 --- a/releasing.md +++ b/releasing.md @@ -2,7 +2,7 @@ To create a new release, follow these steps: -- Update the version number in `djlsp/__init__.py` and push this to `main`. +- Update the version number in `pyproject.toml` and push this to `main`. - We use [semantic](https://semver.org/) versioning. - Create a new tag and push the tag using `git push --tags`. diff --git a/setup.py b/setup.py deleted file mode 100644 index 170ba34..0000000 --- a/setup.py +++ /dev/null @@ -1,42 +0,0 @@ -from setuptools import find_packages, setup - -from djlsp import __version__ - - -def readme(): - with open("README.md") as f: - return f.read() - - -setup( - name="django-template-lsp", - version=__version__, - description="Django template LSP", - long_description=readme(), - long_description_content_type="text/markdown", - license="GPL3", - packages=find_packages(include=["djlsp", "djlsp.*"]), - package_data={"djlsp": ["scripts/*.py"]}, - entry_points={ - "console_scripts": [ - "djlsp = djlsp.cli:main", - "django-template-lsp = djlsp.cli:main", - ] - }, - python_requires=">= 3.9", - install_requires=[ - "pygls", - "jedi", - ], - extras_require={ - "dev": [ - "tox", - "black", - "isort", - "flake8", - "pytest", - "pytest-check", - "pytest-cov", - ] - }, -)