Skip to content

Commit f06afc3

Browse files
committed
feat: add README.md
1 parent ee25646 commit f06afc3

File tree

2 files changed

+72
-21
lines changed

2 files changed

+72
-21
lines changed

README.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,45 @@
11
# primecount
2-
A Python wrapper for primecount.
2+
A Python wrapper for [primecount](https://github.com/kimwalisch/primecount).
3+
4+
### Documentation
5+
6+
This package follows the documentation provided by [the C API reference](https://github.com/kimwalisch/primecount), generating three methods: `primecount.nth_prime`, `primecount.pi` and `primecount.phi`.
7+
8+
### Installation
9+
10+
In the first place, you have to download [the source code of the library](https://github.com/kimwalisch/primecount) and build it. Make sure you have installed [cmake](https://cmake.org/), [git](https://git-scm.com/) and [make](https://www.gnu.org/software/make/). You might have to make use of `sudo` if `make install` ever fails.
11+
12+
```
13+
git clone https://github.com/kimwalisch/primecount
14+
cd primecount
15+
cmake . -DBUILD_SHARED_LIBS=ON
16+
make -j
17+
make install
18+
```
19+
20+
After having installed the library, it's time to install the Python wrapper by cloning this repository. Make sure you have installed [pip](https://pypi.org/project/pip/) and that `primecount` is reachable as a shared library using a compiler.
21+
22+
```
23+
git clone https://github.com/hearot/primecount
24+
cd primecount
25+
pip install .
26+
```
27+
28+
Instead of the last command, you can type `python setup.py install` as well.
29+
30+
### Commit messages
31+
32+
> See [Conventional Commits](https://www.conventionalcommits.org).
33+
34+
### Contributing
35+
36+
> See [CONTRIBUTING.md](./CONTRIBUTING.md).
37+
38+
### Versioning
39+
40+
> See [PEP 440](https://www.python.org/dev/peps/pep-0440/).
41+
42+
### Copyright & License
43+
44+
- Copyright (C) 2020 [Hearot](https://github.com/hearot).
45+
- Licensed under the terms of the [BSD 2-Clause License](./LICENSE).

setup.py

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
# POSSIBILITY OF SUCH DAMAGE.
3030

3131
import re
32-
from distutils.core import Extension, setup
32+
from setuptools import Extension, setup
3333

3434
CLASSIFIERS = [
3535
"Development Status :: 5 - Production/Stable",
@@ -56,6 +56,7 @@
5656
]
5757
KEYWORDS = "c calculation computation extension primecount primes"
5858
GITHUB_REPOSITORY = "https://github.com/hearot/primecount/blob/v%s/"
59+
GITHUB_URL = "https://github.com/hearot/primecount"
5960
LICENSE = "BSD2"
6061
PACKAGE_NAME = "primecount"
6162
SOURCE_FILE = "primecount.c"
@@ -80,22 +81,29 @@
8081
long_description = f.read().replace("./", GITHUB_REPOSITORY % version)
8182

8283

83-
setup(
84-
author=author,
85-
author_email=author_email,
86-
classifiers=CLASSIFIERS,
87-
description=description,
88-
ext_modules=[primecount_module],
89-
keywords=KEYWORDS,
90-
license="BSD2",
91-
long_description=long_description,
92-
long_description_content_type="text/markdown",
93-
name=PACKAGE_NAME,
94-
project_urls={
95-
"Tracker": "https://github.com/hearot/primecount/issues",
96-
"Source": "https://github.com/hearot/primecount",
97-
},
98-
python_requires=">=3.6.*",
99-
url=url,
100-
version=version,
101-
)
84+
try:
85+
setup(
86+
author=author,
87+
author_email=author_email,
88+
classifiers=CLASSIFIERS,
89+
description=description,
90+
ext_modules=[primecount_module],
91+
keywords=KEYWORDS,
92+
license="BSD2",
93+
long_description=long_description,
94+
long_description_content_type="text/markdown",
95+
name=PACKAGE_NAME,
96+
project_urls={
97+
"Tracker": GITHUB_URL + "/issues",
98+
"Source": GITHUB_URL,
99+
},
100+
python_requires=">=3.6.*",
101+
url=url,
102+
version=version,
103+
)
104+
except SystemExit:
105+
print(
106+
"\nIt seems the installation didn't end well.\n"
107+
"Have you installed primecount as library?\n"
108+
f"Follow the guide on {GITHUB_URL}."
109+
)

0 commit comments

Comments
 (0)