Skip to content

Commit e5af7d8

Browse files
committed
Upgrade gitlab-markup to 1.7.0
The new version requires `python3` to be available. In omnibus installation this is already a reality as we are currently pathing previous `gitlab-markup` version to use `python3` instead of `python2`. We are now requiring `python3` with the gem without having to patch it. As a consequence to also make it easy to use it in development, we've introduced a `Pipfile` and `Pipfile.lock`, working similarly to `Gemfile` and `Gemfile.lock`, and added documentation on how to use them.
1 parent 98824f3 commit e5af7d8

File tree

7 files changed

+130
-3
lines changed

7 files changed

+130
-3
lines changed

Gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ gem 'seed-fu', '~> 2.3.7'
116116
# Markdown and HTML processing
117117
gem 'html-pipeline', '~> 2.8'
118118
gem 'deckar01-task_list', '2.2.0'
119-
gem 'gitlab-markup', '~> 1.6.5'
119+
gem 'gitlab-markup', '~> 1.7.0'
120120
gem 'github-markup', '~> 1.7.0', require: 'github/markup'
121121
gem 'commonmarker', '~> 0.17'
122122
gem 'RedCloth', '~> 4.3.2'

Gemfile.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ GEM
286286
github-markup (1.7.0)
287287
gitlab-default_value_for (3.1.1)
288288
activerecord (>= 3.2.0, < 6.0)
289-
gitlab-markup (1.6.5)
289+
gitlab-markup (1.7.0)
290290
gitlab-sidekiq-fetcher (0.4.0)
291291
sidekiq (~> 5)
292292
gitlab-styles (2.5.1)
@@ -1020,7 +1020,7 @@ DEPENDENCIES
10201020
gitaly-proto (~> 1.13.0)
10211021
github-markup (~> 1.7.0)
10221022
gitlab-default_value_for (~> 3.1.1)
1023-
gitlab-markup (~> 1.6.5)
1023+
gitlab-markup (~> 1.7.0)
10241024
gitlab-sidekiq-fetcher (~> 0.4.0)
10251025
gitlab-styles (~> 2.4)
10261026
gitlab_omniauth-ldap (~> 2.1.1)

Pipfile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[[source]]
2+
name = "pypi"
3+
url = "https://pypi.org/simple"
4+
verify_ssl = true
5+
6+
[dev-packages]
7+
8+
[packages]
9+
docutils = "==0.13.1"
10+
11+
[requires]
12+
python_version = "3.4"

Pipfile.lock

+30
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: Update gitlab-markup to 1.7.0 which requies python3
3+
merge_request: 26246
4+
author:
5+
type: changed

doc/development/contributing/style_guides.md

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
text should be _sorry, we could not create your account because:_
2323
1. Code should be written in [US English][us-english]
2424
1. [Go](../go_guide/index.md)
25+
1. [Python](../python_guide/index.md)
2526

2627
This is also the style used by linting tools such as
2728
[RuboCop](https://github.com/bbatsov/rubocop) and [Hound CI](https://houndci.com).

doc/development/python_guide/index.md

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Python Development Guidelines
2+
3+
GitLab requires Python as a dependency for [reStructuredText](http://docutils.sourceforge.net/rst.html)
4+
markup rendering.
5+
6+
As of GitLab 11.10, we require Python 3.
7+
8+
## Installation
9+
10+
There are several ways of installing python on your system. To be able to use the same version we use in production,
11+
we suggest you use [pyenv](https://github.com/pyenv/pyenv). It works and behave similar to its counterpart in the
12+
ruby world: [rbenv](https://github.com/rbenv/rbenv).
13+
14+
### macOS
15+
16+
To install `pyenv` on macOS, you can use [Homebrew](https://brew.sh/) with:
17+
18+
```bash
19+
brew install pyenv
20+
```
21+
22+
### Linux
23+
24+
To install `pyenv` on Linux, you can run the command below:
25+
26+
```bash
27+
curl https://pyenv.run | bash
28+
```
29+
30+
Alternatively, you may find `pypenv` available as a system package via your distro package manager.
31+
32+
You can read more about it in: <https://github.com/pyenv/pyenv-installer#prerequisites>.
33+
34+
### Shell integration
35+
36+
Pyenv installation will add required changes to Bash. If you use a different shell,
37+
check for any additional steps required for it.
38+
39+
For Fish, you can install a plugin for [Fisherman](https://github.com/fisherman/fisherman):
40+
41+
```bash
42+
fisher add fisherman/pyenv
43+
```
44+
45+
Or for [Oh My Fish](https://github.com/oh-my-fish/oh-my-fish):
46+
47+
```bash
48+
omf install pyenv
49+
```
50+
51+
## Dependency management
52+
53+
While GitLab doesn't directly contain any Python scripts, because we depend on Python to render
54+
[reStructuredText](http://docutils.sourceforge.net/rst.html) markup, we need to keep track on dependencies
55+
on the main project level, so we can run that on our development machines.
56+
57+
Recently, an equivalent to the `Gemfile` and the [Bundler](https://bundler.io/) project has been introduced to Python:
58+
`Pipfile` and [Pipenv](https://pipenv.readthedocs.io/en/latest/).
59+
60+
You will now find a `Pipfile` with the dependencies in the root folder. To install them, run:
61+
62+
```bash
63+
pipenv install
64+
```
65+
66+
Running this command will install both the required Python version as well as required pip dependencies.
67+
68+
## Use instructions
69+
70+
To run any python code under the Pipenv environment, you need to first start a `virtualenv` based on the dependencies
71+
of the application. With Pipenv, this is a simple as running:
72+
73+
```bash
74+
pipenv shell
75+
```
76+
77+
After running that command, you can run GitLab on the same shell and it will be using the Python and dependencies
78+
installed from the `pipenv install` command.
79+

0 commit comments

Comments
 (0)