Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pystencils-sfg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pycodegen
pystencils-sfg
Commits
6915d55c
Commit
6915d55c
authored
9 months ago
by
Frederik Hennig
Browse files
Options
Downloads
Patches
Plain Diff
Fix version string in docs. Update CONTRIBUTING.
parent
70901aae
No related branches found
No related tags found
No related merge requests found
Pipeline
#67948
passed
9 months ago
Stage: Code Quality
Stage: Tests
Stage: Documentation
Stage: deploy
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
.gitignore
+1
-2
1 addition, 2 deletions
.gitignore
CONTRIBUTING.md
+13
-15
13 additions, 15 deletions
CONTRIBUTING.md
docs/source/conf.py
+10
-1
10 additions, 1 deletion
docs/source/conf.py
git-hooks/pre-commit
+2
-2
2 additions, 2 deletions
git-hooks/pre-commit
pyproject.toml
+3
-1
3 additions, 1 deletion
pyproject.toml
with
29 additions
and
21 deletions
.gitignore
+
1
−
2
View file @
6915d55c
...
@@ -7,9 +7,8 @@
...
@@ -7,9 +7,8 @@
**/build
**/build
#
pdm
dev environment
# dev environment
**/.venv
**/.venv
.pdm-python
# build artifacts
# build artifacts
dist
dist
...
...
This diff is collapsed.
Click to expand it.
CONTRIBUTING.md
+
13
−
15
View file @
6915d55c
...
@@ -20,37 +20,35 @@ a local clone of your fork.
...
@@ -20,37 +20,35 @@ a local clone of your fork.
### Set up your dev environment
### Set up your dev environment
`pystencils-sfg`
uses
[
`pdm`
](
https://pdm-project.org
)
for managing a virtual development environment.
Create a virtual environment using either
`venv`
or
`virtualenv`
and install the pystencils-sfg source tree
Install
`pdm`
through your system's package manager and run
`pdm sync`
in your cloned project directory.
into it using an editable install, e.g. by running the following commands in the
`pystencils-sfg`
project root directory:
It will set up a virtual environment in the subfolder
`.venv`
, installing all project dependencies into it.
The
`pystencils-sfg`
package itself is also installed in editable mode.
```
bash
You can activate the virtual environment using
`eval $(pdm venv activate)`
.
python
-m
virtualenv .venv
source
.venv/bin/activate
pip
install
-e
.
```
### Code Style and Type Checking
### Code Style and Type Checking
To contribute, please adhere to the Python code style set by
[
PEP 8
](
https://peps.python.org/pep-0008/
)
.
To contribute, please adhere to the Python code style set by
[
PEP 8
](
https://peps.python.org/pep-0008/
)
.
It is recommended that you use
the
[
black
](
https://pypi.org/project/black/
)
formatter
to format your source files
.
For consistency, format all your source files using
the
[
black
](
https://pypi.org/project/black/
)
formatter.
Use flake8
(installed in the
`pdm`
virtual environment)
to check your code style:
Use flake8 to check your code style:
```
shell
```
shell
pdm run flake8 src/pystencilssfg
# or, if .venv is activated
flake8 src/pystencilssfg
flake8 src/pystencilssfg
```
```
Further,
`pystencils-sfg`
takes a rigorous approach to correct static typing
.
Further,
`pystencils-sfg`
is being fully type-checked using
[
MyPy
](
https://www.mypy-lang.org/
)
.
All submitted code should contain type annotations (
[
PEP 484
](
https://peps.python.org/pep-0484/
)
) and must be
All submitted code should contain type annotations (
[
PEP 484
](
https://peps.python.org/pep-0484/
)
) and must be
correctly statically typed.
correctly statically typed.
To check types, we use
[
MyPy
](
https://www.mypy-lang.org/
)
, which is automatically installed in the dev environment
Before each commit, check your types by calling
and can be invoked as
```
shell
```
shell
pdm run mypy src/pystencilssfg
# or, if .venv is activated
mypy src/pystencilssfg
mypy src/pystencilssfg
```
```
Both
`flake8`
and
`mypy`
are also run in the integration pipeline.
Both
`flake8`
and
`mypy`
are also run in the integration pipeline.
It is furthermore recommended to run both checkers as
a git pre-commit hook.
You can automate the code quality checks by running them via
a git pre-commit hook.
Such a hook can be installed using the
[
`install_git_hooks.sh`
](
install_git_hooks.sh
)
script located at the project root.
Such a hook can be installed using the
[
`install_git_hooks.sh`
](
install_git_hooks.sh
)
script located at the project root.
This diff is collapsed.
Click to expand it.
docs/source/conf.py
+
10
−
1
View file @
6915d55c
from
pystencilssfg
import
__version__
as
sfg_version
from
packaging.version
import
Version
# Configuration file for the Sphinx documentation builder.
# Configuration file for the Sphinx documentation builder.
#
#
# For the full list of built-in configuration values, see the documentation:
# For the full list of built-in configuration values, see the documentation:
...
@@ -9,7 +12,13 @@
...
@@ -9,7 +12,13 @@
project
=
"
pystencils-sfg
"
project
=
"
pystencils-sfg
"
copyright
=
"
2024, Frederik Hennig
"
copyright
=
"
2024, Frederik Hennig
"
author
=
"
Frederik Hennig
"
author
=
"
Frederik Hennig
"
release
=
"
0.0a
"
parsed_version
=
Version
(
sfg_version
)
version
=
"
.
"
.
join
([
parsed_version
.
public
])
release
=
sfg_version
html_title
=
f
"
pystencils-sfg v
{
version
}
Documentation
"
# -- General configuration ---------------------------------------------------
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
...
...
This diff is collapsed.
Click to expand it.
git-hooks/pre-commit
+
2
−
2
View file @
6915d55c
#!/bin/bash
#!/bin/bash
echo
"[Pre-Commit] Checking code style"
echo
"[Pre-Commit] Checking code style"
pdm run
flake8 src/pystencilssfg
flake8 src/pystencilssfg
status
=
$?
status
=
$?
if
[
${
status
}
!=
0
]
;
then
if
[
${
status
}
!=
0
]
;
then
...
@@ -11,7 +11,7 @@ else
...
@@ -11,7 +11,7 @@ else
fi
fi
echo
"[Pre-Commit] Checking types"
echo
"[Pre-Commit] Checking types"
pdm run
mypy src/pystencilssfg
mypy src/pystencilssfg
status
=
$?
status
=
$?
if
[
${
status
}
!=
0
]
;
then
if
[
${
status
}
!=
0
]
;
then
exit
1
exit
1
...
...
This diff is collapsed.
Click to expand it.
pyproject.toml
+
3
−
1
View file @
6915d55c
...
@@ -29,6 +29,7 @@ interactive = [
...
@@ -29,6 +29,7 @@ interactive = [
testing
=
[
testing
=
[
"flake8>
=
6.1
.
0
",
"flake8>
=
6.1
.
0
",
"mypy>
=
1.7
.
0
",
"mypy>
=
1.7
.
0
",
"black"
]
]
docs
=
[
docs
=
[
"sphinx"
,
"sphinx"
,
...
@@ -36,7 +37,8 @@ docs = [
...
@@ -36,7 +37,8 @@ docs = [
"myst-parser"
,
"myst-parser"
,
"sphinx_design"
,
"sphinx_design"
,
"sphinx_autodoc_typehints"
,
"sphinx_autodoc_typehints"
,
"sphinx-copybutton"
"sphinx-copybutton"
,
"packaging"
]
]
[tool.versioneer]
[tool.versioneer]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment